Implemented things needed for setHighLevelState
[Mograsim.git] / net.mograsim.logic.ui / src / net / mograsim / logic / ui / model / wires / GUIWire.java
index e920444..db6d440 100644 (file)
@@ -10,19 +10,19 @@ import net.haspamelodica.swt.helper.gcs.GeneralGC;
 import net.haspamelodica.swt.helper.swtobjectwrappers.Point;
 import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle;
 import net.mograsim.logic.core.LogicObserver;
+import net.mograsim.logic.core.types.BitVector;
 import net.mograsim.logic.core.types.BitVectorFormatter;
+import net.mograsim.logic.core.wires.Wire;
 import net.mograsim.logic.core.wires.Wire.ReadEnd;
 import net.mograsim.logic.ui.ColorHelper;
-import net.mograsim.logic.ui.model.ModelVisitor;
 import net.mograsim.logic.ui.model.ViewModelModifiable;
-import net.mograsim.logic.ui.model.Visitable;
 
 /**
  * A wire connecting exactly two {@link Pin}s.
  * 
  * @author Daniel Kirschten
  */
-public class GUIWire implements Visitable
+public class GUIWire
 {
        /**
         * The model this wire is a part of.
@@ -310,6 +310,23 @@ public class GUIWire implements Visitable
                        end.registerObserver(logicObs);
        }
 
+       /**
+        * Returns whether this {@link GUIWire} has a logic model binding or not.
+        */
+       public boolean hasLogicModelBinding()
+       {
+               return end != null;
+       }
+
+       /**
+        * If this {@link GUIWire} has a logic model binding, delegates to {@link Wire#forceValues(BitVector)} for the {@link Wire}
+        * corresponding to this {@link GUIWire}.
+        */
+       public void forceWireValues(BitVector values)
+       {
+               end.getWire().forceValues(values);
+       }
+
        // listeners
 
        // @formatter:off
@@ -325,10 +342,4 @@ public class GUIWire implements Visitable
        {
                return "GUIWire [" + pin1 + "---" + pin2 + ", value=" + (end == null ? "null" : end.getValues()) + "]";
        }
-
-       @Override
-       public void accept(ModelVisitor mv)
-       {
-               mv.visit(this);
-       }
 }
\ No newline at end of file