PIbd-21_Potapov_N.S._Stormt.../ProjectStormtrooper/ExtensionDrawingPlane.java

32 lines
991 B
Java
Raw Normal View History

package ProjectStormtrooper;
import java.awt.*;
public class ExtensionDrawingPlane {
public static DrawingPlane CreateDrawingPlane(String info, String separatorForObject, int width, int height) {
String[] strs = info.split(separatorForObject);
if (strs.length == 3)
{
return new DrawingPlane(
Integer.parseInt(strs[0]),
Integer.parseInt(strs[1]),
Color.getColor(strs[2]),
width, height
);
}
if (strs.length == 6)
{
return new DrawingStormtrooper(
Integer.parseInt(strs[0]),
Integer.parseInt(strs[1]),
Color.getColor(strs[2]),
Color.getColor(strs[3]),
Boolean.parseBoolean(strs[4]),
Boolean.parseBoolean(strs[5]),
width, height
);
}
return null;
}
}