Compare commits
2 Commits
92f30977af
...
4de1bca002
Author | SHA1 | Date | |
---|---|---|---|
|
4de1bca002 | ||
5f5f61f51b |
@ -30,7 +30,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)
|
||||
|
@ -51,5 +51,6 @@ namespace HoistingCrane.CollectionGenericObjects
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -29,55 +29,52 @@
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public int Insert(T obj)
|
||||
{
|
||||
for (int i = 0; i < Count; i++)
|
||||
{
|
||||
if (arr[i] == null)
|
||||
{
|
||||
return Insert(obj, 0);
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int Insert(T obj, int position)
|
||||
{
|
||||
//todo Проверка позиции
|
||||
|
||||
if (position < 0 || position > Count)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int pos = position - 1;
|
||||
|
||||
while (position < Count)
|
||||
{
|
||||
if (arr[position] == null)
|
||||
{
|
||||
arr[position] = obj;
|
||||
return position;
|
||||
}
|
||||
else
|
||||
position++;
|
||||
}
|
||||
while (pos > 0)
|
||||
{
|
||||
if (Insert(obj, position + 1) != null)
|
||||
if (arr[position] == null)
|
||||
{
|
||||
arr[position] = obj;
|
||||
return position;
|
||||
}
|
||||
if (Insert(obj, position - 1) != null)
|
||||
{
|
||||
return position;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
position--;
|
||||
}
|
||||
|
||||
return -1;
|
||||
|
||||
}
|
||||
public T? Remove(int position)
|
||||
{
|
||||
if(position >= 0 && position < Count)
|
||||
if (position < 0 || position > Count)
|
||||
{
|
||||
T? temp = arr[position];
|
||||
arr[position] = null;
|
||||
return temp;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
T? removed_object = arr[position];
|
||||
arr[position] = null;
|
||||
return removed_object;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user