fix last todo
This commit is contained in:
parent
5aaae123bd
commit
49bcf52b3a
@ -69,7 +69,7 @@ namespace Airbus
|
|||||||
if (form.ShowDialog() == DialogResult.OK)
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
DrawningObjectAirplane airplane = new(form.SelectedAirplane);
|
DrawningObjectAirplane airplane = new(form.SelectedAirplane);
|
||||||
if (_mapAirplanesCollectionGeneric + airplane)
|
if (_mapAirplanesCollectionGeneric + airplane > -1)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Объект добавлен");
|
MessageBox.Show("Объект добавлен");
|
||||||
pictureBox.Image = _mapAirplanesCollectionGeneric.ShowSet();
|
pictureBox.Image = _mapAirplanesCollectionGeneric.ShowSet();
|
||||||
@ -97,7 +97,7 @@ namespace Airbus
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int pos = Convert.ToInt32(maskedTextBoxPosition.Text);
|
int pos = Convert.ToInt32(maskedTextBoxPosition.Text);
|
||||||
if (_mapAirplanesCollectionGeneric - pos)
|
if (_mapAirplanesCollectionGeneric - pos != null )
|
||||||
{
|
{
|
||||||
MessageBox.Show("Объект удален");
|
MessageBox.Show("Объект удален");
|
||||||
pictureBox.Image = _mapAirplanesCollectionGeneric.ShowSet();
|
pictureBox.Image = _mapAirplanesCollectionGeneric.ShowSet();
|
||||||
|
@ -55,7 +55,7 @@ namespace Airbus
|
|||||||
/// <param name="map"></param>
|
/// <param name="map"></param>
|
||||||
/// <param name="car"></param>
|
/// <param name="car"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static bool operator +(MapWithSetAirplaneGeneric<T, U> map, T airplane)
|
public static int operator +(MapWithSetAirplaneGeneric<T, U> map, T airplane)
|
||||||
{
|
{
|
||||||
return map._setAirplane.Insert(airplane);
|
return map._setAirplane.Insert(airplane);
|
||||||
}
|
}
|
||||||
@ -65,7 +65,7 @@ namespace Airbus
|
|||||||
/// <param name="map"></param>
|
/// <param name="map"></param>
|
||||||
/// <param name="position"></param>
|
/// <param name="position"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static bool operator -(MapWithSetAirplaneGeneric<T, U> map, int
|
public static T operator -(MapWithSetAirplaneGeneric<T, U> map, int
|
||||||
position)
|
position)
|
||||||
{
|
{
|
||||||
return map._setAirplane.Remove(position);
|
return map._setAirplane.Remove(position);
|
||||||
|
@ -30,14 +30,14 @@ namespace Airbus
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Insert(T airplane)
|
public int Insert(T airplane)
|
||||||
{
|
{
|
||||||
return Insert(airplane, 0);
|
return Insert(airplane, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Insert(T airplane, int position)
|
public int Insert(T airplane, int position)
|
||||||
{
|
{
|
||||||
if (position < 0 || position > _places.Length) return false;
|
if (position < 0 || position > _places.Length) return 0;
|
||||||
if (_places[position] != null && CanInsert(position))
|
if (_places[position] != null && CanInsert(position))
|
||||||
{
|
{
|
||||||
for (int i = _places.Length - 1; i > position; --i)
|
for (int i = _places.Length - 1; i > position; --i)
|
||||||
@ -50,17 +50,20 @@ namespace Airbus
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
_places[position] = airplane;
|
_places[position] = airplane;
|
||||||
return true;
|
return 1;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Удаление объекта из набора с конкретной позиции
|
/// Удаление объекта из набора с конкретной позиции
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="position"></param>
|
/// <param name="position"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool Remove(int position)
|
public T Remove(int position)
|
||||||
{
|
{
|
||||||
|
if (0 > position && position >= Count)
|
||||||
|
return null;
|
||||||
|
T delobj = _places[position];
|
||||||
_places[position] = null;
|
_places[position] = null;
|
||||||
return true;
|
return delobj;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Получение объекта из набора по позиции
|
/// Получение объекта из набора по позиции
|
||||||
|
Loading…
x
Reference in New Issue
Block a user