diff --git a/src/Generics/HardGeneric.java b/src/Generics/HardGeneric.java index 2f36800..3259073 100644 --- a/src/Generics/HardGeneric.java +++ b/src/Generics/HardGeneric.java @@ -7,44 +7,39 @@ import src.Entities.EntityAirplane; import java.util.Random; public class HardGeneric { - T[] arrFirst; - U[] arrSecond; - + T[] arrAirplanes; + U[] arrIlluminators; private int curSz; private int CountFirst; private int CountSecond; - private int pictureBoxWidth; - private int pictureBoxHeight; - public HardGeneric(int countFirst, int countSecond, int width, int height){ curSz = 0; CountFirst = countFirst; CountSecond = countSecond; - arrFirst = (T[]) new EntityAirplane[CountFirst]; - arrSecond = (U[]) new IDraw[CountSecond]; + arrAirplanes = (T[]) new EntityAirplane[CountFirst]; + arrIlluminators = (U[]) new IDraw[CountSecond]; pictureBoxHeight = height; pictureBoxWidth = width; } - public int InsertFirst(T entityMonorail){ - if(arrFirst[CountFirst-1] != null) + public int InsertFirst(T entityAirplane){ + if(arrAirplanes[CountFirst-1] != null) return -1; for(int i = curSz -1; i>= 0; i--) { - arrFirst[i + 1] = arrFirst[i]; - arrSecond[i + 1] = arrSecond[i]; + arrAirplanes[i + 1] = arrAirplanes[i]; + arrIlluminators[i + 1] = arrIlluminators[i]; } curSz++; - arrFirst[0] = entityMonorail; - + arrAirplanes[0] = entityAirplane; return 0; } public int InsertSecond(U inter){ - if(arrSecond[CountSecond-1] != null) + if(arrIlluminators[CountSecond-1] != null) return -1; - arrSecond[0] = inter; + arrIlluminators[0] = inter; return 0; } @@ -52,8 +47,8 @@ public class HardGeneric { Random rand = new Random(); int indFirst = rand.nextInt(0, curSz); int indSecond = rand.nextInt(0,curSz); - EntityAirplane entity = arrFirst[indFirst]; - IDraw inter = arrSecond[indSecond]; + EntityAirplane entity = arrAirplanes[indFirst]; + IDraw inter = arrIlluminators[indSecond]; DrawningAirplane airplane = new DrawningAirplane(entity.Speed(), entity.Weight(), entity.BodyColor(), pictureBoxWidth, pictureBoxHeight); return airplane; diff --git a/src/Main.java b/src/Main.java index 74fcc09..aaa6d6c 100644 --- a/src/Main.java +++ b/src/Main.java @@ -14,7 +14,6 @@ import javax.swing.*; public class Main { public static void main(String[] args) throws IOException { - FormAirplaneCollection form =new FormAirplaneCollection(); - //FormForHard form = new FormForHard(); + FormForHard form = new FormForHard(); } } \ No newline at end of file