xml.append("</playerTurnHistory>\n");
return xml.toString();
}
public PlayerTurnHistory initializeFromNode(Realm realm, Node node) {
PlayerTurnHistory playerTurnHistory = new FreeRealmPlayerTurnHistory();
Node turnNode = XMLConverterUtility.findNode(node, "turn");
int turn = Integer.parseInt(turnNode.getFirstChild().getNodeValue());
playerTurnHistory.setTurn(turn);
Node populationNode = XMLConverterUtility.findNode(node, "population");
int population = Integer.parseInt(populationNode.getFirstChild().getNodeValue());
playerTurnHistory.setPopulation(population);
Node wealthNode = XMLConverterUtility.findNode(node, "wealth");
int wealth = Integer.parseInt(wealthNode.getFirstChild().getNodeValue());
playerTurnHistory.setWealth(wealth);
Node settlementCountNode = XMLConverterUtility.findNode(node, "settlementCount");
int settlementCount = Integer.parseInt(settlementCountNode.getFirstChild().getNodeValue());
playerTurnHistory.setSettlementCount(settlementCount);
Node unitCountNode = XMLConverterUtility.findNode(node, "unitCount");
int unitCount = Integer.parseInt(unitCountNode.getFirstChild().getNodeValue());
playerTurnHistory.setUnitCount(unitCount);
Node mapExplorationPercentNode = XMLConverterUtility.findNode(node, "mapExplorationPercent");
int mapExplorationPercent = Integer.parseInt(mapExplorationPercentNode.getFirstChild().getNodeValue());
playerTurnHistory.setMapExplorationPercent(mapExplorationPercent);
return playerTurnHistory;
}