X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.logic.ui%2Foldsrc%2FGUIMux.java;fp=net.mograsim.logic.ui%2Foldsrc%2FGUIMux.java;h=0000000000000000000000000000000000000000;hb=b5d8c2d71e27350ea7c9314e40df5bb0584271cd;hp=d004d90f8b3ab6d3b4e7db313c968d0908c0d225;hpb=69cb6725ef670328959d55649257ded6ac924b33;p=Mograsim.git diff --git a/net.mograsim.logic.ui/oldsrc/GUIMux.java b/net.mograsim.logic.ui/oldsrc/GUIMux.java deleted file mode 100644 index d004d90f..00000000 --- a/net.mograsim.logic.ui/oldsrc/GUIMux.java +++ /dev/null @@ -1,80 +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.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 GUIComponent -{ - private final double height; - private final List connectedWireEnds; - private final List WireEndConnectionPoints; - - public GUIMux(int processTime, ReadWriteEnd out, ReadEnd select, ReadEnd... inputs) - { - super(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