Agliullov D. A. Lab Work 3 Base #11

Merged
eegov merged 19 commits from Lab3 into Lab2 2022-10-14 10:03:33 +04:00
3 changed files with 9 additions and 8 deletions
Showing only changes of commit 17c69aebd7 - Show all commits

View File

@ -82,7 +82,7 @@
return;
}
int pos = Convert.ToInt32(maskedTextBoxPosition.Text);
if (_mapAirplanesCollectionGeneric - pos == -1)
if (_mapAirplanesCollectionGeneric - pos != null)
{
MessageBox.Show("Объект удален");
pictureBox.Image = _mapAirplanesCollectionGeneric.ShowSet();

View File

@ -57,7 +57,7 @@ namespace AirBomber
/// </summary>
/// <param name="map"></param>
/// <param name="airplane"></param>
/// <returns></returns>
/// <returns>Возвращает позицию вставленого объекта либо -1, если не получилось его добавить</returns>
public static int operator +(MapWithSetAirplanesGeneric<T, U> map, T airplane)
{
return map._setAirplanes.Insert(airplane);
@ -67,8 +67,8 @@ namespace AirBomber
/// </summary>
/// <param name="map"></param>
/// <param name="position"></param>
/// <returns></returns>
public static int operator -(MapWithSetAirplanesGeneric<T, U> map, int position)
/// <returns>Возвращает удаленный объект, либо null если его не удалось удалить</returns>
public static T operator -(MapWithSetAirplanesGeneric<T, U> map, int position)
{
return map._setAirplanes.Remove(position);
}

View File

@ -73,13 +73,14 @@ namespace AirBomber
/// Удаление объекта из набора с конкретной позиции
/// </summary>
/// <param name="position"></param>
/// <returns>Возвращает позицию вставленого объекта либо -1, если не получилось его добавить</returns>
public int Remove(int position)
/// <returns>Возвращает удаленный объект, либо null если его не удалось удалить</returns>
public T Remove(int position)
{
if (!isCorrectPosition(position))
return -1;
return null;
var result = _places[position];
_places[position] = null;
return position;
return result;
}
/// <summary>
/// Получение объекта из набора по позиции