import org.eclipse.swt.graphics.Color;\r
\r
import era.mi.gui.components.BasicGUIComponent;\r
-import era.mi.logic.Bit;\r
-import era.mi.logic.wires.WireArray;\r
+import era.mi.logic.types.Bit;\r
+import era.mi.logic.wires.Wire;\r
import net.haspamelodica.swt.helper.gcs.GeneralGC;\r
import net.haspamelodica.swt.helper.swtobjectwrappers.Point;\r
\r
public class GUIWire\r
{\r
- private final WireArray wa;\r
+ private final Wire wire;\r
private final double[] path;\r
\r
public GUIWire(Runnable redraw, BasicGUIComponent component1, int component1ConnectionIndex, Point component1Pos,\r
BasicGUIComponent component2, int component2ConnectionIndex, Point component2Pos, Point... path)\r
{\r
- this.wa = component1.getConnectedWireArray(component1ConnectionIndex);\r
- if (!Objects.equals(wa, component2.getConnectedWireArray(component2ConnectionIndex)))\r
+ this.wire = component1.getConnectedWireEnd(component1ConnectionIndex).getWire();\r
+ if (!Objects.equals(wire, component2.getConnectedWireEnd(component2ConnectionIndex).getWire()))\r
throw new IllegalArgumentException("Given connection points are not connected!");\r
this.path = new double[path.length * 2 + 4];\r
- Point component1ConnectionPoint = component1.getWireArrayConnectionPoint(component1ConnectionIndex);\r
+ Point component1ConnectionPoint = component1.getWireEndConnectionPoint(component1ConnectionIndex);\r
this.path[0] = component1Pos.x + component1ConnectionPoint.x;\r
this.path[1] = component1Pos.y + component1ConnectionPoint.y;\r
for (int srcI = 0, dstI = 2; srcI < path.length; srcI++, dstI += 2)\r
this.path[dstI + 0] = path[srcI].x;\r
this.path[dstI + 1] = path[srcI].y;\r
}\r
- Point component2ConnectionPoint = component2.getWireArrayConnectionPoint(component2ConnectionIndex);\r
+ Point component2ConnectionPoint = component2.getWireEndConnectionPoint(component2ConnectionIndex);\r
this.path[this.path.length - 2] = component2Pos.x + component2ConnectionPoint.x;\r
this.path[this.path.length - 1] = component2Pos.y + component2ConnectionPoint.y;\r
\r
- wa.addObserver((initiator, oldValues) -> redraw.run());\r
+ wire.addObserver((initiator, oldValues) -> redraw.run());\r
}\r
\r
public void render(GeneralGC gc)\r
{\r
Color oldFG = gc.getForeground();\r
- if (wa.length == 1)\r
- gc.setForeground(gc.getDevice().getSystemColor(getSWTColorConstantForBit(wa.getValue())));\r
+ if (wire.length == 1)\r
+ gc.setForeground(gc.getDevice().getSystemColor(getSWTColorConstantForBit(wire.getValue())));\r
gc.drawPolyline(path);\r
gc.setForeground(oldFG);\r
}\r