done
This commit is contained in:
parent
cbbd0d4eb2
commit
3acb396c7d
@ -61,30 +61,6 @@ public class Autopark : AbstractCompany
|
||||
}
|
||||
}
|
||||
|
||||
//protected override void SetObjectsPosition()
|
||||
//{
|
||||
// int nowWidth = 0;
|
||||
// int nowHeight = 0;
|
||||
|
||||
// for (int i = 0; i < (_collection?.Count ?? 0); i++)
|
||||
// {
|
||||
// if (nowHeight > _pictureHeight / _placeSizeHeight)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
// if (_collection?.Get(i) != null)
|
||||
// {
|
||||
// _collection?.Get(i)?.SetPictureSize(_pictureWidth, _pictureHeight);
|
||||
// _collection?.Get(i)?.SetPosition(_placeSizeWidth * nowWidth + 30, nowHeight * _placeSizeHeight * 2 + 20);
|
||||
// }
|
||||
|
||||
// if (nowWidth < _pictureWidth / _placeSizeWidth - 1) nowWidth++;
|
||||
// else
|
||||
// {
|
||||
// nowWidth = 0;
|
||||
// nowHeight++;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectDumpTruck.CollectionGenericObject;
|
||||
|
||||
public enum CollectionType
|
||||
{
|
||||
None = 0,
|
||||
|
||||
Massive = 1,
|
||||
|
||||
List = 2
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectDumpTruck.CollectionGenericObject;
|
||||
|
||||
public class ListGenericObjects<T> : ICollectionGenericObject<T>
|
||||
where T : class
|
||||
{
|
||||
|
||||
private readonly List<T?> _collection;
|
||||
|
||||
private int _maxCount;
|
||||
|
||||
public int Count => _collection.Count;
|
||||
|
||||
public int SetMaxCount { set { if (value > 0) { _maxCount = value; } } }
|
||||
|
||||
public ListGenericObjects()
|
||||
{
|
||||
_collection = new();
|
||||
}
|
||||
|
||||
public T? Get(int position)
|
||||
{
|
||||
if (position<0||position>=Count) return null;
|
||||
return _collection[position];
|
||||
}
|
||||
|
||||
public int Insert(T obj)
|
||||
{
|
||||
if (Count + 1 > _maxCount)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
_collection.Add(obj);
|
||||
return 1;
|
||||
}
|
||||
|
||||
public int Insert(T obj, int position)
|
||||
{
|
||||
if (position < 0 || position > Count || Count + 1 > _maxCount)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
_collection.Insert(position, obj);
|
||||
return 1;
|
||||
}
|
||||
|
||||
public T? Remove(int position)
|
||||
{
|
||||
if (position < 0 || position > Count)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
T? obj = _collection[position];
|
||||
_collection.RemoveAt(position);
|
||||
return obj;
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectDumpTruck.CollectionGenericObject;
|
||||
|
||||
public class StorageCollection<T>
|
||||
where T : class
|
||||
{
|
||||
|
||||
private Dictionary<string, ICollectionGenericObject<T>> _storages;
|
||||
|
||||
public List<string>Keys => _storages.Keys.ToList();
|
||||
}
|
Loading…
Reference in New Issue
Block a user