Лабораторная 3 финал
This commit is contained in:
parent
5f5f61f51b
commit
4de1bca002
@ -30,7 +30,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)
|
||||||
|
@ -36,7 +36,7 @@ namespace HoistingCrane.CollectionGenericObjects
|
|||||||
arr?.Get(i)?.SetPictureSize(pictureWidth, pictureHeight);
|
arr?.Get(i)?.SetPictureSize(pictureWidth, pictureHeight);
|
||||||
arr?.Get(i)?.SetPosition(_placeSizeWidth * currentPosWidth + 25, _placeSizeHeight * currentPosHeight + 15);
|
arr?.Get(i)?.SetPosition(_placeSizeWidth * currentPosWidth + 25, _placeSizeHeight * currentPosHeight + 15);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentPosWidth > 0)
|
if (currentPosWidth > 0)
|
||||||
currentPosWidth--;
|
currentPosWidth--;
|
||||||
else
|
else
|
||||||
@ -51,5 +51,6 @@ namespace HoistingCrane.CollectionGenericObjects
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,50 +31,50 @@
|
|||||||
}
|
}
|
||||||
public int Insert(T obj)
|
public int Insert(T obj)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < Count; i++)
|
return Insert(obj, 0);
|
||||||
{
|
|
||||||
if (arr[i] == null)
|
|
||||||
{
|
|
||||||
return Insert(obj, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arr[position] == null)
|
int pos = position - 1;
|
||||||
|
|
||||||
|
while (position < Count)
|
||||||
{
|
{
|
||||||
arr[position] = obj;
|
if (arr[position] == null)
|
||||||
return position;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (Insert(obj, position + 1) != null)
|
|
||||||
{
|
{
|
||||||
|
arr[position] = obj;
|
||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
if (Insert(obj, position - 1) != null)
|
position++;
|
||||||
|
}
|
||||||
|
while (pos > 0)
|
||||||
|
{
|
||||||
|
if (arr[position] == null)
|
||||||
{
|
{
|
||||||
|
arr[position] = obj;
|
||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
|
position--;
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
|
}
|
||||||
public T? Remove(int position)
|
public T? Remove(int position)
|
||||||
{
|
{
|
||||||
if(position >= 0 && position < Count)
|
if (position < 0 || position > Count)
|
||||||
{
|
{
|
||||||
T? temp = arr[position];
|
return null;
|
||||||
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