точно done
This commit is contained in:
parent
3acb396c7d
commit
4be36616a6
@ -1,62 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
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