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.atomic.GUINandGate;
6 import net.mograsim.logic.ui.model.components.submodels.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;
10 import net.mograsim.logic.ui.serializing.IndirectGUIComponentCreator;
12 public class GUImux1 extends SimpleRectangularSubmodelComponent
14 public GUImux1(ViewModelModifiable model)
19 public GUImux1(ViewModelModifiable model, String name)
21 super(model, 1, "GUImux1", name);
23 setInputPins("S0", "I0", "I1");
25 initSubmodelComponents();
28 @SuppressWarnings("unused")
29 private void initSubmodelComponents()
31 Pin S0 = getSubmodelPin("S0");
32 Pin I0 = getSubmodelPin("I0");
33 Pin I1 = getSubmodelPin("I1");
34 Pin Y = getSubmodelPin("Y");
36 GUINandGate nandS0 = new GUINandGate(submodelModifiable, 1);
37 GUINandGate nandI0 = new GUINandGate(submodelModifiable, 1);
38 GUINandGate nandI1 = new GUINandGate(submodelModifiable, 1);
39 GUINandGate nandY = new GUINandGate(submodelModifiable, 1);
41 WireCrossPoint cp0 = new WireCrossPoint(submodelModifiable, 1);
42 WireCrossPoint cp1 = new WireCrossPoint(submodelModifiable, 1);
44 nandS0.moveTo(10, 7.5);
45 nandI0.moveTo(35, 22.5);
46 nandI1.moveTo(35, 47.5);
48 cp0.moveCenterTo(5, 12.5);
49 cp1.moveCenterTo(5, 22.5);
51 new GUIWire(submodelModifiable, S0, cp0, new Point[0]);
52 new GUIWire(submodelModifiable, cp0, nandS0.getPin("A"), new Point[0]);
53 new GUIWire(submodelModifiable, cp0, cp1, new Point[0]);
54 new GUIWire(submodelModifiable, cp1, nandS0.getPin("B"), new Point[0]);
55 new GUIWire(submodelModifiable, nandS0.getPin("Y"), nandI0.getPin("A"));
56 new GUIWire(submodelModifiable, I0, nandI0.getPin("B"), new Point[0]);
57 new GUIWire(submodelModifiable, cp1, nandI1.getPin("A"), new Point(5, 52.5));
58 new GUIWire(submodelModifiable, I1, nandI1.getPin("B"), new Point[0]);
59 new GUIWire(submodelModifiable, nandI0.getPin("Y"), nandY.getPin("A"));
60 new GUIWire(submodelModifiable, nandI1.getPin("Y"), nandY.getPin("B"));
61 new GUIWire(submodelModifiable, nandY.getPin("Y"), Y);
66 IndirectGUIComponentCreator.setComponentSupplier(GUImux1.class.getCanonicalName(), (m, p, n) -> new GUImux1(m, n));