import net.mograsim.logic.ui.model.components.atomic.GUIManualSwitch;
import net.mograsim.logic.ui.model.components.mi.nandbased.GUI_rsLatch;
import net.mograsim.logic.ui.model.components.mi.nandbased.GUIfulladder;
import net.mograsim.logic.ui.model.components.atomic.GUIManualSwitch;
import net.mograsim.logic.ui.model.components.mi.nandbased.GUI_rsLatch;
import net.mograsim.logic.ui.model.components.mi.nandbased.GUIfulladder;
import net.mograsim.logic.ui.model.components.submodels.SimpleRectangularSubmodelComponent;
import net.mograsim.logic.ui.model.components.submodels.SubmodelComponent;
import net.mograsim.logic.ui.model.wires.GUIWire;
import net.mograsim.logic.ui.serializing.IndirectGUIComponentCreator;
import net.mograsim.logic.ui.serializing.SubmodelComponentDeserializer;
import net.mograsim.logic.ui.serializing.SubmodelComponentParams;
import net.mograsim.logic.ui.model.components.submodels.SimpleRectangularSubmodelComponent;
import net.mograsim.logic.ui.model.components.submodels.SubmodelComponent;
import net.mograsim.logic.ui.model.wires.GUIWire;
import net.mograsim.logic.ui.serializing.IndirectGUIComponentCreator;
import net.mograsim.logic.ui.serializing.SubmodelComponentDeserializer;
import net.mograsim.logic.ui.serializing.SubmodelComponentParams;
- IndirectGUIComponentCreator.createComponent(model, "Am2901", JsonNull.INSTANCE);
+ IndirectGUIComponentCreator.createComponent(model, "Am2901", JsonNull.INSTANCE, "Am2901 instance");
}
}
@SuppressWarnings("unused") // GUIWires being created
private static void basicTest(ViewModelModifiable viewModel)
{
}
}
@SuppressWarnings("unused") // GUIWires being created
private static void basicTest(ViewModelModifiable viewModel)
{
- SubmodelComponent deserialized = SubmodelComponentDeserializer.create(viewModel,
- new Gson().fromJson(jsonString, SubmodelComponentParams.class));
- deserialized.moveTo(30, 50);
+ SubmodelComponentParams paramsD = JsonHandler.fromJson(jsonString, SubmodelComponentParams.class);
+ SubmodelComponent componentD = SubmodelComponentDeserializer.create(viewModel, paramsD, "Deserialized RS latch");
+ componentD.moveTo(30, 50);
new GUIWire(viewModel, sw.getOutputPin(), comp.getPin(s));
sw = new GUIManualSwitch(viewModel);
sw.moveTo(0, h + 50);
new GUIWire(viewModel, sw.getOutputPin(), comp.getPin(s));
sw = new GUIManualSwitch(viewModel);
sw.moveTo(0, h + 50);
new GUIWire(viewModel, bd.getInputPin(), comp.getPin(s));
bd = new GUIBitDisplay(viewModel);
bd.moveTo(80, h + 50);
new GUIWire(viewModel, bd.getInputPin(), comp.getPin(s));
bd = new GUIBitDisplay(viewModel);
bd.moveTo(80, h + 50);
// Execute only after HalfAdder.json has been created
public static void refJsonFromJsonTest(ViewModelModifiable model)
{
// Execute only after HalfAdder.json has been created
public static void refJsonFromJsonTest(ViewModelModifiable model)
{
- public static void createHalfAdderExample(ViewModelModifiable model)
- {
- GUIhalfadder tmp = new GUIhalfadder(model);
- tmp.moveTo(1000, 50);
- SubmodelComponentParams p = tmp.calculateParams();
- try
- {
- p.writeJson("HalfAdder.json");
- p = SubmodelComponentParams.readJson("HalfAdder.json");
- }
- catch (IOException e)
- {
- e.printStackTrace();
- }
-
- SubmodelComponentDeserializer.create(model, p);
- }
-
@SuppressWarnings("unused") // for GUIWires being created
public static void createFromJsonExample(ViewModelModifiable model)
{
@SuppressWarnings("unused") // for GUIWires being created
public static void createFromJsonExample(ViewModelModifiable model)
{
new GUIWire(model, adder.getPin("Y"), bdY.getInputPin());
new GUIWire(model, adder.getPin("Z"), bdZ.getInputPin());
new GUIWire(model, adder.getPin("Y"), bdY.getInputPin());
new GUIWire(model, adder.getPin("Z"), bdZ.getInputPin());