WIP: ПИбд-23 Волков Никита Андреевич Лабораторная работа №8 #10
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Bulldozer.DrawingObjects
|
namespace Bulldozer.DrawingObjects
|
||||||
{
|
{
|
||||||
public static class ExtentionDrawingBulldozer
|
public static class ExtensionDrawingBulldozer
|
||||||
{
|
{
|
||||||
public static DrawingBulldozer? CreateDrawingBulldozer(this string info, char separatorForObject, int width, int height)
|
public static DrawingBulldozer? CreateDrawingBulldozer(this string info, char separatorForObject, int width, int height)
|
||||||
{
|
{
|
@ -45,6 +45,8 @@
|
|||||||
this.toolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.toolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.SaveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.SaveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.LoadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.LoadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.ButtonSortByColor = new System.Windows.Forms.Button();
|
||||||
|
this.ButtonSortByType = new System.Windows.Forms.Button();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxCollection)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.pictureBoxCollection)).BeginInit();
|
||||||
this.panelTools.SuspendLayout();
|
this.panelTools.SuspendLayout();
|
||||||
this.groupListBulldozersBox.SuspendLayout();
|
this.groupListBulldozersBox.SuspendLayout();
|
||||||
@ -65,6 +67,8 @@
|
|||||||
// panelTools
|
// panelTools
|
||||||
//
|
//
|
||||||
this.panelTools.Anchor = System.Windows.Forms.AnchorStyles.Right;
|
this.panelTools.Anchor = System.Windows.Forms.AnchorStyles.Right;
|
||||||
|
this.panelTools.Controls.Add(this.ButtonSortByType);
|
||||||
|
this.panelTools.Controls.Add(this.ButtonSortByColor);
|
||||||
this.panelTools.Controls.Add(this.groupListBulldozersBox);
|
this.panelTools.Controls.Add(this.groupListBulldozersBox);
|
||||||
this.panelTools.Controls.Add(this.textBoxDeletingBulldozer);
|
this.panelTools.Controls.Add(this.textBoxDeletingBulldozer);
|
||||||
this.panelTools.Controls.Add(this.buttonUpdateColletion);
|
this.panelTools.Controls.Add(this.buttonUpdateColletion);
|
||||||
@ -132,7 +136,7 @@
|
|||||||
//
|
//
|
||||||
// textBoxDeletingBulldozer
|
// textBoxDeletingBulldozer
|
||||||
//
|
//
|
||||||
this.textBoxDeletingBulldozer.Location = new System.Drawing.Point(25, 525);
|
this.textBoxDeletingBulldozer.Location = new System.Drawing.Point(22, 525);
|
||||||
this.textBoxDeletingBulldozer.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
this.textBoxDeletingBulldozer.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
this.textBoxDeletingBulldozer.Name = "textBoxDeletingBulldozer";
|
this.textBoxDeletingBulldozer.Name = "textBoxDeletingBulldozer";
|
||||||
this.textBoxDeletingBulldozer.Size = new System.Drawing.Size(220, 27);
|
this.textBoxDeletingBulldozer.Size = new System.Drawing.Size(220, 27);
|
||||||
@ -140,7 +144,7 @@
|
|||||||
//
|
//
|
||||||
// buttonUpdateColletion
|
// buttonUpdateColletion
|
||||||
//
|
//
|
||||||
this.buttonUpdateColletion.Location = new System.Drawing.Point(25, 692);
|
this.buttonUpdateColletion.Location = new System.Drawing.Point(22, 693);
|
||||||
this.buttonUpdateColletion.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
this.buttonUpdateColletion.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
this.buttonUpdateColletion.Name = "buttonUpdateColletion";
|
this.buttonUpdateColletion.Name = "buttonUpdateColletion";
|
||||||
this.buttonUpdateColletion.Size = new System.Drawing.Size(221, 53);
|
this.buttonUpdateColletion.Size = new System.Drawing.Size(221, 53);
|
||||||
@ -150,7 +154,7 @@
|
|||||||
//
|
//
|
||||||
// buttonDeleteBulldozer
|
// buttonDeleteBulldozer
|
||||||
//
|
//
|
||||||
this.buttonDeleteBulldozer.Location = new System.Drawing.Point(25, 563);
|
this.buttonDeleteBulldozer.Location = new System.Drawing.Point(22, 560);
|
||||||
this.buttonDeleteBulldozer.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
this.buttonDeleteBulldozer.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
this.buttonDeleteBulldozer.Name = "buttonDeleteBulldozer";
|
this.buttonDeleteBulldozer.Name = "buttonDeleteBulldozer";
|
||||||
this.buttonDeleteBulldozer.Size = new System.Drawing.Size(221, 53);
|
this.buttonDeleteBulldozer.Size = new System.Drawing.Size(221, 53);
|
||||||
@ -161,7 +165,7 @@
|
|||||||
//
|
//
|
||||||
// buttonAddBulldozer
|
// buttonAddBulldozer
|
||||||
//
|
//
|
||||||
this.buttonAddBulldozer.Location = new System.Drawing.Point(24, 464);
|
this.buttonAddBulldozer.Location = new System.Drawing.Point(22, 464);
|
||||||
this.buttonAddBulldozer.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
this.buttonAddBulldozer.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
this.buttonAddBulldozer.Name = "buttonAddBulldozer";
|
this.buttonAddBulldozer.Name = "buttonAddBulldozer";
|
||||||
this.buttonAddBulldozer.Size = new System.Drawing.Size(221, 53);
|
this.buttonAddBulldozer.Size = new System.Drawing.Size(221, 53);
|
||||||
@ -202,17 +206,39 @@
|
|||||||
// SaveToolStripMenuItem
|
// SaveToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.SaveToolStripMenuItem.Name = "SaveToolStripMenuItem";
|
this.SaveToolStripMenuItem.Name = "SaveToolStripMenuItem";
|
||||||
this.SaveToolStripMenuItem.Size = new System.Drawing.Size(224, 26);
|
this.SaveToolStripMenuItem.Size = new System.Drawing.Size(166, 26);
|
||||||
this.SaveToolStripMenuItem.Text = "Сохранить";
|
this.SaveToolStripMenuItem.Text = "Сохранить";
|
||||||
this.SaveToolStripMenuItem.Click += new System.EventHandler(this.SaveToolStripMenuItem_Click);
|
this.SaveToolStripMenuItem.Click += new System.EventHandler(this.SaveToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
// LoadToolStripMenuItem
|
// LoadToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.LoadToolStripMenuItem.Name = "LoadToolStripMenuItem";
|
this.LoadToolStripMenuItem.Name = "LoadToolStripMenuItem";
|
||||||
this.LoadToolStripMenuItem.Size = new System.Drawing.Size(224, 26);
|
this.LoadToolStripMenuItem.Size = new System.Drawing.Size(166, 26);
|
||||||
this.LoadToolStripMenuItem.Text = "Загрузить";
|
this.LoadToolStripMenuItem.Text = "Загрузить";
|
||||||
this.LoadToolStripMenuItem.Click += new System.EventHandler(this.LoadToolStripMenuItem_Click);
|
this.LoadToolStripMenuItem.Click += new System.EventHandler(this.LoadToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
|
// ButtonSortByColor
|
||||||
|
//
|
||||||
|
this.ButtonSortByColor.Location = new System.Drawing.Point(22, 322);
|
||||||
|
this.ButtonSortByColor.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.ButtonSortByColor.Name = "ButtonSortByColor";
|
||||||
|
this.ButtonSortByColor.Size = new System.Drawing.Size(221, 53);
|
||||||
|
this.ButtonSortByColor.TabIndex = 9;
|
||||||
|
this.ButtonSortByColor.Text = "Сортировка по цвету";
|
||||||
|
this.ButtonSortByColor.UseVisualStyleBackColor = true;
|
||||||
|
this.ButtonSortByColor.Click += new System.EventHandler(this.ButtonSortByColor_Click);
|
||||||
|
//
|
||||||
|
// ButtonSortByType
|
||||||
|
//
|
||||||
|
this.ButtonSortByType.Location = new System.Drawing.Point(22, 383);
|
||||||
|
this.ButtonSortByType.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.ButtonSortByType.Name = "ButtonSortByType";
|
||||||
|
this.ButtonSortByType.Size = new System.Drawing.Size(221, 53);
|
||||||
|
this.ButtonSortByType.TabIndex = 10;
|
||||||
|
this.ButtonSortByType.Text = "Сортировка по типу";
|
||||||
|
this.ButtonSortByType.UseVisualStyleBackColor = true;
|
||||||
|
this.ButtonSortByType.Click += new System.EventHandler(this.ButtonSortByType_Click);
|
||||||
|
//
|
||||||
// FormBulldozerCollection
|
// FormBulldozerCollection
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||||
@ -255,5 +281,7 @@
|
|||||||
private ToolStripMenuItem toolStripMenuItem;
|
private ToolStripMenuItem toolStripMenuItem;
|
||||||
private ToolStripMenuItem SaveToolStripMenuItem;
|
private ToolStripMenuItem SaveToolStripMenuItem;
|
||||||
private ToolStripMenuItem LoadToolStripMenuItem;
|
private ToolStripMenuItem LoadToolStripMenuItem;
|
||||||
|
private Button ButtonSortByType;
|
||||||
|
private Button ButtonSortByColor;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -243,5 +243,38 @@ namespace Bulldozer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Сортировка по типу
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void ButtonSortByType_Click(object sender, EventArgs e) => CompareBulldozers(new BulldozerCompareByType());
|
||||||
|
/// <summary>
|
||||||
|
/// Сортировка по цвету
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void ButtonSortByColor_Click(object sender, EventArgs e) => CompareBulldozers(new BulldozerCompareByColor());
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Сортировка по сравнителю
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="comparer"></param>
|
||||||
|
|
||||||
|
private void CompareBulldozers(IComparer<DrawingBulldozer?> comparer)
|
||||||
|
{
|
||||||
|
if (listBoxBulldozerStorages.SelectedIndex == -1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var obj = _storage[listBoxBulldozerStorages.SelectedItem.ToString() ?? string.Empty];
|
||||||
|
if (obj == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
obj.Sort(comparer);
|
||||||
|
pictureBoxCollection.Image = obj.ShowBulldozers();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
73
Bulldozer/Bulldozer/Generics/BulldozerCompareByColor.cs
Normal file
73
Bulldozer/Bulldozer/Generics/BulldozerCompareByColor.cs
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
using Bulldozer.DrawingObjects;
|
||||||
|
using Bulldozer.Entities;
|
||||||
|
using Bulldozer.MovementStrategy;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Bulldozer.Generics
|
||||||
|
{
|
||||||
|
internal class BulldozerCompareByColor : IComparer<DrawingBulldozer?>
|
||||||
|
{
|
||||||
|
public int Compare(DrawingBulldozer? x, DrawingBulldozer? y)
|
||||||
|
|||||||
|
{
|
||||||
|
if (x == null && y == null)
|
||||||
|
{
|
||||||
|
// Оба объекта равны
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (x == null && y != null)
|
||||||
|
{
|
||||||
|
// Объект x меньше
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (x != null && y == null)
|
||||||
|
{
|
||||||
|
// Объект x больше
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
var xBulldozer = x as DrawingBulldozer;
|
||||||
eegov
commented
Зачем, они и так нужного типа Зачем, они и так нужного типа
|
|||||||
|
var yBulldozer = y as DrawingBulldozer;
|
||||||
|
|
||||||
|
if (xBulldozer == null && yBulldozer == null)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (xBulldozer == null && yBulldozer != null)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (xBulldozer != null && yBulldozer == null)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (xBulldozer.EntityBulldozer.BodyColor == yBulldozer.EntityBulldozer.BodyColor)
|
||||||
|
{
|
||||||
|
// Объекты равны по цвету
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (xBulldozer.EntityBulldozer.BodyColor.R.CompareTo(yBulldozer.EntityBulldozer.BodyColor.R) == 0)
|
||||||
|
{
|
||||||
|
if (xBulldozer.EntityBulldozer.BodyColor.G.CompareTo(yBulldozer.EntityBulldozer.BodyColor.G) == 0)
|
||||||
|
{
|
||||||
|
// Сравнение по компоненте B, если R и G совпадают
|
||||||
|
return xBulldozer.EntityBulldozer.BodyColor.B.CompareTo(yBulldozer.EntityBulldozer.BodyColor.B);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Сравнение по компоненте G, если R совпадает, но G не совпадает
|
||||||
|
return xBulldozer.EntityBulldozer.BodyColor.G.CompareTo(yBulldozer.EntityBulldozer.BodyColor.G);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Сравнение по компоненте R, если R не совпадает
|
||||||
|
return xBulldozer.EntityBulldozer.BodyColor.R.CompareTo(yBulldozer.EntityBulldozer.BodyColor.R);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
32
Bulldozer/Bulldozer/Generics/BulldozerCompareByType.cs
Normal file
32
Bulldozer/Bulldozer/Generics/BulldozerCompareByType.cs
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
using Bulldozer.DrawingObjects;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Bulldozer.Generics
|
||||||
|
{
|
||||||
|
internal class BulldozerCompareByType : IComparer<DrawingBulldozer?>
|
||||||
|
{
|
||||||
|
public int Compare(DrawingBulldozer? x, DrawingBulldozer? y)
|
||||||
|
{
|
||||||
|
if (x == null || x.EntityBulldozer == null)
|
||||||
|
throw new ArgumentNullException(nameof(x));
|
||||||
|
|
||||||
|
if (y == null || y.EntityBulldozer == null)
|
||||||
|
throw new ArgumentNullException(nameof(y));
|
||||||
|
|
||||||
|
if (x.GetType().Name != y.GetType().Name)
|
||||||
|
{
|
||||||
|
return x.GetType().Name.CompareTo(y.GetType().Name);
|
||||||
|
}
|
||||||
|
var speedCompare = x.EntityBulldozer.Speed.CompareTo(y.EntityBulldozer.Speed);
|
||||||
|
|
||||||
|
if (speedCompare != 0)
|
||||||
|
return speedCompare;
|
||||||
|
|
||||||
|
return x.EntityBulldozer.Weight.CompareTo(y.EntityBulldozer.Weight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -7,6 +7,12 @@ namespace Bulldozer.Generics
|
|||||||
where T : DrawingBulldozer
|
where T : DrawingBulldozer
|
||||||
where U : IMoveableObject
|
where U : IMoveableObject
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Сортировка
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="comparer"></param>
|
||||||
|
public void Sort(IComparer<T?> comparer) => _collection.SortSet(comparer);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Получение объектов коллекции
|
/// Получение объектов коллекции
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
59
Bulldozer/Bulldozer/Generics/DrawingBulldozerEqutables.cs
Normal file
59
Bulldozer/Bulldozer/Generics/DrawingBulldozerEqutables.cs
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
using Bulldozer.DrawingObjects;
|
||||||
|
using Bulldozer.Entities;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Bulldozer.Generics
|
||||||
|
{
|
||||||
|
internal class DrawingBulldozerEqutables : IEqualityComparer<DrawingBulldozer?>
|
||||||
|
{
|
||||||
|
public bool Equals(DrawingBulldozer? x, DrawingBulldozer? y)
|
||||||
|
{
|
||||||
|
if (x == null || x.EntityBulldozer == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(x));
|
||||||
|
}
|
||||||
|
if (y == null || y.EntityBulldozer == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(y));
|
||||||
|
}
|
||||||
|
if (x.GetType().Name != y.GetType().Name)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (x.EntityBulldozer.Speed != y.EntityBulldozer.Speed)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (x.EntityBulldozer.Weight != y.EntityBulldozer.Weight)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (x.EntityBulldozer.BodyColor != y.EntityBulldozer.BodyColor)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (x is DrawingBulldozerUpgraded && y is DrawingBulldozerUpgraded)
|
||||||
|
{
|
||||||
|
EntityBulldozerUpgraded EntityX = (EntityBulldozerUpgraded)x.EntityBulldozer;
|
||||||
|
EntityBulldozerUpgraded EntityY = (EntityBulldozerUpgraded)y.EntityBulldozer;
|
||||||
|
if (EntityX.Blade != EntityY.Blade)
|
||||||
|
return false;
|
||||||
|
if (EntityX.Ripper != EntityY.Ripper)
|
||||||
|
return false;
|
||||||
|
if (EntityX.DopColor != EntityY.DopColor)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int GetHashCode([DisallowNull] DrawingBulldozer obj)
|
||||||
|
{
|
||||||
|
return obj.GetHashCode();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -23,7 +23,11 @@ namespace Bulldozer.Generics
|
|||||||
/// Максимальное количество объектов в списке
|
/// Максимальное количество объектов в списке
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly int _maxCount;
|
private readonly int _maxCount;
|
||||||
|
/// <summary>
|
||||||
|
/// Сортировка набора объектов
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="comparer"></param>
|
||||||
|
public void SortSet(IComparer<T?> comparer) => _places.Sort(comparer);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Конструктор
|
/// Конструктор
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -39,9 +43,9 @@ namespace Bulldozer.Generics
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="bulldozer">Добавляемый бульдозер</param>
|
/// <param name="bulldozer">Добавляемый бульдозер</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool Insert(T bulldozer)
|
public bool Insert(T bulldozer, IEqualityComparer<T?>? equal = null)
|
||||||
{
|
{
|
||||||
return Insert(bulldozer, 0);
|
return Insert(bulldozer, 0, equal);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -49,12 +53,17 @@ namespace Bulldozer.Generics
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="bulldozer">Добавляемый бульдозер</param>
|
/// <param name="bulldozer">Добавляемый бульдозер</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool Insert(T bulldozer , int position)
|
public bool Insert(T bulldozer , int position, IEqualityComparer<T?>? equal = null)
|
||||||
{
|
{
|
||||||
if (position < 0 || position >= _maxCount) {
|
if (position < 0 || position >= _maxCount) {
|
||||||
throw new StorageOverflowException("Вставка невозможна.");
|
throw new StorageOverflowException("Вставка невозможна.");
|
||||||
}
|
}
|
||||||
if (Count >= _maxCount) throw new StorageOverflowException(_maxCount);
|
if (Count >= _maxCount) throw new StorageOverflowException(_maxCount);
|
||||||
|
if (equal != null)
|
||||||
|
{
|
||||||
|
if (_places.Contains(bulldozer, equal))
|
||||||
|
throw new ArgumentException(nameof(bulldozer));
|
||||||
|
}
|
||||||
_places.Insert(position, bulldozer);
|
_places.Insert(position, bulldozer);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user
Требовалось сортировать по критериям: цвет, скорость, вес