X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.logic.ui.am2900%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fui%2Fmodel%2Fcomponents%2Fmi%2Fnandbased%2FGUI_rsLatch.java;h=1ee2a1effe7e657b1a47f9859c2a5b5f2130a78e;hb=574918bb58faa3c617911ed4f629f90066668364;hp=a7f80256f653dd2cac520e34e6ae8f6ca40c9843;hpb=c2ba1e811b4ebd9e14377e25fadaf5774a28830e;p=Mograsim.git diff --git a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUI_rsLatch.java b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUI_rsLatch.java index a7f80256..1ee2a1ef 100644 --- a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUI_rsLatch.java +++ b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUI_rsLatch.java @@ -50,10 +50,12 @@ public class GUI_rsLatch extends SimpleRectangularSubmodelComponent new GUIWire(submodelModifiable, cp2, nand1.getPin("B"), new Point(65, 42.5), new Point(5, 42.5), new Point(5, 22.5)); 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]); + + addAtomicHighLevelStateID("q"); } @Override - public void setHighLevelState(String stateID, Object newState) + public void setAtomicHighLevelState(String stateID, Object newState) { switch (stateID) { @@ -74,22 +76,23 @@ public class GUI_rsLatch extends SimpleRectangularSubmodelComponent } break; default: - super.setHighLevelState(stateID, newState); - break; + // should not happen because we tell SubmodelComponent to only allow these state IDs. + throw new IllegalStateException("Illegal atomic state ID: " + stateID); } } @Override - public Object getHighLevelState(String stateID) + public Object getAtomicHighLevelState(String stateID) { switch (stateID) { case "q": if (wireQ.hasLogicModelBinding()) - return wireQ.getWireValues().getBit(0).join(wire_Q.getWireValues().getBit(0).not()); + return wireQ.getWireValues().getBit(0); return null; default: - return super.getHighLevelState(stateID); + // should not happen because we tell SubmodelComponent to only allow these state IDs. + throw new IllegalStateException("Illegal atomic state ID: " + stateID); } } } \ No newline at end of file