import net.mograsim.logic.ui.SimpleLogicUIStandalone;
import net.mograsim.logic.ui.model.ViewModelModifiable;
+import net.mograsim.logic.ui.model.components.GUIComponent;
import net.mograsim.logic.ui.model.components.atomic.GUIAndGate;
import net.mograsim.logic.ui.model.components.atomic.GUIBitDisplay;
import net.mograsim.logic.ui.model.components.atomic.GUIManualSwitch;
import net.mograsim.logic.ui.model.components.mi.nandbased.GUIdff;
import net.mograsim.logic.ui.model.components.mi.nandbased.am2901.GUIAm2901;
import net.mograsim.logic.ui.model.components.submodels.SimpleRectangularSubmodelComponent;
-import net.mograsim.logic.ui.model.wires.ConnectionPoint;
+import net.mograsim.logic.ui.model.wires.Pin;
import net.mograsim.logic.ui.model.wires.WireCrossPoint;
import net.mograsim.logic.ui.util.ModellingTool;
not2.moveTo(80, -20);
not3.moveTo(110, -20);
and.moveTo(135, -30);
- ConnectionPoint last = and.getPin("Y");
+ Pin last = and.getPin("Y");
for (int i = 0; i < comp.getInputPinNames().size(); i++)
{
double y = 10 * i;
WireCrossPoint wcp = new WireCrossPoint(model, 1);
- GUIdff d_ff = new GUIdff(model);
+ GUIComponent d_ff = new GUIdff(model);
GUIManualSwitch sw = new GUIManualSwitch(model);
tool.connect(last, wcp);
+++ /dev/null
-package net.mograsim.logic.ui.model.wires;
-
-public interface ConnectionPoint
-{
- /**
- * Retrieves the {@link Pin}, that is used by the {@link GUIWire} to connect to.
- *
- * @return the {@link Pin} for the wire to connect to.
- *
- * @author Christian Femers
- */
- Pin getPin();
-}
*
* @author Daniel Kirschten
*/
- public GUIWire(ViewModelModifiable model, ConnectionPoint pin1, ConnectionPoint pin2)
+ public GUIWire(ViewModelModifiable model, WireCrossPoint pin1, WireCrossPoint pin2)
+ {
+ this(model, pin1, pin2, (Point[]) null);
+ }
+
+ /**
+ * Creates a new {@link GUIWire} with automatic interpolation.
+ *
+ * @author Daniel Kirschten
+ */
+ public GUIWire(ViewModelModifiable model, WireCrossPoint pin1, Pin pin2)
+ {
+ this(model, pin1, pin2, (Point[]) null);
+ }
+
+ /**
+ * Creates a new {@link GUIWire} with automatic interpolation.
+ *
+ * @author Daniel Kirschten
+ */
+ public GUIWire(ViewModelModifiable model, Pin pin1, WireCrossPoint pin2)
+ {
+ this(model, pin1, pin2, (Point[]) null);
+ }
+
+ /**
+ * Creates a new {@link GUIWire} with automatic interpolation.
+ *
+ * @author Daniel Kirschten
+ */
+ public GUIWire(ViewModelModifiable model, Pin pin1, Pin pin2)
{
this(model, pin1, pin2, (Point[]) null);
}
*
* @author Daniel Kirschten
*/
- public GUIWire(ViewModelModifiable model, ConnectionPoint pin1, ConnectionPoint pin2, Point... path)
+ public GUIWire(ViewModelModifiable model, WireCrossPoint pin1, WireCrossPoint pin2, Point... path)
{
this(model, pin1.getPin(), pin2.getPin(), path);
}
*
* @author Daniel Kirschten
*/
- GUIWire(ViewModelModifiable model, Pin pin1, Pin pin2, Point... path)
+ public GUIWire(ViewModelModifiable model, WireCrossPoint pin1, Pin pin2, Point... path)
+ {
+ this(model, pin1.getPin(), pin2, path);
+ }
+
+ /**
+ * Creates a new {@link GUIWire} without automatic interpolation.
+ *
+ * @author Daniel Kirschten
+ */
+ public GUIWire(ViewModelModifiable model, Pin pin1, WireCrossPoint pin2, Point... path)
+ {
+ this(model, pin1, pin2.getPin(), path);
+ }
+
+ /**
+ * Creates a new {@link GUIWire} without automatic interpolation.
+ *
+ * @author Daniel Kirschten
+ */
+ public GUIWire(ViewModelModifiable model, Pin pin1, Pin pin2, Point... path)
{
logicObs = (i) -> callRedrawListeners();
this.model = model;
*
* @author Daniel Kirschten
*/
-public class Pin implements ConnectionPoint
+public class Pin
{
/**
* The {@link GUIComponent} this pin belongs to
{
return "Pin [" + name + ", point=" + getPos() + "]";
}
-
- @Override
- public Pin getPin()
- {
- return this;
- }
}
\ No newline at end of file
*
* @author Daniel Kirschten
*/
-public class WireCrossPoint extends GUIComponent implements ConnectionPoint
+public class WireCrossPoint extends GUIComponent
{
private static final int CIRCLE_RADIUS = 1;
private static final int CIRCLE_DIAM = CIRCLE_RADIUS * 2;
// pins
- @Override
public Pin getPin()
{
return pin;
import net.mograsim.logic.ui.model.ViewModelModifiable;
import net.mograsim.logic.ui.model.components.GUIComponent;
-import net.mograsim.logic.ui.model.wires.ConnectionPoint;
import net.mograsim.logic.ui.model.wires.GUIWire;
+import net.mograsim.logic.ui.model.wires.Pin;
+import net.mograsim.logic.ui.model.wires.WireCrossPoint;
public class ModellingTool
{
return connect(a.getPin(pinA), b.getPin(pinB));
}
- public GUIWire connect(ConnectionPoint a, GUIComponent b, String pinB)
+ public GUIWire connect(WireCrossPoint a, GUIComponent b, String pinB)
+ {
+ return connect(a.getPin(), b.getPin(pinB));
+ }
+
+ public GUIWire connect(Pin a, GUIComponent b, String pinB)
{
return connect(a, b.getPin(pinB));
}
- public GUIWire connect(ConnectionPoint a, ConnectionPoint b)
+ public GUIWire connect(GUIComponent a, WireCrossPoint b, String pinA)
+ {
+ return connect(a.getPin(pinA), b.getPin());
+ }
+
+ public GUIWire connect(WireCrossPoint a, WireCrossPoint b)
+ {
+ return connect(a.getPin(), b.getPin());
+ }
+
+ public GUIWire connect(Pin a, WireCrossPoint b)
+ {
+ return connect(a, b.getPin());
+ }
+
+ public GUIWire connect(GUIComponent a, Pin b, String pinA)
+ {
+ return connect(a.getPin(pinA), b);
+ }
+
+ public GUIWire connect(WireCrossPoint a, Pin b)
+ {
+ return connect(a.getPin(), b);
+ }
+
+ public GUIWire connect(Pin a, Pin b)
{
return new GUIWire(model, a, b);
}