Kashin M.I. Lab work 6 #11
@ -45,7 +45,7 @@ public class DrawingObjectGasolineTanker implements IDrawingObject {
|
||||
}
|
||||
|
||||
public static IDrawingObject Create(String data){
|
||||
return new DrawingObjectGasolineTanker(ExtentionGasolineTanker.CreateDrawingWarship(data));
|
||||
return new DrawingObjectGasolineTanker(ExtentionGasolineTanker.CreateDrawingGasolineTanker(data));
|
||||
}
|
||||
|
||||
public DrawingGasolineTanker GetGasolineTanker() {
|
||||
|
@ -3,13 +3,13 @@ import java.awt.*;
|
||||
public class ExtentionGasolineTanker {
|
||||
private static final char _separatorForObject=':';
|
||||
|
||||
public static DrawingGasolineTanker CreateDrawingWarship(String info){
|
||||
public static DrawingGasolineTanker CreateDrawingGasolineTanker(String info){
|
||||
String[] strs = info.split(Character.toString(_separatorForObject));
|
||||
|
||||
int spd=Integer.parseInt(strs[0]);
|
||||
float wght = Float.parseFloat(strs[1]);
|
||||
Color bodyClr=new Color(Integer.parseInt(strs[2]));
|
||||
IDrawningObjectWheels block = switch(strs[3]) {
|
||||
IDrawningObjectWheels wheels = switch(strs[3]) {
|
||||
case "DrawingWheels" -> new DrawingWheels(Integer.parseInt(strs[4]));
|
||||
case "DrawingOrnamentWheelsFirst" -> new DrawingOrnamentWheelsFirst(Integer.parseInt(strs[4]));
|
||||
case "DrawingOrnamentWheelsSecond" -> new DrawingOrnamentWheelsSecond(Integer.parseInt(strs[4]));
|
||||
@ -17,14 +17,14 @@ public class ExtentionGasolineTanker {
|
||||
};
|
||||
if (strs.length==5){
|
||||
EntityGasolineTanker ent=new EntityGasolineTanker(spd,wght,bodyClr);
|
||||
return new DrawingGasolineTanker(ent,block);
|
||||
return new DrawingGasolineTanker(ent,wheels);
|
||||
}
|
||||
if(strs.length==8){
|
||||
Color dopClr=new Color(Integer.parseInt(strs[5]));
|
||||
boolean bdkit=Boolean.parseBoolean(strs[6]);
|
||||
boolean ant=Boolean.parseBoolean(strs[7]);
|
||||
EntityImprovedGasolineTanker ent = new EntityImprovedGasolineTanker(spd,wght,bodyClr,dopClr,bdkit,ant);
|
||||
return new DrawingImprovedGasolineTanker(ent,block);
|
||||
return new DrawingImprovedGasolineTanker(ent,wheels);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user