Mochalov D.V. Hard LabWork06 #6

Closed
b0n3l3sS wants to merge 8 commits from LabWork06 into LabWork05
2 changed files with 25 additions and 0 deletions
Showing only changes of commit a9f39a20a9 - Show all commits

View File

@ -44,4 +44,8 @@ public class DrawningObjectLocomotive implements IDrawningObject {
if (_locomotive == null) return null;
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));
}
}
}