fix
This commit is contained in:
parent
75cbdc8176
commit
e8a4f802de
@ -19,15 +19,7 @@ namespace GasolineTanker
|
||||
}
|
||||
public int Insert(T gasolineTanker)
|
||||
{
|
||||
if (_places.Count < _maxCount)
|
||||
{
|
||||
_places.Add(gasolineTanker);
|
||||
for (int i = 0; i < _places.Count; i++)
|
||||
{
|
||||
if (_places[i] == gasolineTanker) return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
return Insert(gasolineTanker, 0);
|
||||
}
|
||||
private bool isCorrectPosition(int position)
|
||||
{
|
||||
@ -36,7 +28,7 @@ namespace GasolineTanker
|
||||
public int Insert(T gasolineTanker, int position)
|
||||
{
|
||||
if (_places.Contains(gasolineTanker))
|
||||
throw new ArgumentException($"Объект {gasolineTanker} уже есть в наборе");
|
||||
throw new ArgumentException($"The {gasolineTanker} object is already in the set");
|
||||
if (Count == _maxCount)
|
||||
throw new StorageOverflowException(_maxCount);
|
||||
if (!isCorrectPosition(position))
|
||||
|
Loading…
Reference in New Issue
Block a user