Replaced "provider" in identifiers with "supplier"
[Mograsim.git] / net.mograsim.logic.ui.am2900 / src / net / mograsim / logic / ui / model / components / mi / nandbased / GUIfulladder.java
1 package net.mograsim.logic.ui.model.components.mi.nandbased;
2
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.serializing.IndirectGUIComponentCreator;
10
11 public class GUIfulladder extends SimpleRectangularSubmodelComponent
12 {
13         public GUIfulladder(ViewModelModifiable model)
14         {
15                 super(model, 1, "GUIfulladder");
16                 setSubmodelScale(.4);
17                 setInputPins("A", "B", "C");
18                 setOutputPins("Y", "Z");
19                 initSubmodelComponents();
20         }
21
22         @SuppressWarnings("unused") // for GUIWires being created
23         private void initSubmodelComponents()
24         {
25                 Pin A = getSubmodelPin("A");
26                 Pin B = getSubmodelPin("B");
27                 Pin C = getSubmodelPin("C");
28                 Pin Y = getSubmodelPin("Y");
29                 Pin Z = getSubmodelPin("Z");
30
31                 GUIhalfadder halfBC = new GUIhalfadder(submodelModifiable);
32                 GUIhalfadder halfAY = new GUIhalfadder(submodelModifiable);
33                 GUINandGate nandZ = new GUINandGate(submodelModifiable, 1);
34
35                 halfAY.moveTo(45, 7.5);
36                 halfBC.moveTo(5, 40);
37                 nandZ.moveTo(57.5, 40);
38
39                 new GUIWire(submodelModifiable, A, halfAY.getPin("A"), new Point[0]);
40                 new GUIWire(submodelModifiable, B, halfBC.getPin("A"));
41                 new GUIWire(submodelModifiable, C, halfBC.getPin("B"));
42                 new GUIWire(submodelModifiable, halfBC.getPin("Y"), halfAY.getPin("B"));
43                 new GUIWire(submodelModifiable, halfBC.getPin("_Z"), nandZ.getPin("B"), new Point[0]);
44                 new GUIWire(submodelModifiable, halfAY.getPin("Y"), Y, new Point[0]);
45                 new GUIWire(submodelModifiable, halfAY.getPin("_Z"), nandZ.getPin("A"), new Point(82.5, 22.5), new Point(82.5, 35),
46                                 new Point(52.5, 35), new Point(52.5, 45));
47                 new GUIWire(submodelModifiable, nandZ.getPin("Y"), Z);
48         }
49
50         static
51         {
52                 IndirectGUIComponentCreator.setComponentSupplier(GUIfulladder.class.getCanonicalName(), (m, p) -> new GUIfulladder(m));
53         }
54 }