методы добавления из 3ей лабы исправлены на полиморфные

This commit is contained in:
dex_moth 2023-12-03 10:15:33 +04:00
parent bcc4a0d32f
commit 791d5205b3
2 changed files with 4 additions and 4 deletions

View File

@ -58,7 +58,7 @@ public class FormGenerationAirbus extends JFrame {
new Color(rand.nextInt(0, 256), rand.nextInt(0, 256), rand.nextInt(0, 256)),
rand.nextBoolean(), rand.nextBoolean());
}
generic.addAirbus(entity);
generic.add(entity);
// генерация иллюминаторов
IDrawningPortholes potholes;
int n = rand.nextInt(3);
@ -69,7 +69,7 @@ public class FormGenerationAirbus extends JFrame {
else
potholes = new DrawningPortholesSquare();
potholes.SetCount(rand.nextInt(1,4)*10);
generic.addPortholes(potholes);
generic.add(potholes);
// отрисовка
_airbus = generic.randomDrawingObject();

View File

@ -28,7 +28,7 @@ public class GenericParametrized<T extends EntityAirbus, U extends IDrawningPort
_portholes = new ArrayList<U>();
}
public boolean addAirbus(T airbus)
public boolean add(T airbus)
{
if (airbus == null || CountAirbus >= MaxCountAirbus)
return false;
@ -37,7 +37,7 @@ public class GenericParametrized<T extends EntityAirbus, U extends IDrawningPort
return true;
}
public boolean addPortholes(U porthole)
public boolean add(U porthole)
{
if (porthole == null || CountPortholes >= MaxCountPortoles)
return false;