use of pcgen.core.doomsdaybook.CRRule in project pcgen by PCGen.
the class NameGenPanel method loadRule.
private String loadRule(Element rule, String id) throws DataConversionException {
Rule dataRule = new Rule(allVars, id, id, rule.getAttribute("weight").getIntValue());
java.util.List<?> elements = rule.getChildren();
for (final Object element : elements) {
Element child = (Element) element;
String elementName = child.getName();
if (elementName.equals("GETLIST")) {
String listId = child.getAttributeValue("idref");
dataRule.add(listId);
} else if (elementName.equals("SPACE")) {
SpaceRule sp = new SpaceRule();
allVars.addDataElement(sp);
dataRule.add(sp.getId());
} else if (elementName.equals("HYPHEN")) {
HyphenRule hy = new HyphenRule();
allVars.addDataElement(hy);
dataRule.add(hy.getId());
} else if (elementName.equals("CR")) {
CRRule cr = new CRRule();
allVars.addDataElement(cr);
dataRule.add(cr.getId());
} else if (elementName.equals("GETRULE")) {
String ruleId = child.getAttributeValue("idref");
dataRule.add(ruleId);
}
}
allVars.addDataElement(dataRule);
return dataRule.getId();
}
Aggregations