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.GUINandGate;
6 import net.mograsim.logic.ui.model.components.SimpleRectangularSubmodelComponent;
7 import net.mograsim.logic.ui.model.wires.GUIWire;
8 import net.mograsim.logic.ui.model.wires.Pin;
9 import net.mograsim.logic.ui.model.wires.WireCrossPoint;
11 public class GUImux1 extends SimpleRectangularSubmodelComponent
13 public GUImux1(ViewModelModifiable model)
15 super(model, 1, "GUImux1");
21 initSubmodelComponents();
24 @SuppressWarnings("unused")
25 private void initSubmodelComponents()
27 Pin S0 = getInputSubmodelPins().get(0);
28 Pin I0 = getInputSubmodelPins().get(1);
29 Pin I1 = getInputSubmodelPins().get(2);
30 Pin Y = getOutputSubmodelPins().get(0);
32 GUINandGate nandS0 = new GUINandGate(submodelModifiable, 1);
33 GUINandGate nandI0 = new GUINandGate(submodelModifiable, 1);
34 GUINandGate nandI1 = new GUINandGate(submodelModifiable, 1);
35 GUINandGate nandY = new GUINandGate(submodelModifiable, 1);
37 nandS0.moveTo(10, 7.5);
38 nandI0.moveTo(35, 22.5);
39 nandI1.moveTo(35, 47.5);
42 WireCrossPoint cp0 = new WireCrossPoint(submodelModifiable, 1);
43 WireCrossPoint cp1 = new WireCrossPoint(submodelModifiable, 1);
48 new GUIWire(submodelModifiable, S0, cp0);
49 new GUIWire(submodelModifiable, cp0, nandS0.getInputPins().get(0));
50 new GUIWire(submodelModifiable, cp0, cp1);
51 new GUIWire(submodelModifiable, cp1, nandS0.getInputPins().get(1));
53 new GUIWire(submodelModifiable, nandS0.getOutputPin(), nandI0.getInputPins().get(0));
54 new GUIWire(submodelModifiable, I0, nandI0.getInputPins().get(1));
56 new GUIWire(submodelModifiable, cp1, nandI1.getInputPins().get(0),
57 new Point(cp1.getPin().getPos().x, nandI1.getInputPins().get(0).getPos().y));
58 new GUIWire(submodelModifiable, I1, nandI1.getInputPins().get(1));
60 new GUIWire(submodelModifiable, nandI0.getOutputPin(), nandY.getInputPins().get(0));
61 new GUIWire(submodelModifiable, nandI1.getOutputPin(), nandY.getInputPins().get(1));
63 new GUIWire(submodelModifiable, nandY.getOutputPin(), Y);