итоговые правочки
This commit is contained in:
parent
9aae540110
commit
d2357e4ce5
@ -62,7 +62,7 @@ namespace Sailboat.Generics
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return collect?._collection.Insert(obj) ?? false;
|
return (bool)collect?._collection.Insert(obj);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Перегрузка оператора вычитания
|
/// Перегрузка оператора вычитания
|
||||||
@ -70,14 +70,14 @@ namespace Sailboat.Generics
|
|||||||
/// <param name="collect"></param>
|
/// <param name="collect"></param>
|
||||||
/// <param name="pos"></param>
|
/// <param name="pos"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static T? operator -(BoatsGenericCollection<T, U> collect, int pos)
|
public static bool operator -(BoatsGenericCollection<T, U> collect, int pos)
|
||||||
{
|
{
|
||||||
T? obj = collect._collection[pos];
|
T? obj = collect._collection[pos];
|
||||||
if (obj != null)
|
if (obj != null)
|
||||||
{
|
{
|
||||||
collect._collection.Remove(pos);
|
collect._collection.Remove(pos);
|
||||||
}
|
}
|
||||||
return obj;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -133,7 +133,7 @@ namespace Sailboat.Generics
|
|||||||
if (boat != null)
|
if (boat != null)
|
||||||
{
|
{
|
||||||
int width = _pictureWidth / _placeSizeWidth;
|
int width = _pictureWidth / _placeSizeWidth;
|
||||||
boat.SetPosition(i % width * _placeSizeWidth, _pictureHeight - _pictureHeight % _placeSizeHeight - (i / width + 1) * _placeSizeHeight);
|
boat.SetPosition(i % width * _placeSizeWidth, i / width * _placeSizeHeight);
|
||||||
boat.DrawTransport(g);
|
boat.DrawTransport(g);
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
|
@ -52,10 +52,9 @@ namespace Sailboat
|
|||||||
|
|
||||||
Color dopColor = Color.FromArgb(random.Next(0, 256),
|
Color dopColor = Color.FromArgb(random.Next(0, 256),
|
||||||
random.Next(0, 256), random.Next(0, 256));
|
random.Next(0, 256), random.Next(0, 256));
|
||||||
ColorDialog dialogAddColor = new();
|
if (dialog.ShowDialog() == DialogResult.OK)
|
||||||
if (dialogAddColor.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
{
|
||||||
dopColor = dialogAddColor.Color;
|
dopColor = dialog.Color;
|
||||||
}
|
}
|
||||||
|
|
||||||
_drawingBoat = new DrawingSailboat(random.Next(100, 300),
|
_drawingBoat = new DrawingSailboat(random.Next(100, 300),
|
||||||
|
@ -37,7 +37,9 @@ namespace Sailboat.Generics
|
|||||||
public bool Insert(T boat)
|
public bool Insert(T boat)
|
||||||
{
|
{
|
||||||
if (_places.Count == _maxCount)
|
if (_places.Count == _maxCount)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
Insert(boat, 0);
|
Insert(boat, 0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -49,8 +51,9 @@ namespace Sailboat.Generics
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool Insert(T boat, int position)
|
public bool Insert(T boat, int position)
|
||||||
{
|
{
|
||||||
if (!(position >= 0 && position <= Count && _places.Count < _maxCount))
|
if (!(position >= 0 && position <= Count && _places.Count < _maxCount)) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
_places.Insert(position, boat);
|
_places.Insert(position, boat);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -77,14 +80,16 @@ namespace Sailboat.Generics
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (!(position >= 0 && position < Count))
|
if (position < 0 || position >= Count) {
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
return _places[position];
|
return _places[position];
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (!(position >= 0 && position < Count && _places.Count < _maxCount))
|
if (!(position >= 0 && position < Count && _places.Count < _maxCount)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
_places.Insert(position, value);
|
_places.Insert(position, value);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user