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.SubmodelComponent;
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 GUIand extends SubmodelComponent
13 public GUIand(ViewModelModifiable model)
15 super(model, "GUIand");
18 initSubmodelComponents();
21 @SuppressWarnings("unused") // for GUIWires being created
22 private void initSubmodelComponents()
24 Pin A = addSubmodelInterface(1, 0, 5);
25 Pin B = addSubmodelInterface(1, 0, 20);
26 Pin Y = addSubmodelInterface(1, 35, 12.5);
28 GUINandGate nand = new GUINandGate(submodelModifiable, 1);
29 nand.moveTo(20, 21.25);
30 GUINandGate not = new GUINandGate(submodelModifiable, 1);
31 not.moveTo(50, 21.25);
33 WireCrossPoint cp1 = new WireCrossPoint(submodelModifiable, 1);
34 cp1.moveTo(45, 31.25);
36 new GUIWire(submodelModifiable, A, nand.getInputPins().get(0), new Point(10, 12.5), new Point(10, 26.25));
37 new GUIWire(submodelModifiable, B, nand.getInputPins().get(1), new Point(10, 50), new Point(10, 36.25));
38 new GUIWire(submodelModifiable, nand.getOutputPin(), cp1.getPin());
39 new GUIWire(submodelModifiable, cp1.getPin(), not.getInputPins().get(0), new Point(45, 26.25));
40 new GUIWire(submodelModifiable, cp1.getPin(), not.getInputPins().get(1), new Point(45, 36.25));
41 new GUIWire(submodelModifiable, not.getOutputPin(), Y);