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 GUInand3 extends SimpleRectangularSubmodelComponent
13 public GUInand3(ViewModelModifiable model)
15 super(model, 1, "GUInand3");
17 setInputPins("A", "B", "C");
19 initSubmodelComponents();
22 @SuppressWarnings("unused") // for GUIWires being created
23 private void initSubmodelComponents()
25 Pin A = getInputSubmodelPins().get(0);
26 Pin B = getInputSubmodelPins().get(1);
27 Pin C = getInputSubmodelPins().get(2);
28 Pin Y = getOutputSubmodelPins().get(0);
30 GUINandGate nandAB = new GUINandGate(submodelModifiable, 1);
31 GUINandGate andAB = new GUINandGate(submodelModifiable, 1);
32 GUINandGate nandABC = new GUINandGate(submodelModifiable, 1);
34 WireCrossPoint cpNandAB = new WireCrossPoint(submodelModifiable, 1);
36 nandAB.moveTo(10, 15);
38 nandABC.moveTo(62.5, 2.5);
39 cpNandAB.moveCenterTo(32.5, 25);
41 new GUIWire(submodelModifiable, A, nandAB.getInputPins().get(0));
42 new GUIWire(submodelModifiable, B, nandAB.getInputPins().get(1));
43 new GUIWire(submodelModifiable, nandAB.getOutputPin(), cpNandAB, new Point[0]);
44 new GUIWire(submodelModifiable, cpNandAB, andAB.getInputPins().get(0), new Point(32.5, 20));
45 new GUIWire(submodelModifiable, cpNandAB, andAB.getInputPins().get(1), new Point(32.5, 30));
46 new GUIWire(submodelModifiable, andAB.getOutputPin(), nandABC.getInputPins().get(0), new Point(57.5, 25), new Point(57.5, 7.5));
47 new GUIWire(submodelModifiable, C, nandABC.getInputPins().get(1), new Point(60, 62.5), new Point(60, 17.5));
48 new GUIWire(submodelModifiable, nandABC.getOutputPin(), Y, new Point[0]);