pibd-12 Tangatarov.I.A. LabWork04 Base #17

Closed
sqdselo wants to merge 18 commits from LabWork04 into LabWork03
2 changed files with 20 additions and 14 deletions
Showing only changes of commit 21f4acf2d5 - Show all commits

View File

@ -31,7 +31,7 @@ namespace HoistingCrane.CollectionGenericObjects
{
get
{
return (pictureWidth * pictureHeight) / (_placeSizeHeight * _placeSizeWidth);
return (pictureWidth * pictureHeight) / (_placeSizeHeight * _placeSizeWidth)-3;
}
}
public AbstractCompany(int picWidth, int picHeight, ICollectionGenericObjects<DrawningTrackedVehicle> array)

View File

@ -45,29 +45,35 @@ namespace HoistingCrane.CollectionGenericObjects
public int Insert(T obj, int position)
{
//todo Проверка позиции
if (position < 0 || position > Count)
if (position < 0 || position >= Count)
{
return -1;
}
if (arr[position] == null)
int copyPos = position - 1;
while (position < Count)
{
arr[position] = obj;
return position;
}
else
{
if (Insert(obj, position + 1) != -1)
{
return position;
}
if (Insert(obj, position - 1) != -1)
if (arr[position] == null)
{
arr[position] = obj;
return position;
}
position++;
}
while (copyPos > 0)
{
if (arr[copyPos] == null)
{
arr[copyPos] = obj;
return copyPos;
}
copyPos--;
}
return -1;
}
public T? Remove(int position)