Сдача 7-й лабораторной.
This commit is contained in:
parent
46569d56d3
commit
f148e15e63
@ -34,9 +34,7 @@ namespace Airbus
|
|||||||
//конструктор
|
//конструктор
|
||||||
public MapWithSetPlanesGeneric(int picWidth, int picHeight, U map)
|
public MapWithSetPlanesGeneric(int picWidth, int picHeight, U map)
|
||||||
{
|
{
|
||||||
int width = picWidth / _placeSizeWidth;
|
_setPlanes = new SetPlanesGeneric<T>(18);
|
||||||
int height = picHeight / _placeSizeHeight;
|
|
||||||
_setPlanes = new SetPlanesGeneric<T>(width * height);
|
|
||||||
_pictureWidth = picWidth;
|
_pictureWidth = picWidth;
|
||||||
_pictureHeight = picHeight;
|
_pictureHeight = picHeight;
|
||||||
_map = map;
|
_map = map;
|
||||||
|
@ -1,4 +1,2 @@
|
|||||||
MapsCollection
|
MapsCollection
|
||||||
123|DesertStormMap|1000:750:Blue;
|
123|DesertStormMap|1000:750:Blue;1000:750:Yellow;1000:750:Red;1000:750:Lime;1000:750:Red;1000:750:Yellow;1000:750:Black;1000:750:Red;1000:750:DeepPink;1000:750:Black;1000:750:Yellow;1000:750:White;1000:750:Red;1000:750:Gray;1000:750:Lime;1000:750:Black;1000:750:Blue;1000:750:DeepPink;
|
||||||
6543|StarWarsMap|1000:750:Red:Red:True:True;
|
|
||||||
9876|SimpleMap|1000:750:Lime;
|
|
||||||
|
@ -29,7 +29,13 @@ namespace Airbus
|
|||||||
//добавление объекта в набор
|
//добавление объекта в набор
|
||||||
public int Insert(T plane)
|
public int Insert(T plane)
|
||||||
{
|
{
|
||||||
|
if (Count == _maxCount)
|
||||||
|
{
|
||||||
|
throw new StorageOverflowException(_maxCount);
|
||||||
|
}
|
||||||
|
|
||||||
if (Count + 1 <= _maxCount) return Insert(plane, 0);
|
if (Count + 1 <= _maxCount) return Insert(plane, 0);
|
||||||
|
|
||||||
else return -1;
|
else return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,11 +52,6 @@ namespace Airbus
|
|||||||
throw new ArgumentException($"Объект {plane} уже есть в наборе");
|
throw new ArgumentException($"Объект {plane} уже есть в наборе");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Count == _maxCount)
|
|
||||||
{
|
|
||||||
throw new StorageOverflowException(_maxCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
_places.Insert(position, plane);
|
_places.Insert(position, plane);
|
||||||
|
|
||||||
return position;
|
return position;
|
||||||
|
Loading…
Reference in New Issue
Block a user