Ready LabWork04 for pull request

This commit is contained in:
ekallin 2023-10-24 13:43:09 +04:00
parent ede2388115
commit 31e2860de6
3 changed files with 1 additions and 31 deletions

View File

@ -80,6 +80,7 @@
this.ButtonRemoveLocomotive.TabIndex = 1;
this.ButtonRemoveLocomotive.Text = "Удалить локо";
this.ButtonRemoveLocomotive.UseVisualStyleBackColor = true;
this.ButtonRemoveLocomotive.Click += new System.EventHandler(this.ButtonRemoveLocomotive_Click);
//
// ButtonAddLocomotive
//

View File

@ -104,7 +104,6 @@ namespace ProjectElectricLocomotive
}
}
private void ButtonRemoveLocomotive_Click(object sender, EventArgs e)
{
if (listBoxStorage.SelectedIndex == -1) return;

View File

@ -32,32 +32,6 @@ namespace ProjectElectricLocomotive.Generics
if (position < 0 || position >= _maxCount) return -1;
_places.Insert(position, loco);
return position;
/* int NoEmpty = 0, temp = 0;
for (int i = position; i < Count; i++)
{
if (_places[i] != null) NoEmpty++;
}
if (NoEmpty == Count - position - 1) return -1;
if (position < Count && position >= 0)
{
for (int j = position; j < Count; j++)
{
if (_places[j] == null)
{
temp = j;
break;
}
}
// shift right
for (int i = temp; i > position; i--)
{
_places[i] = _places[i - 1];
}
_places[position] = loco;
return position;
}
return -1;*/
}
public T? Remove(int position)
@ -70,7 +44,6 @@ namespace ProjectElectricLocomotive.Generics
return tmp;
}
public T? this[int position]
{
get
@ -82,9 +55,6 @@ namespace ProjectElectricLocomotive.Generics
{
if (position < 0 || position >= Count || Count == _maxCount) return;
_places.Insert(position, value);
// TODO проверка позиции
// TODO проверка свободных мест в списке
// TODO вставка в список по позиции
}
}
/// <summary>