- new GUIWire(submodelModifiable, cp1, Q, new Point(35, 17.5), new Point(35, 7.5), new Point(65, 7.5), new Point(65, 12.5));
- new GUIWire(submodelModifiable, cp2, _Q, new Point[0]);
+ wireQ = new GUIWire(submodelModifiable, cp1, Q, new Point(35, 17.5), new Point(35, 7.5), new Point(65, 7.5), new Point(65, 12.5));
+ wire_Q = new GUIWire(submodelModifiable, cp2, _Q, new Point[0]);
+ }
+
+ @Override
+ public void setHighLevelState(String stateID, Object newState)
+ {
+ if ("q".equals(stateID))
+ {
+ // TODO force this to happen without any Timeline updates in the meantime.
+ // Maybe make it a requirement of setHighLevelState that the Timeline is "halted" during a call?
+ BitVector newStateCasted = (BitVector) newState;
+ if (wireQ.hasLogicModelBinding())
+ wireQ.forceWireValues(newStateCasted);
+ // We set both wires because then both outputs go to their correct state at the same time, and to avoid problems when not both
+ // inputs are 1
+ if (wire_Q.hasLogicModelBinding())
+ wire_Q.forceWireValues(newStateCasted.not());
+ } else
+ super.setHighLevelState(stateID, newState);