From d9c71375fa7b05c64a55bb3eb272ef7942672462 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=BE=D0=BB=D0=BE=D0=B4=D1=8F?= Date: Mon, 10 Oct 2022 09:24:07 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=B2=D0=BE=D0=B7=D0=B2=D1=80=D0=B0=D1=89=D0=B0?= =?UTF-8?q?=D0=B5=D0=BC=D0=BE=D0=B3=D0=BE=20=D0=B7=D0=BD=D0=B0=D1=87=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=20=D0=B4=D0=BB=D1=8F=20Insert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AirPlaneWithRadar/MapWithSetPlainGeneric.cs | 6 +++--- .../AirPlaneWithRadar/SetPlaneGeneric.cs | 13 +++++++------ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/AirPlaneWithRadar/AirPlaneWithRadar/MapWithSetPlainGeneric.cs b/AirPlaneWithRadar/AirPlaneWithRadar/MapWithSetPlainGeneric.cs index d636c51..0c116dc 100644 --- a/AirPlaneWithRadar/AirPlaneWithRadar/MapWithSetPlainGeneric.cs +++ b/AirPlaneWithRadar/AirPlaneWithRadar/MapWithSetPlainGeneric.cs @@ -119,7 +119,7 @@ namespace AirPlaneWithRadar int CountWidth = _pictureWidth / _placeSizeWidth; int x = _pictureWidth - _placeSizeWidth - _placeSizeWidth/2 - _placeSizeWidth / 4; - int y = (_pictureHeight - _placeSizeHeight)- _placeSizeHeight/2; + int y = _placeSizeHeight/4; for (int k = 0; k < _setPlains.Count; k++) { @@ -137,7 +137,7 @@ namespace AirPlaneWithRadar _setPlains.Get(k)?.SetObject(x, y, _pictureWidth, _pictureHeight); _setPlains.Get(k)?.DrawningObject(g); x = _pictureWidth - _placeSizeWidth - _placeSizeWidth / 2 - _placeSizeWidth / 4; - y -= _placeSizeHeight ; + y += _placeSizeHeight ; } } @@ -148,7 +148,7 @@ namespace AirPlaneWithRadar else { x = _pictureWidth - _placeSizeWidth - _placeSizeWidth / 2 - _placeSizeWidth / 4; - y -= _placeSizeHeight; + y += _placeSizeHeight; } } } diff --git a/AirPlaneWithRadar/AirPlaneWithRadar/SetPlaneGeneric.cs b/AirPlaneWithRadar/AirPlaneWithRadar/SetPlaneGeneric.cs index 03b74b3..15fd5a5 100644 --- a/AirPlaneWithRadar/AirPlaneWithRadar/SetPlaneGeneric.cs +++ b/AirPlaneWithRadar/AirPlaneWithRadar/SetPlaneGeneric.cs @@ -6,8 +6,9 @@ using System.Threading.Tasks; namespace AirPlaneWithRadar { - internal class SetPlaneGeneric + internal class SetPlaneGeneric where T : class + { private readonly T[] _places; public int Count => _places.Length; @@ -33,14 +34,14 @@ namespace AirPlaneWithRadar return -1; } - public bool Insert(T plain, int position) + public int Insert(T plain, int position) { if (position > Count || position < 0) - return false; + return -1; if (_places[position] == null) { _places[position] = plain; - return true; + return position; } else { @@ -53,11 +54,11 @@ namespace AirPlaneWithRadar _places[j] = _places[j - 1]; } _places[position] = plain; - return true; + return position; } } } - return false; + return -1; } public T Remove(int position)