X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.logic.core%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fcore%2Fcomponents%2FManualSwitch.java;h=626804f0b17dc0cd081d05242484cc5fcbb3711d;hb=d2ae4f1db269806849d4bb415f1e17e206e2a5bc;hp=b5b230ad831f8de5e94326e49aeb8a6621961076;hpb=da27eee93b1893199dde2b0935cafdb1c6301279;p=Mograsim.git diff --git a/net.mograsim.logic.core/src/net/mograsim/logic/core/components/ManualSwitch.java b/net.mograsim.logic.core/src/net/mograsim/logic/core/components/ManualSwitch.java index b5b230ad..626804f0 100644 --- a/net.mograsim.logic.core/src/net/mograsim/logic/core/components/ManualSwitch.java +++ b/net.mograsim.logic.core/src/net/mograsim/logic/core/components/ManualSwitch.java @@ -56,6 +56,16 @@ public class ManualSwitch extends Component implements LogicObservable notifyObservers(); } + public void setToValueOf(Bit bit) + { + if (bit == Bit.ONE) + switchOn(); + else if (bit == Bit.ZERO) + switchOff(); + else + throw new IllegalArgumentException("Cannot set ManualSwitch to the value of Bit " + bit); + } + public boolean isOn() { return isOn;