1 package net.mograsim.logic.ui.model.components.mi.nandbased;
3 import net.haspamelodica.swt.helper.swtobjectwrappers.Point;
4 import net.mograsim.logic.ui.model.ViewModelModifiable;
5 import net.mograsim.logic.ui.model.components.SimpleRectangularSubmodelComponent;
6 import net.mograsim.logic.ui.model.wires.GUIWire;
7 import net.mograsim.logic.ui.model.wires.Pin;
8 import net.mograsim.logic.ui.model.wires.WireCrossPoint;
29 public class GUImux1_4 extends SimpleRectangularSubmodelComponent
31 public GUImux1_4(ViewModelModifiable model)
33 super(model, 1, "GUImux1_4");
37 initSubmodelComponents();
40 @SuppressWarnings("unused")
41 private void initSubmodelComponents()
44 GUImux1 mux1 = new GUImux1(submodelModifiable);
45 GUImux1 mux2 = new GUImux1(submodelModifiable);
46 GUImux1 mux3 = new GUImux1(submodelModifiable);
47 GUImux1 mux4 = new GUImux1(submodelModifiable);
49 GUImux1 mux[] = { mux1, mux2, mux3, mux4 };
50 WireCrossPoint[] cps = new WireCrossPoint[mux.length - 1];
52 int muxXOffset = 25, muxYOffset = 20;
53 Pin test = getInputPins().get(0);
54 Pin test2 = mux[0].getInputPins().get(1);
55 for (int i = 0; i < mux.length; i++)
57 mux[i].moveTo(muxXOffset, muxYOffset + mux[0].getBounds().height * i);
58 Pin inPin = getInputSubmodelPins().get(i + 1), muxPin = mux[i].getInputPins().get(1);
60 new GUIWire(submodelModifiable, inPin, muxPin, new Point(inPin.getPos().x + 5, inPin.getPos().y),
61 new Point(inPin.getPos().x + 5, muxPin.getPos().y));
62 new GUIWire(submodelModifiable, getInputSubmodelPins().get(mux.length + i + 1), mux[i].getInputPins().get(2));
63 new GUIWire(submodelModifiable, mux[i].getOutputPins().get(0), getOutputSubmodelPins().get(i));
65 if (i != mux.length - 1)
67 WireCrossPoint cp = new WireCrossPoint(submodelModifiable, logicWidth);
69 Pin p = mux[i].getInputPins().get(0);
70 cp.moveTo(muxXOffset - 3, p.getPos().y);
71 new GUIWire(submodelModifiable, cp, mux[i].getInputPins().get(0));
73 new GUIWire(submodelModifiable, cps[i - 1], cp);
75 new GUIWire(submodelModifiable, getInputSubmodelPins().get(0), cp);
78 new GUIWire(submodelModifiable, cps[i - 1], mux[i].getInputPins().get(0),
79 new Point(cps[i - 1].getPin().getPos().x, mux[i].getInputPins().get(0).getPos().y));