This commit is contained in:
Alenka 2023-12-23 15:46:22 +04:00
parent 0f3e9f9a46
commit 72dcd86427
6 changed files with 5 additions and 9 deletions

View File

@ -21,4 +21,4 @@ namespace Cruiser
return this.Name.GetHashCode();
}
}
}
}

View File

@ -26,7 +26,6 @@ namespace Cruiser.Generics
var speedCompare = x.EntityCruiser.Speed.CompareTo(y.EntityCruiser.Speed);
if (speedCompare != 0)
return speedCompare;
return x.EntityCruiser.Weight.CompareTo(y.EntityCruiser.Weight);
}
}

View File

@ -22,7 +22,6 @@ namespace Cruiser.Generics
var speedCompare = x.EntityCruiser.Speed.CompareTo(y.EntityCruiser.Speed);
if (speedCompare != 0)
return speedCompare;
return x.EntityCruiser.Weight.CompareTo(y.EntityCruiser.Weight);
}
}

View File

@ -50,7 +50,6 @@ namespace Cruiser
}
return true;
}
public int GetHashCode([DisallowNull] DrawningCruiser? obj)
{
return obj.GetHashCode();

View File

@ -203,11 +203,11 @@ namespace Cruiser
}
}
}
private void ButtonSortByType_Click(object sender, EventArgs e) => ComparePlanes(new CruiserCompareByType());
private void ButtonSortByType_Click(object sender, EventArgs e) => CompareCruiser(new CruiserCompareByType());
private void ButtonSortByColor_Click(object sender, EventArgs e) => ComparePlanes(new CruiserCompareByColor());
private void ButtonSortByColor_Click(object sender, EventArgs e) => CompareCruiser(new CruiserCompareByColor());
private void ComparePlanes(IComparer<DrawningCruiser?> comparer)
private void CompareCruiser(IComparer<DrawningCruiser?> comparer)
{
if (listBoxStorages.SelectedIndex == -1)
{
@ -223,4 +223,4 @@ namespace Cruiser
pictureBoxCruiser.Image = obj.ShowCruisers();
}
}
}
}

View File

@ -29,7 +29,6 @@ namespace Cruiser.Generics
throw new StorageOverflowException(_maxCount);
Insert(cruiser, 0, equal);
}
public void Insert(T cruiser, int position, IEqualityComparer<T>? equal = null)
{
if (_places.Count == _maxCount)