From 76bed1f328101c377b074088bbd3608e7cc10200 Mon Sep 17 00:00:00 2001 From: Alenka Date: Fri, 22 Dec 2023 20:10:32 +0400 Subject: [PATCH] Done --- Cruiser/Cruiser/CruiserGenericCollection.cs | 10 +++++----- Cruiser/Cruiser/CruiserGenericStorage.cs | 8 ++++---- Cruiser/Cruiser/SetGeneric.cs | 12 ++++++------ 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Cruiser/Cruiser/CruiserGenericCollection.cs b/Cruiser/Cruiser/CruiserGenericCollection.cs index 76e15d9..f139c07 100644 --- a/Cruiser/Cruiser/CruiserGenericCollection.cs +++ b/Cruiser/Cruiser/CruiserGenericCollection.cs @@ -119,17 +119,17 @@ namespace Cruiser.Generics private void DrawObjects(Graphics g) { int i = 0; - foreach (var bus in _collection.GetBuses()) + foreach (var cruiser in _collection.GetCruiser()) { - if (bus != null) + if (cruiser != null) { int inRow = _pictureWidth / _placeSizeWidth; - bus.SetPosition(_placeSizeWidth * (inRow - 1) - (i % inRow * _placeSizeWidth), i / inRow * _placeSizeHeight); - bus.DrawTransport(g); + cruiser.SetPosition(_placeSizeWidth * (inRow - 1) - (i % inRow * _placeSizeWidth), i / inRow * _placeSizeHeight); + cruiser.DrawTransport(g); } i++; } } - public IEnumerable GetCruisers => _collection.GetBuses(); + public IEnumerable GetCruisers => _collection.GetCruiser(); } } \ No newline at end of file diff --git a/Cruiser/Cruiser/CruiserGenericStorage.cs b/Cruiser/Cruiser/CruiserGenericStorage.cs index 13c8d14..decb5f6 100644 --- a/Cruiser/Cruiser/CruiserGenericStorage.cs +++ b/Cruiser/Cruiser/CruiserGenericStorage.cs @@ -70,7 +70,7 @@ namespace Cruiser.Generics } using (StreamWriter sw = new(filename)) { - sw.WriteLine($"PlaneStorage{Environment.NewLine}{data}"); + sw.WriteLine($"CruiserStorage{Environment.NewLine}{data}"); } return; } @@ -106,10 +106,10 @@ namespace Cruiser.Generics StringSplitOptions.RemoveEmptyEntries); foreach (string elem in set) { - DrawningCruiser? plane = elem?.CreateDrawningCruiser(_separatorForObject, _pictureWidth, _pictureHeight); - if (plane != null) + DrawningCruiser? cruiser = elem?.CreateDrawningCruiser(_separatorForObject, _pictureWidth, _pictureHeight); + if (cruiser != null) { - if (!(collection + plane)) + if (!(collection + cruiser)) { throw new ArgumentNullException("Ошибка добавления в коллекцию"); } diff --git a/Cruiser/Cruiser/SetGeneric.cs b/Cruiser/Cruiser/SetGeneric.cs index 8755409..084d4ba 100644 --- a/Cruiser/Cruiser/SetGeneric.cs +++ b/Cruiser/Cruiser/SetGeneric.cs @@ -24,20 +24,20 @@ namespace Cruiser.Generics _places = new List(count); } - public void Insert(T trolleybus) + public void Insert(T cruiser) { if (_places.Count == _maxCount) throw new StorageOverflowException(_maxCount); - Insert(trolleybus, 0); + Insert(cruiser, 0); } - public void Insert(T trolleybus, int position) + public void Insert(T cruiser, int position) { if (_places.Count == _maxCount) throw new StorageOverflowException(_maxCount); if (!(position >= 0 && position <= Count)) throw new Exception("Неверная позиция для вставки"); - _places.Insert(position, trolleybus); + _places.Insert(position, cruiser); } public void Remove(int position) @@ -62,12 +62,12 @@ namespace Cruiser.Generics _places.Insert(position, value); } } - public IEnumerable GetBuses(int? maxBuses = null) + public IEnumerable GetCruiser(int? maxCruisers = null) { for (int i = 0; i < _places.Count; ++i) { yield return _places[i]; - if (maxBuses.HasValue && i == maxBuses.Value) + if (maxCruisers.HasValue && i == maxCruisers.Value) { yield break; }