Добавлены методы в MapWithSetLocomotivesGeneric

This commit is contained in:
Данила Мочалов 2022-11-19 14:06:39 +04:00
parent 0ca1f9efcb
commit a9f39a20a9
2 changed files with 25 additions and 0 deletions

View File

@ -44,4 +44,8 @@ public class DrawningObjectLocomotive implements IDrawningObject {
if (_locomotive == null) return null; if (_locomotive == null) return null;
return _locomotive.getDataForSave(); return _locomotive.getDataForSave();
} }
public static IDrawningObject Create(String data) {
return new DrawningObjectLocomotive(DrawningLocomotive.createDrawningLocomotive(data));
}
} }

View File

@ -174,4 +174,25 @@ public class MapWithSetLocomotivesGeneric
} }
} }
/// Получение данных в виде строки
public String GetData(char separatorType, char separatorData)
{
//string data = $"{_map.GetType().Name}{separatorType}";
String data = ""+ _map.getClass() + separatorType;
for (var locomotive : _setLocomotives.GetLocomotives())
{
data += "" + locomotive.getInfo() + separatorData;
}
return data;
}
/// Загрузка списка из массива строк
public void LoadData(String[] records)
{
for (var rec : records)
{
_setLocomotives.Insert((T)DrawningObjectLocomotive.Create(rec));
}
}
} }