Готовая лабораторная 4
This commit is contained in:
parent
052b9929c1
commit
21f4acf2d5
@ -31,7 +31,7 @@ namespace HoistingCrane.CollectionGenericObjects
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return (pictureWidth * pictureHeight) / (_placeSizeHeight * _placeSizeWidth);
|
return (pictureWidth * pictureHeight) / (_placeSizeHeight * _placeSizeWidth)-3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public AbstractCompany(int picWidth, int picHeight, ICollectionGenericObjects<DrawningTrackedVehicle> array)
|
public AbstractCompany(int picWidth, int picHeight, ICollectionGenericObjects<DrawningTrackedVehicle> array)
|
||||||
|
@ -45,29 +45,35 @@ namespace HoistingCrane.CollectionGenericObjects
|
|||||||
|
|
||||||
public int Insert(T obj, int position)
|
public int Insert(T obj, int position)
|
||||||
{
|
{
|
||||||
//todo Проверка позиции
|
|
||||||
if (position < 0 || position > Count)
|
if (position < 0 || position >= Count)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int copyPos = position - 1;
|
||||||
|
|
||||||
|
while (position < Count)
|
||||||
|
{
|
||||||
if (arr[position] == null)
|
if (arr[position] == null)
|
||||||
{
|
{
|
||||||
arr[position] = obj;
|
arr[position] = obj;
|
||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
else
|
position++;
|
||||||
{
|
|
||||||
if (Insert(obj, position + 1) != -1)
|
|
||||||
{
|
|
||||||
return position;
|
|
||||||
}
|
}
|
||||||
if (Insert(obj, position - 1) != -1)
|
while (copyPos > 0)
|
||||||
{
|
{
|
||||||
return position;
|
if (arr[copyPos] == null)
|
||||||
|
{
|
||||||
|
arr[copyPos] = obj;
|
||||||
|
return copyPos;
|
||||||
}
|
}
|
||||||
|
copyPos--;
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public T? Remove(int position)
|
public T? Remove(int position)
|
||||||
|
Loading…
Reference in New Issue
Block a user