Лаб 3
This commit is contained in:
parent
55e54327c6
commit
38ed0c2a42
@ -27,6 +27,18 @@
|
||||
public bool Insert(T locomotive)
|
||||
{
|
||||
// TODO проверка на наличие свободных мест
|
||||
T testLocomotive = _places[0];
|
||||
for (int i = 0; i < Count; i++)
|
||||
{
|
||||
if (_places[i] == null)
|
||||
{
|
||||
testLocomotive = _places[i];
|
||||
}
|
||||
}
|
||||
if (testLocomotive != null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for (int i = Count - 2; i >= 0; i--)
|
||||
{
|
||||
_places[i + 1] = _places[i];
|
||||
|
Loading…
Reference in New Issue
Block a user