public GUIfulladder(ViewModelModifiable model)
{
super(model, 1, "GUIfulladder");
- setSize(50, 40);
setSubmodelScale(.4);
- setInputCount(3);
- setOutputCount(2);
+ setInputPins("A", "B", "C");
+ setOutputPins("Y", "Z");
initSubmodelComponents();
}
@SuppressWarnings("unused") // for GUIWires being created
private void initSubmodelComponents()
{
- Pin A = getInputSubmodelPins().get(0);
- Pin B = getInputSubmodelPins().get(1);
- Pin C = getInputSubmodelPins().get(2);
- Pin Y = getOutputSubmodelPins().get(0);
- Pin Z = getOutputSubmodelPins().get(1);
+ Pin A = getSubmodelPin("A");
+ Pin B = getSubmodelPin("B");
+ Pin C = getSubmodelPin("C");
+ Pin Y = getSubmodelPin("Y");
+ Pin Z = getSubmodelPin("Z");
GUIhalfadder halfBC = new GUIhalfadder(submodelModifiable);
GUIhalfadder halfAY = new GUIhalfadder(submodelModifiable);
halfBC.moveTo(5, 40);
nandZ.moveTo(57.5, 40);
- new GUIWire(submodelModifiable, A, halfAY.getInputPins().get(0), new Point[0]);
- new GUIWire(submodelModifiable, B, halfBC.getInputPins().get(0));
- new GUIWire(submodelModifiable, C, halfBC.getInputPins().get(1));
- new GUIWire(submodelModifiable, halfBC.getOutputPins().get(0), halfAY.getInputPins().get(1));
- new GUIWire(submodelModifiable, halfBC.getOutputPins().get(1), nandZ.getInputPins().get(1), new Point[0]);
- new GUIWire(submodelModifiable, halfAY.getOutputPins().get(0), Y, new Point[0]);
- new GUIWire(submodelModifiable, halfAY.getOutputPins().get(1), nandZ.getInputPins().get(0), new Point(82.5, 22.5),
- new Point(82.5, 35), new Point(52.5, 35), new Point(52.5, 45));
- new GUIWire(submodelModifiable, nandZ.getOutputPin(), Z);
+ new GUIWire(submodelModifiable, A, halfAY.getPin("A"), new Point[0]);
+ new GUIWire(submodelModifiable, B, halfBC.getPin("A"));
+ new GUIWire(submodelModifiable, C, halfBC.getPin("B"));
+ new GUIWire(submodelModifiable, halfBC.getPin("Y"), halfAY.getPin("B"));
+ new GUIWire(submodelModifiable, halfBC.getPin("_Z"), nandZ.getPin("B"), new Point[0]);
+ new GUIWire(submodelModifiable, halfAY.getPin("Y"), Y, new Point[0]);
+ new GUIWire(submodelModifiable, halfAY.getPin("_Z"), nandZ.getPin("A"), new Point(82.5, 22.5), new Point(82.5, 35),
+ new Point(52.5, 35), new Point(52.5, 45));
+ new GUIWire(submodelModifiable, nandZ.getPin("Y"), Z);
}
}
\ No newline at end of file