Esempio n. 1
0
	private void createRuleElements(Game game) {
		for(CustomRule cr : game.getCustomRules()) {
			Element el = doc.createElement("rule");
			el.setAttribute("name", cr.name());
			root.appendChild(el);
		}
	}
Esempio n. 2
0
	public Set<CustomRule> getCustomRules() {
		Set<CustomRule> result = Sets.newHashSet();
		NodeList nl = root.getElementsByTagName("rule");
		for(int i = 0; i < nl.getLength(); i++) {
			Element el = (Element) nl.item(i);
			CustomRule rule = CustomRule.valueOf(el.getAttribute("name"));
			result.add(rule);
		}
		return result;
	}