MCPcopy Create free account
hub / github.com/badvision/jace / buildStateMap

Method buildStateMap

src/main/java/jace/state/StateManager.java:74–111  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

72 }
73
74 private void buildStateMap() {
75 allStateVariables = new LinkedHashSet<>();
76 objectLookup = new WeakHashMap<>();
77 ObjectGraphNode emulator = new ObjectGraphNode(Emulator.instance);
78 emulator.name = "Emulator";
79 Set visited = new HashSet();
80 buildStateMap(emulator, visited);
81
82 // Also track all softswitches
83 for (SoftSwitches s : SoftSwitches.values()) {
84 final SoftSwitches ss = s;
85 ObjectGraphNode switchNode = new ObjectGraphNode(s);
86 switchNode.name = s.toString();
87 ObjectGraphNode switchVar = new ObjectGraphNode(s.getSwitch()) {
88 @Override
89 /**
90 * This is a more efficient way of updating the softswitch
91 * states And really in a way this works out much better to
92 * ensure that memory and graphics pages are set up correctly
93 * when resuming states.
94 */
95 public void setCurrentValue(Object value) {
96 Boolean b = (Boolean) value;
97 ss.getSwitch().setState(b);
98 }
99
100 @Override
101 public Object getCurrentValue() {
102 return ss.getSwitch().getState();
103 }
104 };
105 switchVar.name = "switch";
106 switchVar.parent = switchNode;
107 allStateVariables.add(switchVar);
108 objectLookup.put(s, switchNode);
109 objectLookup.put(s.getSwitch(), switchVar);
110 }
111 }
112
113 private void buildStateMap(ObjectGraphNode node, Set visited) {
114 if (visited.contains(node)) {

Callers 1

captureStateMethod · 0.95

Calls 9

addStateVariableMethod · 0.95
getSwitchMethod · 0.80
addMethod · 0.80
getNameMethod · 0.65
toStringMethod · 0.45
getCurrentValueMethod · 0.45
getMethod · 0.45
getTypeMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected