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

Class Rule

code/src/java/pcgen/core/doomsdaybook/Rule.java:25–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23import pcgen.util.Logging;
24
25public class Rule extends ArrayList<String> implements DataElement
26{
27 private final List<DataValue> retList = new ArrayList<>();
28 private String id;
29 private String title;
30 private final VariableHashMap allVars;
31 private int weight;
32
33 public Rule(VariableHashMap allVars, String title, String id, int weight)
34 {
35 this.allVars = allVars;
36 this.title = title;
37 this.id = id;
38 this.weight = weight;
39 }
40
41 @Override
42 public List<DataValue> getData() throws Exception
43 {
44 retList.clear();
45
46 for (String key : this)
47 {
48 DataElement ele = allVars.getDataElement(key);
49 retList.addAll(ele.getData());
50 }
51
52 return retList;
53 }
54
55 public void setId(String id)
56 {
57 this.id = id;
58 }
59
60 @Override
61 public String getId()
62 {
63 return id;
64 }
65
66 @Override
67 public List<DataValue> getLastData() throws Exception
68 {
69 retList.clear();
70
71 for (String key : this)
72 {
73 DataElement ele = allVars.getDataElement(key);
74 retList.addAll(ele.getLastData());
75 }
76
77 return retList;
78 }
79
80 public void setTitle(String title)
81 {
82 this.title = title;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected