\r
public class GUIWire\r
{\r
- private final WireArray wa;\r
- private final double[] path;\r
+ private final WireArray wa;\r
+ private final double[] path;\r
\r
- public GUIWire(Runnable redraw, BasicGUIComponent component1, int component1ConnectionIndex, Point component1Pos, BasicGUIComponent component2, int component2ConnectionIndex, Point component2Pos, Point... path)\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
+ if (!Objects.equals(wa, component2.getConnectedWireArray(component2ConnectionIndex)))\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
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
+ for (int srcI = 0, dstI = 2; srcI < path.length; srcI++, dstI += 2)\r
{\r
this.path[dstI + 0] = path[srcI].x;\r
this.path[dstI + 1] = path[srcI].y;\r
public void render(GeneralGC gc)\r
{\r
Color oldFG = gc.getForeground();\r
- if(wa.length == 1)\r
+ if (wa.length == 1)\r
gc.setForeground(gc.getDevice().getSystemColor(getSWTColorConstantForBit(wa.getValue())));\r
gc.drawPolyline(path);\r
gc.setForeground(oldFG);\r
\r
public static int getSWTColorConstantForBit(Bit bit)\r
{\r
- switch(bit)\r
+ switch (bit)\r
{\r
- case ONE:\r
- return SWT.COLOR_GREEN;\r
- case ZERO:\r
- return SWT.COLOR_BLUE;\r
- case Z:\r
- return SWT.COLOR_BLACK;\r
- case U:\r
- case X:\r
- return SWT.COLOR_RED;\r
- default:\r
- throw new IllegalArgumentException("Unknown enum constant: " + bit);\r
+ case ONE:\r
+ return SWT.COLOR_GREEN;\r
+ case ZERO:\r
+ return SWT.COLOR_BLUE;\r
+ case Z:\r
+ return SWT.COLOR_BLACK;\r
+ case U:\r
+ case X:\r
+ return SWT.COLOR_RED;\r
+ default:\r
+ throw new IllegalArgumentException("Unknown enum constant: " + bit);\r
}\r
}\r
}
\ No newline at end of file