45ba337a38dc33cd294ea79cc8bfac36712aa0a2
[Mograsim.git] / net.mograsim.logic.ui / src / net / mograsim / logic / ui / model / components / mi / nandbased / GUIand41.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.SimpleRectangularSubmodelComponent;
6 import net.mograsim.logic.ui.model.wires.GUIWire;
7 import net.mograsim.logic.ui.model.wires.Pin;
8 import net.mograsim.logic.ui.model.wires.WireCrossPoint;
9
10 public class GUIand41 extends SimpleRectangularSubmodelComponent
11 {
12         public GUIand41(ViewModelModifiable model)
13         {
14                 super(model, 1, "GUIand41");
15                 setSubmodelScale(.4);
16                 setInputPins("A1", "A2", "A3", "A4", "B");
17                 setOutputPins("Y1", "Y2", "Y3", "Y4");
18                 initSubmodelComponents();
19         }
20
21         @SuppressWarnings("unused") // for GUIWires being created
22         private void initSubmodelComponents()
23         {
24                 Pin A1 = getInputSubmodelPins().get(0);
25                 Pin A2 = getInputSubmodelPins().get(1);
26                 Pin A3 = getInputSubmodelPins().get(2);
27                 Pin A4 = getInputSubmodelPins().get(3);
28                 Pin B = getInputSubmodelPins().get(4);
29                 Pin Y1 = getOutputSubmodelPins().get(0);
30                 Pin Y2 = getOutputSubmodelPins().get(1);
31                 Pin Y3 = getOutputSubmodelPins().get(2);
32                 Pin Y4 = getOutputSubmodelPins().get(3);
33
34                 GUIand and1 = new GUIand(submodelModifiable);
35                 GUIand and2 = new GUIand(submodelModifiable);
36                 GUIand and3 = new GUIand(submodelModifiable);
37                 GUIand and4 = new GUIand(submodelModifiable);
38
39                 WireCrossPoint cpB2 = new WireCrossPoint(submodelModifiable, 1);
40                 WireCrossPoint cpB3 = new WireCrossPoint(submodelModifiable, 1);
41                 WireCrossPoint cpB4 = new WireCrossPoint(submodelModifiable, 1);
42
43                 and1.moveTo(30, 7.5);
44                 and2.moveTo(30, 32.5);
45                 and3.moveTo(30, 57.5);
46                 and4.moveTo(30, 82.5);
47                 cpB2.moveCenterTo(25, 47.5);
48                 cpB3.moveCenterTo(25, 72.5);
49                 cpB4.moveCenterTo(25, 97.5);
50
51                 new GUIWire(submodelModifiable, A1, and1.getInputPins().get(0), new Point[0]);
52                 new GUIWire(submodelModifiable, A2, and2.getInputPins().get(0), new Point[0]);
53                 new GUIWire(submodelModifiable, A3, and3.getInputPins().get(0), new Point[0]);
54                 new GUIWire(submodelModifiable, A4, and4.getInputPins().get(0), new Point[0]);
55                 new GUIWire(submodelModifiable, B, cpB4, new Point(25, 112.5));
56                 new GUIWire(submodelModifiable, cpB4, and4.getInputPins().get(1), new Point[0]);
57                 new GUIWire(submodelModifiable, cpB4, cpB3, new Point[0]);
58                 new GUIWire(submodelModifiable, cpB3, and3.getInputPins().get(1), new Point[0]);
59                 new GUIWire(submodelModifiable, cpB3, cpB2, new Point[0]);
60                 new GUIWire(submodelModifiable, cpB2, and2.getInputPins().get(1), new Point[0]);
61                 new GUIWire(submodelModifiable, cpB2, and1.getInputPins().get(1), new Point(25, 22.5));
62                 new GUIWire(submodelModifiable, and1.getOutputPins().get(0), Y1, new Point[0]);
63                 new GUIWire(submodelModifiable, and2.getOutputPins().get(0), Y2, new Point[0]);
64                 new GUIWire(submodelModifiable, and3.getOutputPins().get(0), Y3, new Point[0]);
65                 new GUIWire(submodelModifiable, and4.getOutputPins().get(0), Y4, new Point[0]);
66         }
67 }