+ SubmodelComponentDeserializer.create(submodelModifiable, "HalfAdder.json");
+ }
+ }
+
+ @SuppressWarnings("unused") // GUIWires being created
+ private static void basicTest(ViewModelModifiable viewModel)
+ {
+ GUI_rsLatch comp = new GUI_rsLatch(viewModel);
+ comp.moveTo(30, 0);
+ SubmodelComponentParams params = comp.calculateParams();
+ String jsonString = JsonHandler.toJson(params);
+ System.out.println(jsonString);
+ SubmodelComponentParams paramsD = JsonHandler.fromJson(jsonString, SubmodelComponentParams.class);
+ SubmodelComponent componentD = SubmodelComponentDeserializer.create(viewModel, paramsD);
+ componentD.moveTo(30, 50);
+ double h = 0;
+ for (String s : comp.getInputPinNames())
+ {
+ GUIManualSwitch sw = new GUIManualSwitch(viewModel);
+ sw.moveTo(0, h);
+ new GUIWire(viewModel, sw.getOutputPin(), comp.getPin(s));
+ sw = new GUIManualSwitch(viewModel);
+ sw.moveTo(0, h + 50);
+ new GUIWire(viewModel, sw.getOutputPin(), componentD.getPin(s));
+ h += 20;
+ }
+ h = 0;
+ for (String s : comp.getOutputPinNames())
+ {
+ GUIBitDisplay bd = new GUIBitDisplay(viewModel);
+ bd.moveTo(80, h);
+ new GUIWire(viewModel, bd.getInputPin(), comp.getPin(s));
+ bd = new GUIBitDisplay(viewModel);
+ bd.moveTo(80, h + 50);
+ new GUIWire(viewModel, bd.getInputPin(), componentD.getPin(s));
+ h += 20;