X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=LogicUI%2Fsrc%2Fera%2Fmi%2Fgui%2Fcomponents%2FGUIMux.java;fp=LogicUI%2Fsrc%2Fera%2Fmi%2Fgui%2Fcomponents%2FGUIMux.java;h=0000000000000000000000000000000000000000;hb=4d29cabdc45d68b5e5f210266dc4fbc5560dbcdd;hp=0eba8f553c8ca11d258efbb62b2a44471ff0aa52;hpb=34fbe2b9bd5bdf6eda0506d9bf00c8840c6cc28a;p=Mograsim.git diff --git a/LogicUI/src/era/mi/gui/components/GUIMux.java b/LogicUI/src/era/mi/gui/components/GUIMux.java deleted file mode 100644 index 0eba8f55..00000000 --- a/LogicUI/src/era/mi/gui/components/GUIMux.java +++ /dev/null @@ -1,81 +0,0 @@ -package era.mi.gui.components; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import era.mi.logic.components.Mux; -import era.mi.logic.timeline.Timeline; -import era.mi.logic.wires.Wire.ReadEnd; -import era.mi.logic.wires.Wire.ReadWriteEnd; -import net.haspamelodica.swt.helper.gcs.GeneralGC; -import net.haspamelodica.swt.helper.swtobjectwrappers.Point; -import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle; - -public class GUIMux extends Mux implements BasicGUIComponent -{ - private final double height; - private final List connectedWireEnds; - private final List WireEndConnectionPoints; - - public GUIMux(Timeline timeline, int processTime, ReadWriteEnd out, ReadEnd select, ReadEnd... inputs) - { - super(timeline, processTime, out, select, inputs); - - double height = inputs.length * 5; - if (height < 10) - height = 10; - this.height = height; - - List connectedWireEndsModifiable = new ArrayList<>(); - List WireEndConnectionPointsModifiable = new ArrayList<>(); - - connectedWireEndsModifiable.add(out); - WireEndConnectionPointsModifiable.add(new Point(20, 10 + height / 2)); - - connectedWireEndsModifiable.add(select); - WireEndConnectionPointsModifiable.add(new Point(10, 5)); - - { - connectedWireEndsModifiable.addAll(Arrays.asList(inputs)); - double inputHeightIncrement = (height + 20) / inputs.length; - double inputHeight = inputHeightIncrement / 2; - for (int i = 0; i < inputs.length; i++, inputHeight += inputHeightIncrement) - WireEndConnectionPointsModifiable.add(new Point(0, inputHeight)); - } - - this.connectedWireEnds = Collections.unmodifiableList(connectedWireEndsModifiable); - this.WireEndConnectionPoints = Collections.unmodifiableList(WireEndConnectionPointsModifiable); - } - - @Override - public Rectangle getBounds() - { - 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 }); - } - - @Override - public int getConnectedWireEndsCount() - { - return connectedWireEnds.size(); - } - - @Override - public ReadEnd getConnectedWireEnd(int connectionIndex) - { - return connectedWireEnds.get(connectionIndex); - } - - @Override - public Point getWireEndConnectionPoint(int connectionI) - { - return WireEndConnectionPoints.get(connectionI); - } -} \ No newline at end of file