Kashin M.I. Lab work 6 #11

Closed
Sosees04ka wants to merge 4 commits from LabWork06 into LabWork05_fix
2 changed files with 5 additions and 5 deletions
Showing only changes of commit b126dd0068 - Show all commits

View File

@ -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() {

View File

@ -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;
}