2022-12-16 22:37:38 +03:00

17 lines
514 B
Java

import java.awt.*;
import java.util.Random;
public class PortholeFabric {
public static IDrawingPorthole createRandom(Color color) {
Random rnd = new Random();
int type = rnd.nextInt(0, 3);
return switch(type) {
case 0 -> new DrawingPorthole(rnd.nextInt(1, 40), color);
case 1 -> new DrawingSquarePorthole(rnd.nextInt(1, 40), color);
case 2 -> new DrawingTrianglePorthole(rnd.nextInt(1, 40), color);
default -> null;
};
}
}