X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=LogicUI%2Fsrc%2Fera%2Fmi%2Fgui%2Fcomponents%2FGUIMux.java;h=e753b14946af3552419fba3d328d9f6310a7f6e6;hb=32a3d41c11b96c2530c25b6059b4341a8b34a2e2;hp=64adc7d2b7d046393877bbbff46f6eb38044a9ab;hpb=9c31e87700d7a4872f9caaa8bd3afe1f023d9926;p=Mograsim.git diff --git a/LogicUI/src/era/mi/gui/components/GUIMux.java b/LogicUI/src/era/mi/gui/components/GUIMux.java index 64adc7d2..e753b149 100644 --- a/LogicUI/src/era/mi/gui/components/GUIMux.java +++ b/LogicUI/src/era/mi/gui/components/GUIMux.java @@ -13,16 +13,16 @@ import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle; public class GUIMux extends Mux implements BasicGUIComponent { - private final double height; - private final List connectedWireArrays; - private final List wireArrayConnectionPoints; + private final double height; + private final List connectedWireArrays; + private final List wireArrayConnectionPoints; public GUIMux(int processTime, WireArray out, WireArray select, WireArray... inputs) { super(processTime, out, select, inputs); double height = inputs.length * 5; - if(height < 10) + if (height < 10) height = 10; this.height = height; @@ -39,7 +39,7 @@ public class GUIMux extends Mux implements BasicGUIComponent connectedWireArraysModifiable.addAll(Arrays.asList(inputs)); double inputHeightIncrement = (height + 20) / inputs.length; double inputHeight = inputHeightIncrement / 2; - for(int i = 0; i < inputs.length; i ++, inputHeight += inputHeightIncrement) + for (int i = 0; i < inputs.length; i++, inputHeight += inputHeightIncrement) wireArrayConnectionPointsModifiable.add(new Point(0, inputHeight)); } @@ -52,25 +52,25 @@ public class GUIMux extends Mux implements BasicGUIComponent { return new Rectangle(0, 0, 20, height + 20); } + @Override public void render(GeneralGC gc) { - gc.drawPolygon(new double[] { - 0, 0, - 20, 10, - 20, height + 10, - 0, height + 20}); + gc.drawPolygon(new double[] { 0, 0, 20, 10, 20, height + 10, 0, height + 20 }); } + @Override public int getConnectedWireArraysCount() { return connectedWireArrays.size(); } + @Override public WireArray getConnectedWireArray(int connectionIndex) { return connectedWireArrays.get(connectionIndex); } + @Override public Point getWireArrayConnectionPoint(int connectionI) {