18 lines
506 B
Java
Raw Permalink Normal View History

2022-11-15 17:20:34 +03:00
import java.awt.*;
import java.util.Random;
public class EnginesFabric {
public static IDrawingEngines createRandom(Color color) {
Random rnd = new Random();
int type = rnd.nextInt(0, 3);
return switch(type) {
case 0 -> new DrawingEngines(rnd.nextInt(1, 7), color);
case 1 -> new DrawingWavyEngines(rnd.nextInt(1, 7), color);
case 2 -> new DrawingTruncatedEngines(rnd.nextInt(1, 7), color);
default -> null;
};
}
}