MCPcopy Create free account
hub / github.com/PCGen/pcgen / loadRule

Method loadRule

code/src/java/pcgen/gui2/doomsdaybook/NameGenPanel.java:831–872  ·  view source on GitHub ↗
(Element rule, String id)

Source from the content-addressed store, hash-verified

829 }
830
831 private String loadRule(Element rule, String id) throws DataConversionException
832 {
833 Rule dataRule = new Rule(allVars, id, id, rule.getAttribute("weight").getIntValue());
834 java.util.List<?> elements = rule.getChildren();
835
836 for (final Object element : elements)
837 {
838 Element child = (Element) element;
839 String elementName = child.getName();
840
841 switch (elementName)
842 {
843 case "GETLIST" -> {
844 String listId = child.getAttributeValue("idref");
845 dataRule.add(listId);
846 }
847 case "SPACE" -> {
848 SpaceRule sp = new SpaceRule();
849 allVars.addDataElement(sp);
850 dataRule.add(sp.getId());
851 }
852 case "HYPHEN" -> {
853 HyphenRule hy = new HyphenRule();
854 allVars.addDataElement(hy);
855 dataRule.add(hy.getId());
856 }
857 case "CR" -> {
858 CRRule cr = new CRRule();
859 allVars.addDataElement(cr);
860 dataRule.add(cr.getId());
861 }
862 case "GETRULE" -> {
863 String ruleId = child.getAttributeValue("idref");
864 dataRule.add(ruleId);
865 }
866 }
867 }
868
869 allVars.addDataElement(dataRule);
870
871 return dataRule.getId();
872 }
873
874 private RuleSet loadRuleSet(Element ruleSet) throws DataConversionException
875 {

Callers 1

loadRuleSetMethod · 0.95

Calls 9

getIdMethod · 0.95
getIdMethod · 0.95
getIdMethod · 0.95
getIdMethod · 0.95
getIntValueMethod · 0.80
addDataElementMethod · 0.80
getChildrenMethod · 0.65
getNameMethod · 0.65
addMethod · 0.65

Tested by

no test coverage detected