методы добавления из 3ей лабы исправлены на полиморфные
This commit is contained in:
parent
bcc4a0d32f
commit
791d5205b3
@ -58,7 +58,7 @@ public class FormGenerationAirbus extends JFrame {
|
|||||||
new Color(rand.nextInt(0, 256), rand.nextInt(0, 256), rand.nextInt(0, 256)),
|
new Color(rand.nextInt(0, 256), rand.nextInt(0, 256), rand.nextInt(0, 256)),
|
||||||
rand.nextBoolean(), rand.nextBoolean());
|
rand.nextBoolean(), rand.nextBoolean());
|
||||||
}
|
}
|
||||||
generic.addAirbus(entity);
|
generic.add(entity);
|
||||||
// генерация иллюминаторов
|
// генерация иллюминаторов
|
||||||
IDrawningPortholes potholes;
|
IDrawningPortholes potholes;
|
||||||
int n = rand.nextInt(3);
|
int n = rand.nextInt(3);
|
||||||
@ -69,7 +69,7 @@ public class FormGenerationAirbus extends JFrame {
|
|||||||
else
|
else
|
||||||
potholes = new DrawningPortholesSquare();
|
potholes = new DrawningPortholesSquare();
|
||||||
potholes.SetCount(rand.nextInt(1,4)*10);
|
potholes.SetCount(rand.nextInt(1,4)*10);
|
||||||
generic.addPortholes(potholes);
|
generic.add(potholes);
|
||||||
|
|
||||||
// отрисовка
|
// отрисовка
|
||||||
_airbus = generic.randomDrawingObject();
|
_airbus = generic.randomDrawingObject();
|
||||||
|
@ -28,7 +28,7 @@ public class GenericParametrized<T extends EntityAirbus, U extends IDrawningPort
|
|||||||
_portholes = new ArrayList<U>();
|
_portholes = new ArrayList<U>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean addAirbus(T airbus)
|
public boolean add(T airbus)
|
||||||
{
|
{
|
||||||
if (airbus == null || CountAirbus >= MaxCountAirbus)
|
if (airbus == null || CountAirbus >= MaxCountAirbus)
|
||||||
return false;
|
return false;
|
||||||
@ -37,7 +37,7 @@ public class GenericParametrized<T extends EntityAirbus, U extends IDrawningPort
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean addPortholes(U porthole)
|
public boolean add(U porthole)
|
||||||
{
|
{
|
||||||
if (porthole == null || CountPortholes >= MaxCountPortoles)
|
if (porthole == null || CountPortholes >= MaxCountPortoles)
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user