From 766efc216d1cd946112200b3d3bdae83a7ed023a Mon Sep 17 00:00:00 2001 From: Zakharov_Rostislav Date: Fri, 10 Nov 2023 10:08:03 +0400 Subject: [PATCH] lab3 some minor fixes --- src/generics/HardGeneric.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/generics/HardGeneric.java b/src/generics/HardGeneric.java index 616d531..c8bb2d1 100644 --- a/src/generics/HardGeneric.java +++ b/src/generics/HardGeneric.java @@ -12,15 +12,15 @@ public class HardGeneric{ U[] blocks; private int shipsNumber; private int blocksNumber; - private final int pictureBoxWidth; - private final int pictureBoxHeight; + private final int PICTURE_WIDTH; + private final int PICTURE_HEIGHT; public HardGeneric(int shipsCount, int blocksCount, int width, int height){ shipsNumber = 0; blocksNumber = 0; ships = (T[]) new EntityShip[shipsCount]; blocks = (U[]) new IDrawBlocks[blocksCount]; - pictureBoxHeight = height; - pictureBoxWidth = width; + PICTURE_HEIGHT = height; + PICTURE_WIDTH = width; } public boolean insertShip(T entityShip){ if(ships[ships.length-1] != null) @@ -48,8 +48,8 @@ public class HardGeneric{ IDrawBlocks block = blocks[rand.nextInt(0, blocksNumber)]; if (entity instanceof EntityBattleship) return new DrawingBattleship(entity.getSpeed(), entity.getWeight(), entity.getBodyColor(), ((EntityBattleship) entity).getAdditionalColor(), - ((EntityBattleship) entity).getTurret(), ((EntityBattleship) entity).getRocketLauncher(), pictureBoxWidth, pictureBoxHeight, block.getType(), block.getNumber()); - return new DrawingShip(entity.getSpeed(), entity.getWeight(), entity.getBodyColor(), pictureBoxWidth, pictureBoxHeight, block.getType(), block.getNumber()); + ((EntityBattleship) entity).getTurret(), ((EntityBattleship) entity).getRocketLauncher(), PICTURE_WIDTH, PICTURE_HEIGHT, block.getType(), block.getNumber()); + return new DrawingShip(entity.getSpeed(), entity.getWeight(), entity.getBodyColor(), PICTURE_WIDTH, PICTURE_HEIGHT, block.getType(), block.getNumber()); } public EntityShip makeRandomShip(){ Random random = new Random();