Added MapWithSetArtilleriesGeneric serialization and deserialization
This commit is contained in:
parent
8d4407de4c
commit
ebc0f07204
@ -124,4 +124,21 @@ public class MapWithSetArtilleriesGeneric<T extends IDrawingObject, U extends Ab
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
public String getData(char separatorType, char separatorData) {
|
||||
StringBuilder data = new StringBuilder(String.format("%s%c", _map.getClass().getSimpleName(), separatorType));
|
||||
|
||||
for (var artillery : _setArtilleries.getArtilleries()) {
|
||||
data.append(String.format("%s%c", artillery.getInfo(), separatorData));
|
||||
}
|
||||
|
||||
return data.toString();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void loadData(String[] records) {
|
||||
for (int i = records.length - 1; i >= 0; i--) {
|
||||
_setArtilleries.insert((T) DrawingObjectArtillery.create(records[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user