This commit is contained in:
Вячеслав Иванов 2023-11-11 16:43:29 +04:00
parent 5a9d142e38
commit a7d52f3692
2 changed files with 7 additions and 7 deletions

View File

@ -18,10 +18,10 @@ public class HardGeneric <T extends EntityBus,U extends IDraw> {
private int pictureBoxHeight;
public HardGeneric(int maxCountBuses, int countSecond, int width, int height) {
public HardGeneric(int maxCountBuses, int maxCountDoors, int width, int height) {
currentSize = 0;
MaxCountBuses = maxCountBuses;
MaxCountDoors = countSecond;
MaxCountDoors = maxCountDoors;
busArray = (T[]) new EntityBus[MaxCountBuses];
doorArray = (U[]) new IDraw[MaxCountDoors];
pictureBoxHeight = height;
@ -42,11 +42,11 @@ public class HardGeneric <T extends EntityBus,U extends IDraw> {
return 0;
}
public int insertDoor(U inter) {
if (doorArray[MaxCountBuses - 1] != null) {
public int insertDoor(U door) {
if (doorArray[MaxCountDoors - 1] != null) {
return -1;
}
doorArray[0] = inter;
doorArray[0] = door;
return 0;
}
@ -55,7 +55,7 @@ public class HardGeneric <T extends EntityBus,U extends IDraw> {
int indBus = rand.nextInt(0, currentSize);
int indDoors = rand.nextInt(0,currentSize);
EntityBus entity = busArray[indBus];
IDraw inter = doorArray[indDoors];
IDraw door = doorArray[indDoors];
return new DrawningBus(entity.Speed(), entity.Weight(), entity.BodyColor(),
pictureBoxWidth, pictureBoxHeight);
}

View File

@ -38,7 +38,7 @@ public class HardForm {
canvas.repaint();
}
private IDraw createDrawningDoor(){
private IDraw createDrawningDoor() {
return new DrawningDoor(pictureBoxWidth, pictureBoxHeight, 0, 0);
}