X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.logic.model.am2900%2Ftest%2Fnet%2Fmograsim%2Flogic%2Fmodel%2Fam2900%2Futil%2FTestEnvironmentHelper.java;h=4bae8ec5adf890b4c29f9b9376a515af981b03dc;hb=8bed58cd47f4e53a0a83e066d38864aa6875502f;hp=bf8ee36394a30f9505786e90a6ed9c23b80cf6cf;hpb=93b398d6271a538a2a4c9f4de07a3b4a8a2a7fd4;p=Mograsim.git diff --git a/net.mograsim.logic.model.am2900/test/net/mograsim/logic/model/am2900/util/TestEnvironmentHelper.java b/net.mograsim.logic.model.am2900/test/net/mograsim/logic/model/am2900/util/TestEnvironmentHelper.java index bf8ee363..4bae8ec5 100644 --- a/net.mograsim.logic.model.am2900/test/net/mograsim/logic/model/am2900/util/TestEnvironmentHelper.java +++ b/net.mograsim.logic.model.am2900/test/net/mograsim/logic/model/am2900/util/TestEnvironmentHelper.java @@ -19,16 +19,16 @@ import net.mograsim.logic.model.LogicUIStandaloneGUI; import net.mograsim.logic.model.am2900.Am2900Loader; import net.mograsim.logic.model.am2900.TestableCircuit; import net.mograsim.logic.model.am2900.TestableCircuit.Result; -import net.mograsim.logic.model.model.ViewModel; -import net.mograsim.logic.model.model.ViewModelModifiable; +import net.mograsim.logic.model.model.LogicModel; +import net.mograsim.logic.model.model.LogicModelModifiable; import net.mograsim.logic.model.model.components.ModelComponent; import net.mograsim.logic.model.model.components.atomic.ModelBitDisplay; import net.mograsim.logic.model.model.components.atomic.ModelManualSwitch; import net.mograsim.logic.model.model.components.submodels.SubmodelComponent; import net.mograsim.logic.model.model.wires.ModelWire; import net.mograsim.logic.model.model.wires.Pin; -import net.mograsim.logic.model.modeladapter.LogicModelParameters; -import net.mograsim.logic.model.modeladapter.ViewLogicModelAdapter; +import net.mograsim.logic.model.modeladapter.CoreModelParameters; +import net.mograsim.logic.model.modeladapter.LogicCoreAdapter; import net.mograsim.logic.model.serializing.IndirectModelComponentCreator; import net.mograsim.logic.model.util.ModellingTool; @@ -42,7 +42,7 @@ public class TestEnvironmentHelper private ModelComponent component; private Timeline timeline; - private ViewModelModifiable viewModel; + private LogicModelModifiable logicModel; private ModellingTool modellingTool; private HashMap idSwitchMap = new HashMap<>(); private HashMap idDisplayMap = new HashMap<>(); @@ -78,20 +78,20 @@ public class TestEnvironmentHelper public void setup(DebugState debug) { this.debug = debug; - // Create view model - viewModel = new ViewModelModifiable(); - modellingTool = ModellingTool.createFor(viewModel); + // Create logic model + logicModel = new LogicModelModifiable(); + modellingTool = ModellingTool.createFor(logicModel); Am2900Loader.setup(); - component = IndirectModelComponentCreator.createComponent(viewModel, modelId); + component = IndirectModelComponentCreator.createComponent(logicModel, modelId); setField(componentField, component); component.getPins().values().forEach(this::extendModelPin); - // Create logic model - LogicModelParameters params = new LogicModelParameters(); + // Create core model + CoreModelParameters params = new CoreModelParameters(); params.gateProcessTime = 50; params.wireTravelTime = 10; - timeline = ViewLogicModelAdapter.convert(viewModel, params); + timeline = LogicCoreAdapter.convert(logicModel, params); timelineField.ifPresent(f -> setField(f, timeline)); // Bind switches/displays to this test class @@ -113,17 +113,17 @@ public class TestEnvironmentHelper Class type = f.getType(); if (CoreManualSwitch.class.isAssignableFrom(type)) { - ModelManualSwitch gms = new ModelManualSwitch(viewModel, p.logicWidth); + ModelManualSwitch gms = new ModelManualSwitch(logicModel, p.logicWidth); modellingTool.connect(p, gms.getOutputPin()); idSwitchMap.put(p.name, gms); } else if (CoreBitDisplay.class.isAssignableFrom(type)) { - ModelBitDisplay gbd = new ModelBitDisplay(viewModel, p.logicWidth); + ModelBitDisplay gbd = new ModelBitDisplay(logicModel, p.logicWidth); modellingTool.connect(p, gbd.getInputPin()); idDisplayMap.put(p.name, gbd); } else if (SwitchWithDisplay.class.isAssignableFrom(type)) { - SwitchWithDisplay swd = new SwitchWithDisplay(viewModel, p); + SwitchWithDisplay swd = new SwitchWithDisplay(logicModel, p); setField(f, swd); } else { @@ -149,18 +149,18 @@ public class TestEnvironmentHelper { // Debug code HashSet wiresIncludingSubmodels = new HashSet<>(); - Queue modelsToIterate = new LinkedList<>(); - modelsToIterate.add(viewModel); + Queue modelsToIterate = new LinkedList<>(); + modelsToIterate.add(logicModel); while (modelsToIterate.size() > 0) { - ViewModel model = modelsToIterate.poll(); + LogicModel model = modelsToIterate.poll(); wiresIncludingSubmodels.addAll(model.getWiresByName().values()); for (ModelComponent comp : model.getComponentsByName().values()) if (comp instanceof SubmodelComponent) modelsToIterate.offer(((SubmodelComponent) comp).submodel); } System.out.println(wiresIncludingSubmodels.size()); - viewModel.setRedrawHandler(() -> wiresIncludingSubmodels.forEach(w -> + logicModel.setRedrawHandler(() -> wiresIncludingSubmodels.forEach(w -> { if (debugWires) { @@ -260,8 +260,8 @@ public class TestEnvironmentHelper { try { - new LogicUIStandaloneGUI(viewModel).run(); - viewModel.setRedrawHandler(null); + new LogicUIStandaloneGUI(logicModel).run(); + logicModel.setRedrawHandler(null); } catch (Exception e) {