точно done

This commit is contained in:
Baryshev Dmitry 2024-04-04 20:29:32 +04:00
parent 3acb396c7d
commit 4be36616a6
2 changed files with 0 additions and 78 deletions

View File

@ -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;
}
}

View File

@ -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();
}