Renamed logic to core where appropiate
authorDaniel Kirschten <daniel.kirschten@gmx.de>
Thu, 5 Sep 2019 16:35:53 +0000 (18:35 +0200)
committerDaniel Kirschten <daniel.kirschten@gmx.de>
Thu, 5 Sep 2019 16:35:53 +0000 (18:35 +0200)
39 files changed:
net.mograsim.logic.model.am2900/src/net/mograsim/logic/model/am2900/machine/Am2900Machine.java
net.mograsim.logic.model.am2900/test/net/mograsim/logic/model/am2900/util/TestEnvironmentHelper.java
net.mograsim.logic.model/OSGI-INF/l10n/bundle.properties
net.mograsim.logic.model/src/net/mograsim/logic/model/LogicExecuter.java
net.mograsim.logic.model/src/net/mograsim/logic/model/SimpleLogicUIStandalone.java
net.mograsim.logic.model/src/net/mograsim/logic/model/model/components/atomic/ModelAndGate.java
net.mograsim.logic.model/src/net/mograsim/logic/model/model/components/atomic/ModelBitDisplay.java
net.mograsim.logic.model/src/net/mograsim/logic/model/model/components/atomic/ModelClock.java
net.mograsim.logic.model/src/net/mograsim/logic/model/model/components/atomic/ModelFixedOutput.java
net.mograsim.logic.model/src/net/mograsim/logic/model/model/components/atomic/ModelManualSwitch.java
net.mograsim.logic.model/src/net/mograsim/logic/model/model/components/atomic/ModelMerger.java
net.mograsim.logic.model/src/net/mograsim/logic/model/model/components/atomic/ModelNandGate.java
net.mograsim.logic.model/src/net/mograsim/logic/model/model/components/atomic/ModelNotGate.java
net.mograsim.logic.model/src/net/mograsim/logic/model/model/components/atomic/ModelOrGate.java
net.mograsim.logic.model/src/net/mograsim/logic/model/model/components/atomic/ModelSplitter.java
net.mograsim.logic.model/src/net/mograsim/logic/model/model/components/atomic/ModelTextComponent.java
net.mograsim.logic.model/src/net/mograsim/logic/model/model/components/atomic/ModelTriStateBuffer.java
net.mograsim.logic.model/src/net/mograsim/logic/model/model/components/atomic/SimpleRectangularHardcodedModelComponent.java
net.mograsim.logic.model/src/net/mograsim/logic/model/model/wires/ModelWire.java
net.mograsim.logic.model/src/net/mograsim/logic/model/model/wires/ModelWireCrossPoint.java
net.mograsim.logic.model/src/net/mograsim/logic/model/modeladapter/CoreModelParameters.java [new file with mode: 0644]
net.mograsim.logic.model/src/net/mograsim/logic/model/modeladapter/LogicCoreAdapter.java [new file with mode: 0644]
net.mograsim.logic.model/src/net/mograsim/logic/model/modeladapter/LogicModelParameters.java [deleted file]
net.mograsim.logic.model/src/net/mograsim/logic/model/modeladapter/ViewLogicModelAdapter.java [deleted file]
net.mograsim.logic.model/src/net/mograsim/logic/model/modeladapter/componentadapters/BitDisplayAdapter.java
net.mograsim.logic.model/src/net/mograsim/logic/model/modeladapter/componentadapters/ClockAdapter.java
net.mograsim.logic.model/src/net/mograsim/logic/model/modeladapter/componentadapters/ComponentAdapter.java
net.mograsim.logic.model/src/net/mograsim/logic/model/modeladapter/componentadapters/FixedOutputAdapter.java
net.mograsim.logic.model/src/net/mograsim/logic/model/modeladapter/componentadapters/ManualSwitchAdapter.java
net.mograsim.logic.model/src/net/mograsim/logic/model/modeladapter/componentadapters/MergerAdapter.java
net.mograsim.logic.model/src/net/mograsim/logic/model/modeladapter/componentadapters/NoLogicAdapter.java
net.mograsim.logic.model/src/net/mograsim/logic/model/modeladapter/componentadapters/SimpleGateAdapter.java
net.mograsim.logic.model/src/net/mograsim/logic/model/modeladapter/componentadapters/SimpleRectangularHardcodedModelComponentAdapter.java
net.mograsim.logic.model/src/net/mograsim/logic/model/modeladapter/componentadapters/SplitterAdapter.java
net.mograsim.logic.model/src/net/mograsim/logic/model/modeladapter/componentadapters/TriStateBufferAdapter.java
net.mograsim.logic.model/src/net/mograsim/logic/model/snippets/highlevelstatehandlers/standard/atomic/WireForcingAtomicHighLevelStateHandler.java
net.mograsim.machine/src/net/mograsim/machine/standard/memory/ModelMemoryWA.java
net.mograsim.machine/src/net/mograsim/machine/standard/memory/WordAddressableMemoryAdapter.java
net.mograsim.plugin.core/src/net/mograsim/plugin/SimulationPreview.java

index ecb13b4..a771947 100644 (file)
@@ -5,8 +5,8 @@ import net.mograsim.logic.core.timeline.Timeline;
 import net.mograsim.logic.core.types.BitVector;
 import net.mograsim.logic.model.model.ViewModel;
 import net.mograsim.logic.model.model.ViewModelModifiable;
-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.machine.Machine;
 import net.mograsim.machine.MachineDefinition;
@@ -25,10 +25,10 @@ public class Am2900Machine implements Machine
                viewModel = new ViewModelModifiable();
                IndirectModelComponentCreator.createComponent(viewModel,
                                "resloader:Am2900Loader:jsonres:net/mograsim/logic/model/am2900/components/ModelAm2900.json");
-               LogicModelParameters params = new LogicModelParameters();
+               CoreModelParameters params = new CoreModelParameters();
                params.gateProcessTime = 50;
                params.wireTravelTime = 10;
-               timeline = ViewLogicModelAdapter.convert(viewModel, params);
+               timeline = LogicCoreAdapter.convert(viewModel, params);
        }
 
        @Override
index bf8ee36..a71c9de 100644 (file)
@@ -27,8 +27,8 @@ 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;
 
@@ -87,11 +87,11 @@ public class TestEnvironmentHelper
 
                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(viewModel, params);
                timelineField.ifPresent(f -> setField(f, timeline));
 
                // Bind switches/displays to this test class
index 420d2fc..fad36e3 100644 (file)
@@ -1,3 +1,3 @@
 #Properties file for net.mograsim.logic.model
 Bundle-Vendor = Mograsim Team
-Bundle-Name = Mograsim logic user interface
\ No newline at end of file
+Bundle-Name = Mograsim logic model and user interface
\ No newline at end of file
index aa36b1c..a9fde7a 100644 (file)
@@ -8,7 +8,7 @@ import net.mograsim.logic.core.timeline.Timeline;
 //TODO maybe move to logic core?
 public class LogicExecuter
 {
-       // TODO replace with LogicModel when it exists
+       // TODO replace with CoreModel when it exists
        private final Timeline timeline;
 
        private final AtomicBoolean shouldBeRunningLive;
index 2b945b1..6a31d47 100644 (file)
@@ -4,8 +4,8 @@ import java.util.function.Consumer;
 
 import net.mograsim.logic.core.timeline.Timeline;
 import net.mograsim.logic.model.model.ViewModelModifiable;
-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;
 
 public class SimpleLogicUIStandalone
 {
@@ -16,26 +16,26 @@ public class SimpleLogicUIStandalone
 
        public static void executeVisualisation(Consumer<ViewModelModifiable> setupViewModel, Consumer<VisualisationObjects> beforeRun)
        {
-               LogicModelParameters params = new LogicModelParameters();
+               CoreModelParameters params = new CoreModelParameters();
                params.gateProcessTime = 50;
                params.wireTravelTime = 10;
                executeVisualisation(setupViewModel, params, beforeRun);
        }
 
-       public static void executeVisualisation(Consumer<ViewModelModifiable> setupViewModel, LogicModelParameters params)
+       public static void executeVisualisation(Consumer<ViewModelModifiable> setupViewModel, CoreModelParameters params)
        {
                executeVisualisation(setupViewModel, params, null);
        }
 
-       public static void executeVisualisation(Consumer<ViewModelModifiable> setupViewModel, LogicModelParameters params,
+       public static void executeVisualisation(Consumer<ViewModelModifiable> setupViewModel, CoreModelParameters params,
                        Consumer<VisualisationObjects> beforeRun)
        {
                // setup view model
                ViewModelModifiable viewModel = new ViewModelModifiable();
                setupViewModel.accept(viewModel);
 
-               // convert to logic model
-               Timeline timeline = ViewLogicModelAdapter.convert(viewModel, params);
+               // convert to core model
+               Timeline timeline = LogicCoreAdapter.convert(viewModel, params);
 
                // initialize UI and executer
                LogicUIStandaloneGUI ui = new LogicUIStandaloneGUI(viewModel);
index 3707a78..820991b 100644 (file)
@@ -2,7 +2,7 @@ package net.mograsim.logic.model.model.components.atomic;
 
 import net.mograsim.logic.core.components.gates.CoreAndGate;
 import net.mograsim.logic.model.model.ViewModelModifiable;
-import net.mograsim.logic.model.modeladapter.ViewLogicModelAdapter;
+import net.mograsim.logic.model.modeladapter.LogicCoreAdapter;
 import net.mograsim.logic.model.modeladapter.componentadapters.SimpleGateAdapter;
 import net.mograsim.logic.model.serializing.IndirectModelComponentCreator;
 
@@ -21,7 +21,7 @@ public class ModelAndGate extends SimpleRectangularModelGate
 
        static
        {
-               ViewLogicModelAdapter.addComponentAdapter(new SimpleGateAdapter<>(ModelAndGate.class, CoreAndGate::new));
+               LogicCoreAdapter.addComponentAdapter(new SimpleGateAdapter<>(ModelAndGate.class, CoreAndGate::new));
                IndirectModelComponentCreator.setComponentSupplier(ModelAndGate.class.getCanonicalName(),
                                (m, p, n) -> new ModelAndGate(m, p.getAsInt(), n));
        }
index b0a97b4..fbcaf64 100644 (file)
@@ -13,7 +13,7 @@ import net.mograsim.logic.model.model.ViewModelModifiable;
 import net.mograsim.logic.model.model.components.ModelComponent;
 import net.mograsim.logic.model.model.wires.Pin;
 import net.mograsim.logic.model.model.wires.PinUsage;
-import net.mograsim.logic.model.modeladapter.ViewLogicModelAdapter;
+import net.mograsim.logic.model.modeladapter.LogicCoreAdapter;
 import net.mograsim.logic.model.modeladapter.componentadapters.BitDisplayAdapter;
 import net.mograsim.logic.model.serializing.IdentifyParams;
 import net.mograsim.logic.model.serializing.IndirectModelComponentCreator;
@@ -66,7 +66,7 @@ public class ModelBitDisplay extends ModelComponent
                gc.setFont(oldFont);
        }
 
-       public void setLogicModelBinding(CoreBitDisplay bitDisplay)
+       public void setCoreModelBinding(CoreBitDisplay bitDisplay)
        {
                if (this.bitDisplay != null)
                        this.bitDisplay.deregisterObserver(logicObs);
@@ -75,7 +75,7 @@ public class ModelBitDisplay extends ModelComponent
                        bitDisplay.registerObserver(logicObs);
        }
 
-       public boolean hasLogicModelBinding()
+       public boolean hasCoreModelBinding()
        {
                return bitDisplay != null;
        }
@@ -104,7 +104,7 @@ public class ModelBitDisplay extends ModelComponent
 
        static
        {
-               ViewLogicModelAdapter.addComponentAdapter(new BitDisplayAdapter());
+               LogicCoreAdapter.addComponentAdapter(new BitDisplayAdapter());
                IndirectModelComponentCreator.setComponentSupplier(ModelBitDisplay.class.getCanonicalName(),
                                (m, p, n) -> new ModelBitDisplay(m, p.getAsInt(), n));
        }
index 2755ac1..e26e3ff 100644 (file)
@@ -16,7 +16,7 @@ import net.mograsim.logic.model.model.components.Orientation;
 import net.mograsim.logic.model.model.components.OrientationCalculator;
 import net.mograsim.logic.model.model.wires.Pin;
 import net.mograsim.logic.model.model.wires.PinUsage;
-import net.mograsim.logic.model.modeladapter.ViewLogicModelAdapter;
+import net.mograsim.logic.model.modeladapter.LogicCoreAdapter;
 import net.mograsim.logic.model.modeladapter.componentadapters.ClockAdapter;
 import net.mograsim.logic.model.serializing.IdentifyParams;
 import net.mograsim.logic.model.serializing.IndirectModelComponentCreator;
@@ -73,7 +73,7 @@ public class ModelClock extends ModelComponent
                gc.setFont(oldFont);
        }
 
-       public void setLogicModelBinding(CoreClock clock)
+       public void setCoreModelBinding(CoreClock clock)
        {
                if (this.clock != null)
                        this.clock.deregisterObserver(logicObs);
@@ -82,7 +82,7 @@ public class ModelClock extends ModelComponent
                        clock.registerObserver(logicObs);
        }
 
-       public boolean hasLogicModelBinding()
+       public boolean hasCoreModelBinding()
        {
                return clock != null;
        }
@@ -142,7 +142,7 @@ public class ModelClock extends ModelComponent
 
        static
        {
-               ViewLogicModelAdapter.addComponentAdapter(new ClockAdapter());
+               LogicCoreAdapter.addComponentAdapter(new ClockAdapter());
                IndirectModelComponentCreator.setComponentSupplier(ModelClock.class.getName(), (m, p, n) ->
                {
                        ModelClockParams params = JsonHandler.fromJsonTree(p, ModelClockParams.class);
index b052ded..2bdd36e 100644 (file)
@@ -14,7 +14,7 @@ import net.mograsim.logic.model.model.ViewModelModifiable;
 import net.mograsim.logic.model.model.components.ModelComponent;
 import net.mograsim.logic.model.model.wires.Pin;
 import net.mograsim.logic.model.model.wires.PinUsage;
-import net.mograsim.logic.model.modeladapter.ViewLogicModelAdapter;
+import net.mograsim.logic.model.modeladapter.LogicCoreAdapter;
 import net.mograsim.logic.model.modeladapter.componentadapters.FixedOutputAdapter;
 import net.mograsim.logic.model.serializing.IdentifyParams;
 import net.mograsim.logic.model.serializing.IndirectModelComponentCreator;
@@ -70,7 +70,7 @@ public class ModelFixedOutput extends ModelComponent
 
        static
        {
-               ViewLogicModelAdapter.addComponentAdapter(new FixedOutputAdapter());
+               LogicCoreAdapter.addComponentAdapter(new FixedOutputAdapter());
                IndirectModelComponentCreator.setComponentSupplier(ModelFixedOutput.class.getCanonicalName(),
                                (m, p, n) -> new ModelFixedOutput(m, Objects.requireNonNull(JsonHandler.fromJsonTree(p, BitVector.class)), n));
        }
index d0a0b15..b7053d3 100644 (file)
@@ -15,7 +15,7 @@ import net.mograsim.logic.model.model.ViewModelModifiable;
 import net.mograsim.logic.model.model.components.ModelComponent;
 import net.mograsim.logic.model.model.wires.Pin;
 import net.mograsim.logic.model.model.wires.PinUsage;
-import net.mograsim.logic.model.modeladapter.ViewLogicModelAdapter;
+import net.mograsim.logic.model.modeladapter.LogicCoreAdapter;
 import net.mograsim.logic.model.modeladapter.componentadapters.ManualSwitchAdapter;
 import net.mograsim.logic.model.serializing.IdentifyParams;
 import net.mograsim.logic.model.serializing.IndirectModelComponentCreator;
@@ -32,7 +32,7 @@ public class ModelManualSwitch extends ModelComponent
        private final Pin outputPin;
 
        private final LogicObserver logicObs;
-       private CoreManualSwitch logicSwitch;
+       private CoreManualSwitch manualSwitch;
 
        public ModelManualSwitch(ViewModelModifiable model, int logicWidth)
        {
@@ -56,7 +56,7 @@ public class ModelManualSwitch extends ModelComponent
                if (foreground != null)
                        gc.setForeground(foreground);
                gc.drawRectangle(getBounds());
-               String label = BitVectorFormatter.formatAsString(logicSwitch == null ? null : logicSwitch.getValues());
+               String label = BitVectorFormatter.formatAsString(manualSwitch == null ? null : manualSwitch.getValues());
                Font oldFont = gc.getFont();
                Font labelFont = new Font(oldFont.getName(), fontHeight, oldFont.getStyle());
                gc.setFont(labelFont);
@@ -67,14 +67,14 @@ public class ModelManualSwitch extends ModelComponent
                gc.drawText(label, getPosX() + (width - textExtent.x) / 2, getPosY() + (height - textExtent.y) / 2, true);
                gc.setFont(oldFont);
 
-               if (logicSwitch != null && logicWidth > 1 && heightMiniButtons > 0 && visibleRegion.y < getPosY() + heightMiniButtons)
+               if (manualSwitch != null && logicWidth > 1 && heightMiniButtons > 0 && visibleRegion.y < getPosY() + heightMiniButtons)
                {
                        double x = getPosX();
                        double y = getPosY();
                        gc.drawLine(x, y + heightMiniButtons, x + width, y + heightMiniButtons);
                        Color c = gc.getBackground();
                        gc.setBackground(gc.getForeground());
-                       BitVector bv = logicSwitch.getValues();
+                       BitVector bv = manualSwitch.getValues();
                        double part = width / bv.length();
                        for (int i = 0; i < bv.length(); i++)
                        {
@@ -92,18 +92,18 @@ public class ModelManualSwitch extends ModelComponent
                }
        }
 
-       public void setLogicModelBinding(CoreManualSwitch logicSwitch)
+       public void setCoreModelBinding(CoreManualSwitch logicSwitch)
        {
-               if (this.logicSwitch != null)
-                       this.logicSwitch.deregisterObserver(logicObs);
-               this.logicSwitch = logicSwitch;
+               if (this.manualSwitch != null)
+                       this.manualSwitch.deregisterObserver(logicObs);
+               this.manualSwitch = logicSwitch;
                if (logicSwitch != null)
                        logicSwitch.registerObserver(logicObs);
        }
 
-       public boolean hasLogicModelBinding()
+       public boolean hasCoreModelBinding()
        {
-               return logicSwitch != null;
+               return manualSwitch != null;
        }
 
        @Override
@@ -112,8 +112,8 @@ public class ModelManualSwitch extends ModelComponent
                switch (stateID)
                {
                case "out":
-                       if (logicSwitch != null)
-                               return logicSwitch.getValues();
+                       if (manualSwitch != null)
+                               return manualSwitch.getValues();
                        return null;
                default:
                        return super.getHighLevelState(stateID);
@@ -126,8 +126,8 @@ public class ModelManualSwitch extends ModelComponent
                switch (stateID)
                {
                case "out":
-                       if (logicSwitch != null)
-                               logicSwitch.setState((BitVector) newState);
+                       if (manualSwitch != null)
+                               manualSwitch.setState((BitVector) newState);
                        break;
                default:
                        super.setHighLevelState(stateID, newState);
@@ -138,15 +138,15 @@ public class ModelManualSwitch extends ModelComponent
        @Override
        public boolean clicked(double x, double y)
        {
-               if (logicSwitch != null)
+               if (manualSwitch != null)
                {
                        if (heightMiniButtons > 0 && y - getPosY() < heightMiniButtons)
                        {
                                int part = (int) ((x - getPosX()) * logicWidth / width);
-                               logicSwitch.setState(logicSwitch.getValues().withBitChanged(part, Bit::not));
+                               manualSwitch.setState(manualSwitch.getValues().withBitChanged(part, Bit::not));
                        } else
                        {
-                               logicSwitch.toggle();
+                               manualSwitch.toggle();
                        }
                }
                return true;
@@ -154,7 +154,7 @@ public class ModelManualSwitch extends ModelComponent
 
        public CoreManualSwitch getManualSwitch()
        {
-               return logicSwitch;
+               return manualSwitch;
        }
 
        public Pin getOutputPin()
@@ -176,7 +176,7 @@ public class ModelManualSwitch extends ModelComponent
 
        static
        {
-               ViewLogicModelAdapter.addComponentAdapter(new ManualSwitchAdapter());
+               LogicCoreAdapter.addComponentAdapter(new ManualSwitchAdapter());
                IndirectModelComponentCreator.setComponentSupplier(ModelManualSwitch.class.getName(),
                                (m, p, n) -> new ModelManualSwitch(m, p.getAsInt(), n));
        }
index c2856e1..79ea13e 100644 (file)
@@ -10,7 +10,7 @@ import net.mograsim.logic.model.model.ViewModelModifiable;
 import net.mograsim.logic.model.model.components.ModelComponent;
 import net.mograsim.logic.model.model.wires.Pin;
 import net.mograsim.logic.model.model.wires.PinUsage;
-import net.mograsim.logic.model.modeladapter.ViewLogicModelAdapter;
+import net.mograsim.logic.model.modeladapter.LogicCoreAdapter;
 import net.mograsim.logic.model.modeladapter.componentadapters.MergerAdapter;
 import net.mograsim.logic.model.serializing.IdentifyParams;
 import net.mograsim.logic.model.serializing.IndirectModelComponentCreator;
@@ -91,7 +91,7 @@ public class ModelMerger extends ModelComponent
                return logicWidth;
        }
 
-       public void setLogicModelBinding(ReadEnd[] inputEnds, ReadEnd outputEnd)
+       public void setCoreModelBinding(ReadEnd[] inputEnds, ReadEnd outputEnd)
        {
                System.arraycopy(inputEnds, 0, this.inputEnds, 0, logicWidth);
                this.outputEnd = outputEnd;
@@ -104,7 +104,7 @@ public class ModelMerger extends ModelComponent
 
        static
        {
-               ViewLogicModelAdapter.addComponentAdapter(new MergerAdapter());
+               LogicCoreAdapter.addComponentAdapter(new MergerAdapter());
                IndirectModelComponentCreator.setComponentSupplier(ModelMerger.class.getCanonicalName(),
                                (m, p, n) -> new ModelMerger(m, p.getAsInt(), n));
        }
index f2acc94..fa584d6 100644 (file)
@@ -2,7 +2,7 @@ package net.mograsim.logic.model.model.components.atomic;
 
 import net.mograsim.logic.core.components.gates.CoreNandGate;
 import net.mograsim.logic.model.model.ViewModelModifiable;
-import net.mograsim.logic.model.modeladapter.ViewLogicModelAdapter;
+import net.mograsim.logic.model.modeladapter.LogicCoreAdapter;
 import net.mograsim.logic.model.modeladapter.componentadapters.SimpleGateAdapter;
 import net.mograsim.logic.model.serializing.IndirectModelComponentCreator;
 
@@ -21,7 +21,7 @@ public class ModelNandGate extends SimpleRectangularModelGate
 
        static
        {
-               ViewLogicModelAdapter.addComponentAdapter(new SimpleGateAdapter<>(ModelNandGate.class, CoreNandGate::new));
+               LogicCoreAdapter.addComponentAdapter(new SimpleGateAdapter<>(ModelNandGate.class, CoreNandGate::new));
                IndirectModelComponentCreator.setComponentSupplier(ModelNandGate.class.getCanonicalName(),
                                (m, p, n) -> new ModelNandGate(m, p.getAsInt(), n));
        }
index 0262c8f..a24bbc0 100644 (file)
@@ -2,7 +2,7 @@ package net.mograsim.logic.model.model.components.atomic;
 
 import net.mograsim.logic.core.components.gates.CoreNotGate;
 import net.mograsim.logic.model.model.ViewModelModifiable;
-import net.mograsim.logic.model.modeladapter.ViewLogicModelAdapter;
+import net.mograsim.logic.model.modeladapter.LogicCoreAdapter;
 import net.mograsim.logic.model.modeladapter.componentadapters.SimpleGateAdapter;
 import net.mograsim.logic.model.serializing.IndirectModelComponentCreator;
 
@@ -21,7 +21,7 @@ public class ModelNotGate extends SimpleRectangularModelGate
 
        static
        {
-               ViewLogicModelAdapter
+               LogicCoreAdapter
                                .addComponentAdapter(new SimpleGateAdapter<>(ModelNotGate.class, (t, p, o, i) -> new CoreNotGate(t, p, i[0], o)));
                IndirectModelComponentCreator.setComponentSupplier(ModelNotGate.class.getCanonicalName(),
                                (m, p, n) -> new ModelNotGate(m, p.getAsInt(), n));
index de0aa7f..2a80d64 100644 (file)
@@ -2,7 +2,7 @@ package net.mograsim.logic.model.model.components.atomic;
 
 import net.mograsim.logic.core.components.gates.CoreOrGate;
 import net.mograsim.logic.model.model.ViewModelModifiable;
-import net.mograsim.logic.model.modeladapter.ViewLogicModelAdapter;
+import net.mograsim.logic.model.modeladapter.LogicCoreAdapter;
 import net.mograsim.logic.model.modeladapter.componentadapters.SimpleGateAdapter;
 import net.mograsim.logic.model.serializing.IndirectModelComponentCreator;
 
@@ -21,7 +21,7 @@ public class ModelOrGate extends SimpleRectangularModelGate
 
        static
        {
-               ViewLogicModelAdapter.addComponentAdapter(new SimpleGateAdapter<>(ModelOrGate.class, CoreOrGate::new));
+               LogicCoreAdapter.addComponentAdapter(new SimpleGateAdapter<>(ModelOrGate.class, CoreOrGate::new));
                IndirectModelComponentCreator.setComponentSupplier(ModelOrGate.class.getCanonicalName(),
                                (m, p, n) -> new ModelOrGate(m, p.getAsInt(), n));
        }
index 2f7a98d..1bf22b0 100644 (file)
@@ -10,7 +10,7 @@ import net.mograsim.logic.model.model.ViewModelModifiable;
 import net.mograsim.logic.model.model.components.ModelComponent;
 import net.mograsim.logic.model.model.wires.Pin;
 import net.mograsim.logic.model.model.wires.PinUsage;
-import net.mograsim.logic.model.modeladapter.ViewLogicModelAdapter;
+import net.mograsim.logic.model.modeladapter.LogicCoreAdapter;
 import net.mograsim.logic.model.modeladapter.componentadapters.SplitterAdapter;
 import net.mograsim.logic.model.serializing.IdentifyParams;
 import net.mograsim.logic.model.serializing.IndirectModelComponentCreator;
@@ -91,7 +91,7 @@ public class ModelSplitter extends ModelComponent
                return logicWidth;
        }
 
-       public void setLogicModelBinding(ReadEnd inputEnd, ReadEnd[] outputEnds)
+       public void setCoreModelBinding(ReadEnd inputEnd, ReadEnd[] outputEnds)
        {
                this.inputEnd = inputEnd;
                System.arraycopy(outputEnds, 0, this.outputEnds, 0, logicWidth);
@@ -104,7 +104,7 @@ public class ModelSplitter extends ModelComponent
 
        static
        {
-               ViewLogicModelAdapter.addComponentAdapter(new SplitterAdapter());
+               LogicCoreAdapter.addComponentAdapter(new SplitterAdapter());
                IndirectModelComponentCreator.setComponentSupplier(ModelSplitter.class.getCanonicalName(),
                                (m, p, n) -> new ModelSplitter(m, p.getAsInt(), n));
        }
index 628cb13..d45bfa8 100644 (file)
@@ -7,7 +7,7 @@ import net.haspamelodica.swt.helper.swtobjectwrappers.Point;
 import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle;
 import net.mograsim.logic.model.model.ViewModelModifiable;
 import net.mograsim.logic.model.model.components.ModelComponent;
-import net.mograsim.logic.model.modeladapter.ViewLogicModelAdapter;
+import net.mograsim.logic.model.modeladapter.LogicCoreAdapter;
 import net.mograsim.logic.model.modeladapter.componentadapters.NoLogicAdapter;
 import net.mograsim.logic.model.serializing.IdentifyParams;
 import net.mograsim.logic.model.serializing.IndirectModelComponentCreator;
@@ -65,7 +65,7 @@ public class ModelTextComponent extends ModelComponent
 
        static
        {
-               ViewLogicModelAdapter.addComponentAdapter(new NoLogicAdapter<>(ModelTextComponent.class));
+               LogicCoreAdapter.addComponentAdapter(new NoLogicAdapter<>(ModelTextComponent.class));
                IndirectModelComponentCreator.setComponentSupplier(ModelTextComponent.class.getName(),
                                (m, p, n) -> new ModelTextComponent(m, p.getAsString(), n));
        }
index 04f7cae..733d4b6 100644 (file)
@@ -12,7 +12,7 @@ import net.mograsim.logic.model.model.components.Orientation;
 import net.mograsim.logic.model.model.components.OrientationCalculator;
 import net.mograsim.logic.model.model.wires.Pin;
 import net.mograsim.logic.model.model.wires.PinUsage;
-import net.mograsim.logic.model.modeladapter.ViewLogicModelAdapter;
+import net.mograsim.logic.model.modeladapter.LogicCoreAdapter;
 import net.mograsim.logic.model.modeladapter.componentadapters.TriStateBufferAdapter;
 import net.mograsim.logic.model.serializing.IdentifyParams;
 import net.mograsim.logic.model.serializing.IndirectModelComponentCreator;
@@ -100,7 +100,7 @@ public class ModelTriStateBuffer extends ModelComponent
 
        static
        {
-               ViewLogicModelAdapter.addComponentAdapter(new TriStateBufferAdapter());
+               LogicCoreAdapter.addComponentAdapter(new TriStateBufferAdapter());
                IndirectModelComponentCreator.setComponentSupplier(ModelTriStateBuffer.class.getName(), (m, p, n) ->
                {
                        ModelTriStateBufferParams params = JsonHandler.fromJsonTree(p, ModelTriStateBufferParams.class);
index cad271c..4314a43 100644 (file)
@@ -10,7 +10,7 @@ import net.mograsim.logic.core.wires.CoreWire.ReadWriteEnd;
 import net.mograsim.logic.model.model.ViewModelModifiable;
 import net.mograsim.logic.model.model.components.ModelComponent;
 import net.mograsim.logic.model.model.wires.Pin;
-import net.mograsim.logic.model.modeladapter.ViewLogicModelAdapter;
+import net.mograsim.logic.model.modeladapter.LogicCoreAdapter;
 import net.mograsim.logic.model.modeladapter.componentadapters.SimpleRectangularHardcodedModelComponentAdapter;
 import net.mograsim.logic.model.serializing.IdentifyParams;
 import net.mograsim.logic.model.snippets.HighLevelStateHandler;
@@ -112,9 +112,9 @@ public abstract class SimpleRectangularHardcodedModelComponent extends ModelComp
 
        public abstract Object recalculate(Object lastState, Map<String, ReadEnd> readEnds, Map<String, ReadWriteEnd> readWriteEnds);
 
-       // logic model binding
+       // core model binding
 
-       public void setLogicModelBindingAndResetState(AtomicReference<Object> state, Runnable recalculate)
+       public void setCoreModelBindingAndResetState(AtomicReference<Object> state, Runnable recalculate)
        {
                this.state = state;
                this.recalculate = recalculate;
@@ -148,6 +148,6 @@ public abstract class SimpleRectangularHardcodedModelComponent extends ModelComp
 
        static
        {
-               ViewLogicModelAdapter.addComponentAdapter(new SimpleRectangularHardcodedModelComponentAdapter());
+               LogicCoreAdapter.addComponentAdapter(new SimpleRectangularHardcodedModelComponentAdapter());
        }
 }
\ No newline at end of file
index 1d7c9a4..8283749 100644 (file)
@@ -36,7 +36,7 @@ public class ModelWire
         */
        public final String name;
        /**
-        * The logical width of this wire. Is equal to the logical with of {@link #pin1} and {@link #pin2}.
+        * The logical width of this wire. Is equal to the logical width of {@link #pin1} and {@link #pin2}.
         */
        public final int logicWidth;
        /**
@@ -65,11 +65,11 @@ public class ModelWire
        private final List<Consumer<ModelWire>> pathChangedListeners;
 
        /**
-        * A LogicObserver calling redrawListeners. Used for logic model bindings.
+        * A LogicObserver calling redrawListeners. Used for core model bindings.
         */
        private final LogicObserver logicObs;
        /**
-        * A ReadEnd of the logic wire this model wire currently is bound to.
+        * A ReadEnd of the core wire this model wire currently is bound to.
         */
        private ReadEnd end;
 
@@ -463,7 +463,7 @@ public class ModelWire
                return new Point(p.x, p.y);
        }
 
-       // logic model binding
+       // core model binding
 
        /**
         * Binds this {@link ModelWire} to the given {@link ReadEnd}: The color of this {@link ModelWire} will now depend on the state of the
@@ -472,7 +472,7 @@ public class ModelWire
         * 
         * @author Daniel Kirschten
         */
-       public void setLogicModelBinding(ReadEnd end)
+       public void setCoreModelBinding(ReadEnd end)
        {
                if (this.end != null)
                        this.end.deregisterObserver(logicObs);
@@ -482,17 +482,17 @@ public class ModelWire
        }
 
        /**
-        * Returns whether this {@link ModelWire} has a logic model binding or not.
+        * Returns whether this {@link ModelWire} has a core model binding or not.
         * 
         * @author Daniel Kirschten
         */
-       public boolean hasLogicModelBinding()
+       public boolean hasCoreModelBinding()
        {
                return end != null;
        }
 
        /**
-        * If this {@link ModelWire} has a logic model binding, delegates to {@link CoreWire#forceValues(BitVector)} for the {@link CoreWire}
+        * If this {@link ModelWire} has a core model binding, delegates to {@link CoreWire#forceValues(BitVector)} for the {@link CoreWire}
         * corresponding to this {@link ModelWire}.
         * 
         * @author Daniel Kirschten
@@ -503,8 +503,8 @@ public class ModelWire
        }
 
        /**
-        * If this {@link ModelWire} has a logic model binding, delegates to {@link ReadEnd#getValues()} for the {@link ReadEnd} corresponding
-        * to this {@link ModelWire}.
+        * If this {@link ModelWire} has a core model binding, delegates to {@link ReadEnd#getValues()} for the {@link ReadEnd} corresponding to
+        * this {@link ModelWire}.
         * 
         * @author Daniel Kirschten
         */
index f8d32ac..28181b2 100644 (file)
@@ -89,7 +89,7 @@ public class ModelWireCrossPoint extends ModelComponent
                gc.fillOval(getPosX(), getPosY(), CIRCLE_DIAM, CIRCLE_DIAM);
        }
 
-       // logic model binding
+       // core model binding
 
        /**
         * Binds this {@link ModelWireCrossPoint} to the given {@link ReadEnd}: The color of this {@link ModelWireCrossPoint} will now depend on
@@ -99,7 +99,7 @@ public class ModelWireCrossPoint extends ModelComponent
         * 
         * @author Daniel Kirschten
         */
-       public void setLogicModelBinding(ReadEnd end)
+       public void setCoreModelBinding(ReadEnd end)
        {
                if (this.end != null)
                        this.end.deregisterObserver(logicObs);
@@ -109,9 +109,9 @@ public class ModelWireCrossPoint extends ModelComponent
        }
 
        /**
-        * Returns whether this {@link ModelWireCrossPoint} has a logic model binding or not.
+        * Returns whether this {@link ModelWireCrossPoint} has a core model binding or not.
         */
-       public boolean hasLogicModelBinding()
+       public boolean hasCoreModelBinding()
        {
                return end != null;
        }
diff --git a/net.mograsim.logic.model/src/net/mograsim/logic/model/modeladapter/CoreModelParameters.java b/net.mograsim.logic.model/src/net/mograsim/logic/model/modeladapter/CoreModelParameters.java
new file mode 100644 (file)
index 0000000..db3b5ac
--- /dev/null
@@ -0,0 +1,7 @@
+package net.mograsim.logic.model.modeladapter;
+
+public class CoreModelParameters
+{
+       public int wireTravelTime;
+       public int gateProcessTime;
+}
\ No newline at end of file
diff --git a/net.mograsim.logic.model/src/net/mograsim/logic/model/modeladapter/LogicCoreAdapter.java b/net.mograsim.logic.model/src/net/mograsim/logic/model/modeladapter/LogicCoreAdapter.java
new file mode 100644 (file)
index 0000000..397f913
--- /dev/null
@@ -0,0 +1,165 @@
+package net.mograsim.logic.model.modeladapter;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+import net.mograsim.logic.core.timeline.Timeline;
+import net.mograsim.logic.core.wires.CoreWire;
+import net.mograsim.logic.core.wires.CoreWire.ReadEnd;
+import net.mograsim.logic.model.model.ViewModel;
+import net.mograsim.logic.model.model.components.ModelComponent;
+import net.mograsim.logic.model.model.components.submodels.SubmodelComponent;
+import net.mograsim.logic.model.model.components.submodels.SubmodelInterface;
+import net.mograsim.logic.model.model.wires.ModelWire;
+import net.mograsim.logic.model.model.wires.Pin;
+import net.mograsim.logic.model.model.wires.ModelWireCrossPoint;
+import net.mograsim.logic.model.modeladapter.componentadapters.ComponentAdapter;
+
+public class LogicCoreAdapter
+{
+       private final static Map<Class<? extends ModelComponent>, ComponentAdapter<? extends ModelComponent>> componentAdapters = new HashMap<>();
+
+       public static void addComponentAdapter(ComponentAdapter<? extends ModelComponent> componentAdapter)
+       {
+               componentAdapters.put(componentAdapter.getSupportedClass(), componentAdapter);
+       }
+
+       public static Timeline convert(ViewModel viewModel, CoreModelParameters params)
+       {
+               // TODO replace Timeline with CoreModel as soon as it exists
+               Timeline timeline = new Timeline(10);
+
+               convert(viewModel, params, timeline, Map.of());
+
+               return timeline;
+       }
+
+       private static void convert(ViewModel viewModel, CoreModelParameters params, Timeline timeline, Map<Pin, CoreWire> externalWires)
+       {
+               Map<Pin, CoreWire> logicWiresPerPin = convertWires(getAllPins(viewModel), viewModel.getWiresByName().values(), externalWires,
+                               params, timeline);
+               Map<Pin, CoreWire> logicWiresPerPinUnmodifiable = Collections.unmodifiableMap(logicWiresPerPin);
+
+               for (ModelComponent modelComp : viewModel.getComponentsByName().values())
+               {
+                       if (modelComp instanceof SubmodelComponent)
+                       {
+                               SubmodelComponent modelCompCasted = (SubmodelComponent) modelComp;
+                               Map<String, Pin> supermodelPins = modelCompCasted.getSupermodelPins();
+                               Map<Pin, CoreWire> externalWiresForSubmodel = supermodelPins.entrySet().stream().collect(
+                                               Collectors.toMap(e -> modelCompCasted.getSubmodelPin(e.getKey()), e -> logicWiresPerPin.get(e.getValue())));
+                               convert(modelCompCasted.submodel, params, timeline, externalWiresForSubmodel);
+                       } else if (modelComp instanceof ModelWireCrossPoint)
+                       {
+                               ModelWireCrossPoint modelCompCasted = (ModelWireCrossPoint) modelComp;
+                               modelCompCasted.setCoreModelBinding(logicWiresPerPin.get(modelCompCasted.getPin()).createReadOnlyEnd());
+                       } else if (!(modelComp instanceof SubmodelInterface))// nothing to do for SubmodelInterfaces
+                               createAndLinkComponent(timeline, params, modelComp, logicWiresPerPinUnmodifiable);
+               }
+       }
+
+       private static Set<Pin> getAllPins(ViewModel viewModel)
+       {
+               return viewModel.getComponentsByName().values().stream().flatMap(component -> component.getPins().values().stream())
+                               .collect(Collectors.toSet());
+       }
+
+       private static Map<Pin, CoreWire> convertWires(Set<Pin> allPins, Collection<ModelWire> wires, Map<Pin, CoreWire> externalWires,
+                       CoreModelParameters params, Timeline timeline)
+       {
+               Map<Pin, Set<Pin>> connectedPinGroups = getConnectedPinGroups(allPins, wires);
+               Map<Pin, CoreWire> logicWiresPerPin = createLogicWires(params, timeline, connectedPinGroups, externalWires);
+               setModelWiresCoreModelBinding(wires, logicWiresPerPin);
+               return logicWiresPerPin;
+       }
+
+       private static Map<Pin, CoreWire> createLogicWires(CoreModelParameters params, Timeline timeline, Map<Pin, Set<Pin>> connectedPinGroups,
+                       Map<Pin, CoreWire> externalWires)
+       {
+               Map<Pin, CoreWire> logicWiresPerPin = new HashMap<>();
+               Map<Set<Pin>, CoreWire> logicWiresPerPinGroup = new HashMap<>();
+               for (Entry<Pin, Set<Pin>> e : connectedPinGroups.entrySet())
+                       logicWiresPerPin.put(e.getKey(), logicWiresPerPinGroup.computeIfAbsent(e.getValue(), set ->
+                       {
+                               CoreWire externalWire = null;
+                               for (Pin p : set)
+                               {
+                                       CoreWire externalWireCandidate = externalWires.get(p);
+                                       if (externalWireCandidate != null)
+                                               if (externalWire == null)
+                                                       externalWire = externalWireCandidate;
+                                               else if (externalWire.width == externalWireCandidate.width)
+                                                       CoreWire.fuse(externalWire, externalWireCandidate);
+                                               else
+                                                       throw new IllegalArgumentException(
+                                                                       "Two pins to external wires with different logicWidths can't be connected directly");
+                               }
+                               return externalWire == null ? new CoreWire(timeline, e.getKey().logicWidth, params.wireTravelTime) : externalWire;
+                       }));
+               return logicWiresPerPin;
+       }
+
+       private static void setModelWiresCoreModelBinding(Collection<ModelWire> wires, Map<Pin, CoreWire> logicWiresPerPin)
+       {
+               Map<CoreWire, ReadEnd> modelWireSharedReadEnd = logicWiresPerPin.values().stream().distinct()
+                               .collect(Collectors.toMap(Function.identity(), CoreWire::createReadOnlyEnd));
+               for (ModelWire modelWire : wires)
+                       modelWire.setCoreModelBinding(modelWireSharedReadEnd.get(logicWiresPerPin.get(modelWire.getPin1())));
+       }
+
+       private static Map<Pin, Set<Pin>> getConnectedPinGroups(Set<Pin> allPins, Collection<ModelWire> wires)
+       {
+               Map<Pin, Set<Pin>> connectedPinsPerPin = new HashMap<>();
+
+               for (Pin p : allPins)
+               {
+                       HashSet<Pin> connectedPins = new HashSet<>();
+                       connectedPins.add(p);
+                       connectedPinsPerPin.put(p, connectedPins);
+               }
+
+               wires.forEach(wire ->
+               {
+                       Pin pin1 = wire.getPin1();
+                       Pin pin2 = wire.getPin2();
+
+                       Set<Pin> pin1ConnectedPins = connectedPinsPerPin.get(pin1);
+                       Set<Pin> pin2ConnectedPins = connectedPinsPerPin.get(pin2);
+
+                       pin1ConnectedPins.addAll(pin2ConnectedPins);
+                       pin1ConnectedPins.add(pin1);
+                       pin1ConnectedPins.add(pin2);
+
+                       pin2ConnectedPins.forEach(pin -> connectedPinsPerPin.put(pin, pin1ConnectedPins));
+               });
+               return connectedPinsPerPin;
+       }
+
+       @SuppressWarnings("unchecked")
+       private static <G extends ModelComponent> void createAndLinkComponent(Timeline timeline, CoreModelParameters params,
+                       ModelComponent modelComponent, Map<Pin, CoreWire> logicWiresPerPin)
+       {
+               Class<?> cls = modelComponent.getClass();
+               ComponentAdapter<? super G> adapter = null;
+               while (cls != ModelComponent.class && adapter == null)
+               {
+                       adapter = (ComponentAdapter<? super G>) componentAdapters.get(cls);
+                       cls = cls.getSuperclass();
+               }
+               if (adapter == null)
+                       throw new IllegalArgumentException("Unknown component class: " + modelComponent.getClass());
+               adapter.createAndLinkComponent(timeline, params, (G) modelComponent, logicWiresPerPin);
+       }
+
+       private LogicCoreAdapter()
+       {
+               throw new UnsupportedOperationException("No LogicCoreAdapter instances");
+       }
+}
\ No newline at end of file
diff --git a/net.mograsim.logic.model/src/net/mograsim/logic/model/modeladapter/LogicModelParameters.java b/net.mograsim.logic.model/src/net/mograsim/logic/model/modeladapter/LogicModelParameters.java
deleted file mode 100644 (file)
index 1d83c5f..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-package net.mograsim.logic.model.modeladapter;
-
-public class LogicModelParameters
-{
-       public int wireTravelTime;
-       public int gateProcessTime;
-}
\ No newline at end of file
diff --git a/net.mograsim.logic.model/src/net/mograsim/logic/model/modeladapter/ViewLogicModelAdapter.java b/net.mograsim.logic.model/src/net/mograsim/logic/model/modeladapter/ViewLogicModelAdapter.java
deleted file mode 100644 (file)
index ffeff19..0000000
+++ /dev/null
@@ -1,165 +0,0 @@
-package net.mograsim.logic.model.modeladapter;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.function.Function;
-import java.util.stream.Collectors;
-
-import net.mograsim.logic.core.timeline.Timeline;
-import net.mograsim.logic.core.wires.CoreWire;
-import net.mograsim.logic.core.wires.CoreWire.ReadEnd;
-import net.mograsim.logic.model.model.ViewModel;
-import net.mograsim.logic.model.model.components.ModelComponent;
-import net.mograsim.logic.model.model.components.submodels.SubmodelComponent;
-import net.mograsim.logic.model.model.components.submodels.SubmodelInterface;
-import net.mograsim.logic.model.model.wires.ModelWire;
-import net.mograsim.logic.model.model.wires.Pin;
-import net.mograsim.logic.model.model.wires.ModelWireCrossPoint;
-import net.mograsim.logic.model.modeladapter.componentadapters.ComponentAdapter;
-
-public class ViewLogicModelAdapter
-{
-       private final static Map<Class<? extends ModelComponent>, ComponentAdapter<? extends ModelComponent>> componentAdapters = new HashMap<>();
-
-       public static void addComponentAdapter(ComponentAdapter<? extends ModelComponent> componentAdapter)
-       {
-               componentAdapters.put(componentAdapter.getSupportedClass(), componentAdapter);
-       }
-
-       public static Timeline convert(ViewModel viewModel, LogicModelParameters params)
-       {
-               // TODO replace Timeline with LogicModel as soon as it exists
-               Timeline timeline = new Timeline(10);
-
-               convert(viewModel, params, timeline, Map.of());
-
-               return timeline;
-       }
-
-       private static void convert(ViewModel viewModel, LogicModelParameters params, Timeline timeline, Map<Pin, CoreWire> externalWires)
-       {
-               Map<Pin, CoreWire> logicWiresPerPin = convertWires(getAllPins(viewModel), viewModel.getWiresByName().values(), externalWires,
-                               params, timeline);
-               Map<Pin, CoreWire> logicWiresPerPinUnmodifiable = Collections.unmodifiableMap(logicWiresPerPin);
-
-               for (ModelComponent modelComp : viewModel.getComponentsByName().values())
-               {
-                       if (modelComp instanceof SubmodelComponent)
-                       {
-                               SubmodelComponent modelCompCasted = (SubmodelComponent) modelComp;
-                               Map<String, Pin> supermodelPins = modelCompCasted.getSupermodelPins();
-                               Map<Pin, CoreWire> externalWiresForSubmodel = supermodelPins.entrySet().stream().collect(
-                                               Collectors.toMap(e -> modelCompCasted.getSubmodelPin(e.getKey()), e -> logicWiresPerPin.get(e.getValue())));
-                               convert(modelCompCasted.submodel, params, timeline, externalWiresForSubmodel);
-                       } else if (modelComp instanceof ModelWireCrossPoint)
-                       {
-                               ModelWireCrossPoint modelCompCasted = (ModelWireCrossPoint) modelComp;
-                               modelCompCasted.setLogicModelBinding(logicWiresPerPin.get(modelCompCasted.getPin()).createReadOnlyEnd());
-                       } else if (!(modelComp instanceof SubmodelInterface))// nothing to do for SubmodelInterfaces
-                               createAndLinkComponent(timeline, params, modelComp, logicWiresPerPinUnmodifiable);
-               }
-       }
-
-       private static Set<Pin> getAllPins(ViewModel viewModel)
-       {
-               return viewModel.getComponentsByName().values().stream().flatMap(component -> component.getPins().values().stream())
-                               .collect(Collectors.toSet());
-       }
-
-       private static Map<Pin, CoreWire> convertWires(Set<Pin> allPins, Collection<ModelWire> wires, Map<Pin, CoreWire> externalWires,
-                       LogicModelParameters params, Timeline timeline)
-       {
-               Map<Pin, Set<Pin>> connectedPinGroups = getConnectedPinGroups(allPins, wires);
-               Map<Pin, CoreWire> logicWiresPerPin = createLogicWires(params, timeline, connectedPinGroups, externalWires);
-               setModelWiresLogicModelBinding(wires, logicWiresPerPin);
-               return logicWiresPerPin;
-       }
-
-       private static Map<Pin, CoreWire> createLogicWires(LogicModelParameters params, Timeline timeline,
-                       Map<Pin, Set<Pin>> connectedPinGroups, Map<Pin, CoreWire> externalWires)
-       {
-               Map<Pin, CoreWire> logicWiresPerPin = new HashMap<>();
-               Map<Set<Pin>, CoreWire> logicWiresPerPinGroup = new HashMap<>();
-               for (Entry<Pin, Set<Pin>> e : connectedPinGroups.entrySet())
-                       logicWiresPerPin.put(e.getKey(), logicWiresPerPinGroup.computeIfAbsent(e.getValue(), set ->
-                       {
-                               CoreWire externalWire = null;
-                               for (Pin p : set)
-                               {
-                                       CoreWire externalWireCandidate = externalWires.get(p);
-                                       if (externalWireCandidate != null)
-                                               if (externalWire == null)
-                                                       externalWire = externalWireCandidate;
-                                               else if (externalWire.width == externalWireCandidate.width)
-                                                       CoreWire.fuse(externalWire, externalWireCandidate);
-                                               else
-                                                       throw new IllegalArgumentException(
-                                                                       "Two pins to external wires with different logicWidths can't be connected directly");
-                               }
-                               return externalWire == null ? new CoreWire(timeline, e.getKey().logicWidth, params.wireTravelTime) : externalWire;
-                       }));
-               return logicWiresPerPin;
-       }
-
-       private static void setModelWiresLogicModelBinding(Collection<ModelWire> wires, Map<Pin, CoreWire> logicWiresPerPin)
-       {
-               Map<CoreWire, ReadEnd> modelWireSharedReadEnd = logicWiresPerPin.values().stream().distinct()
-                               .collect(Collectors.toMap(Function.identity(), CoreWire::createReadOnlyEnd));
-               for (ModelWire modelWire : wires)
-                       modelWire.setLogicModelBinding(modelWireSharedReadEnd.get(logicWiresPerPin.get(modelWire.getPin1())));
-       }
-
-       private static Map<Pin, Set<Pin>> getConnectedPinGroups(Set<Pin> allPins, Collection<ModelWire> wires)
-       {
-               Map<Pin, Set<Pin>> connectedPinsPerPin = new HashMap<>();
-
-               for (Pin p : allPins)
-               {
-                       HashSet<Pin> connectedPins = new HashSet<>();
-                       connectedPins.add(p);
-                       connectedPinsPerPin.put(p, connectedPins);
-               }
-
-               wires.forEach(wire ->
-               {
-                       Pin pin1 = wire.getPin1();
-                       Pin pin2 = wire.getPin2();
-
-                       Set<Pin> pin1ConnectedPins = connectedPinsPerPin.get(pin1);
-                       Set<Pin> pin2ConnectedPins = connectedPinsPerPin.get(pin2);
-
-                       pin1ConnectedPins.addAll(pin2ConnectedPins);
-                       pin1ConnectedPins.add(pin1);
-                       pin1ConnectedPins.add(pin2);
-
-                       pin2ConnectedPins.forEach(pin -> connectedPinsPerPin.put(pin, pin1ConnectedPins));
-               });
-               return connectedPinsPerPin;
-       }
-
-       @SuppressWarnings("unchecked")
-       private static <G extends ModelComponent> void createAndLinkComponent(Timeline timeline, LogicModelParameters params,
-                       ModelComponent modelComponent, Map<Pin, CoreWire> logicWiresPerPin)
-       {
-               Class<?> cls = modelComponent.getClass();
-               ComponentAdapter<? super G> adapter = null;
-               while (cls != ModelComponent.class && adapter == null)
-               {
-                       adapter = (ComponentAdapter<? super G>) componentAdapters.get(cls);
-                       cls = cls.getSuperclass();
-               }
-               if (adapter == null)
-                       throw new IllegalArgumentException("Unknown component class: " + modelComponent.getClass());
-               adapter.createAndLinkComponent(timeline, params, (G) modelComponent, logicWiresPerPin);
-       }
-
-       private ViewLogicModelAdapter()
-       {
-               throw new UnsupportedOperationException("No ViewLogicModelConverter instances");
-       }
-}
\ No newline at end of file
index db24aff..517e946 100644 (file)
@@ -8,7 +8,7 @@ import net.mograsim.logic.core.wires.CoreWire;
 import net.mograsim.logic.core.wires.CoreWire.ReadEnd;
 import net.mograsim.logic.model.model.components.atomic.ModelBitDisplay;
 import net.mograsim.logic.model.model.wires.Pin;
-import net.mograsim.logic.model.modeladapter.LogicModelParameters;
+import net.mograsim.logic.model.modeladapter.CoreModelParameters;
 
 public class BitDisplayAdapter implements ComponentAdapter<ModelBitDisplay>
 {
@@ -19,11 +19,11 @@ public class BitDisplayAdapter implements ComponentAdapter<ModelBitDisplay>
        }
 
        @Override
-       public void createAndLinkComponent(Timeline timeline, LogicModelParameters params, ModelBitDisplay modelComponent,
+       public void createAndLinkComponent(Timeline timeline, CoreModelParameters params, ModelBitDisplay modelComponent,
                        Map<Pin, CoreWire> logicWiresPerPin)
        {
                ReadEnd end = logicWiresPerPin.get(modelComponent.getInputPin()).createReadOnlyEnd();
                CoreBitDisplay bitDisplay = new CoreBitDisplay(timeline, end);
-               modelComponent.setLogicModelBinding(bitDisplay);
+               modelComponent.setCoreModelBinding(bitDisplay);
        }
 }
\ No newline at end of file
index 10560f0..adcda83 100644 (file)
@@ -8,7 +8,7 @@ import net.mograsim.logic.core.wires.CoreWire;
 import net.mograsim.logic.core.wires.CoreWire.ReadWriteEnd;
 import net.mograsim.logic.model.model.components.atomic.ModelClock;
 import net.mograsim.logic.model.model.wires.Pin;
-import net.mograsim.logic.model.modeladapter.LogicModelParameters;
+import net.mograsim.logic.model.modeladapter.CoreModelParameters;
 
 public class ClockAdapter implements ComponentAdapter<ModelClock>
 {
@@ -20,12 +20,12 @@ public class ClockAdapter implements ComponentAdapter<ModelClock>
        }
 
        @Override
-       public void createAndLinkComponent(Timeline timeline, LogicModelParameters params, ModelClock modelClock,
+       public void createAndLinkComponent(Timeline timeline, CoreModelParameters params, ModelClock modelClock,
                        Map<Pin, CoreWire> logicWiresPerPin)
        {
                ReadWriteEnd out = logicWiresPerPin.get(modelClock.getOutputPin()).createReadWriteEnd();
                CoreClock c = new CoreClock(timeline, out, modelClock.getDelta());
-               modelClock.setLogicModelBinding(c);
+               modelClock.setCoreModelBinding(c);
        }
 
 }
\ No newline at end of file
index 7849d4d..d7f2d2c 100644 (file)
@@ -6,12 +6,12 @@ import net.mograsim.logic.core.timeline.Timeline;
 import net.mograsim.logic.core.wires.CoreWire;
 import net.mograsim.logic.model.model.components.ModelComponent;
 import net.mograsim.logic.model.model.wires.Pin;
-import net.mograsim.logic.model.modeladapter.LogicModelParameters;
+import net.mograsim.logic.model.modeladapter.CoreModelParameters;
 
 public interface ComponentAdapter<G extends ModelComponent>
 {
        public Class<G> getSupportedClass();
 
-       public void createAndLinkComponent(Timeline timeline, LogicModelParameters params, G modelComponent,
+       public void createAndLinkComponent(Timeline timeline, CoreModelParameters params, G modelComponent,
                        Map<Pin, CoreWire> logicWiresPerPin);
 }
\ No newline at end of file
index f6a3c0e..f823665 100644 (file)
@@ -6,7 +6,7 @@ import net.mograsim.logic.core.timeline.Timeline;
 import net.mograsim.logic.core.wires.CoreWire;
 import net.mograsim.logic.model.model.components.atomic.ModelFixedOutput;
 import net.mograsim.logic.model.model.wires.Pin;
-import net.mograsim.logic.model.modeladapter.LogicModelParameters;
+import net.mograsim.logic.model.modeladapter.CoreModelParameters;
 
 public class FixedOutputAdapter implements ComponentAdapter<ModelFixedOutput>
 {
@@ -17,7 +17,7 @@ public class FixedOutputAdapter implements ComponentAdapter<ModelFixedOutput>
        }
 
        @Override
-       public void createAndLinkComponent(Timeline timeline, LogicModelParameters params, ModelFixedOutput modelComponent,
+       public void createAndLinkComponent(Timeline timeline, CoreModelParameters params, ModelFixedOutput modelComponent,
                        Map<Pin, CoreWire> logicWiresPerPin)
        {
                logicWiresPerPin.get(modelComponent.getPin("out")).createReadWriteEnd().feedSignals(modelComponent.bits);
index ac00c5b..75305f6 100644 (file)
@@ -8,7 +8,7 @@ import net.mograsim.logic.core.wires.CoreWire;
 import net.mograsim.logic.core.wires.CoreWire.ReadWriteEnd;
 import net.mograsim.logic.model.model.components.atomic.ModelManualSwitch;
 import net.mograsim.logic.model.model.wires.Pin;
-import net.mograsim.logic.model.modeladapter.LogicModelParameters;
+import net.mograsim.logic.model.modeladapter.CoreModelParameters;
 
 public class ManualSwitchAdapter implements ComponentAdapter<ModelManualSwitch>
 {
@@ -19,11 +19,11 @@ public class ManualSwitchAdapter implements ComponentAdapter<ModelManualSwitch>
        }
 
        @Override
-       public void createAndLinkComponent(Timeline timeline, LogicModelParameters params, ModelManualSwitch modelComponent,
+       public void createAndLinkComponent(Timeline timeline, CoreModelParameters params, ModelManualSwitch modelComponent,
                        Map<Pin, CoreWire> logicWiresPerPin)
        {
                ReadWriteEnd end = logicWiresPerPin.get(modelComponent.getOutputPin()).createReadWriteEnd();
                CoreManualSwitch manualSwitch = new CoreManualSwitch(timeline, end);
-               modelComponent.setLogicModelBinding(manualSwitch);
+               modelComponent.setCoreModelBinding(manualSwitch);
        }
 }
\ No newline at end of file
index 4b2834d..22d6112 100644 (file)
@@ -7,7 +7,7 @@ import net.mograsim.logic.core.wires.CoreWire;
 import net.mograsim.logic.core.wires.CoreWire.ReadEnd;
 import net.mograsim.logic.model.model.components.atomic.ModelMerger;
 import net.mograsim.logic.model.model.wires.Pin;
-import net.mograsim.logic.model.modeladapter.LogicModelParameters;
+import net.mograsim.logic.model.modeladapter.CoreModelParameters;
 
 public class MergerAdapter implements ComponentAdapter<ModelMerger>
 {
@@ -18,7 +18,7 @@ public class MergerAdapter implements ComponentAdapter<ModelMerger>
        }
 
        @Override
-       public void createAndLinkComponent(Timeline timeline, LogicModelParameters params, ModelMerger modelComponent,
+       public void createAndLinkComponent(Timeline timeline, CoreModelParameters params, ModelMerger modelComponent,
                        Map<Pin, CoreWire> logicWiresPerPin)
        {
                CoreWire output = logicWiresPerPin.get(modelComponent.getPin("O"));
@@ -29,6 +29,6 @@ public class MergerAdapter implements ComponentAdapter<ModelMerger>
                        CoreWire.fuse(input, output, 0, i);
                        inputEnds[i] = input.createReadOnlyEnd();
                }
-               modelComponent.setLogicModelBinding(inputEnds, output.createReadOnlyEnd());
+               modelComponent.setCoreModelBinding(inputEnds, output.createReadOnlyEnd());
        }
 }
\ No newline at end of file
index 20c1aef..3cc859e 100644 (file)
@@ -6,7 +6,7 @@ import net.mograsim.logic.core.timeline.Timeline;
 import net.mograsim.logic.core.wires.CoreWire;
 import net.mograsim.logic.model.model.components.ModelComponent;
 import net.mograsim.logic.model.model.wires.Pin;
-import net.mograsim.logic.model.modeladapter.LogicModelParameters;
+import net.mograsim.logic.model.modeladapter.CoreModelParameters;
 
 /**
  * For ModelComponents that do not have any simulation logic behaviour
@@ -29,7 +29,7 @@ public class NoLogicAdapter<T extends ModelComponent> implements ComponentAdapte
        }
 
        @Override
-       public void createAndLinkComponent(Timeline timeline, LogicModelParameters params, T modelComponent,
+       public void createAndLinkComponent(Timeline timeline, CoreModelParameters params, T modelComponent,
                        Map<Pin, CoreWire> logicWiresPerPin)
        {
                // do nothing
index 80830bd..72008e1 100644 (file)
@@ -9,7 +9,7 @@ import net.mograsim.logic.core.wires.CoreWire.ReadEnd;
 import net.mograsim.logic.core.wires.CoreWire.ReadWriteEnd;
 import net.mograsim.logic.model.model.components.atomic.SimpleRectangularModelGate;
 import net.mograsim.logic.model.model.wires.Pin;
-import net.mograsim.logic.model.modeladapter.LogicModelParameters;
+import net.mograsim.logic.model.modeladapter.CoreModelParameters;
 
 public class SimpleGateAdapter<G extends SimpleRectangularModelGate> implements ComponentAdapter<G>
 {
@@ -29,7 +29,7 @@ public class SimpleGateAdapter<G extends SimpleRectangularModelGate> implements
        }
 
        @Override
-       public void createAndLinkComponent(Timeline timeline, LogicModelParameters params, G modelComponent,
+       public void createAndLinkComponent(Timeline timeline, CoreModelParameters params, G modelComponent,
                        Map<Pin, CoreWire> logicWiresPerPin)
        {
                ReadWriteEnd out = logicWiresPerPin.get(modelComponent.getPin("Y")).createReadWriteEnd();
index 1dab1d3..dbebc0f 100644 (file)
@@ -12,7 +12,7 @@ import net.mograsim.logic.core.wires.CoreWire.ReadWriteEnd;
 import net.mograsim.logic.model.model.components.atomic.SimpleRectangularHardcodedModelComponent;
 import net.mograsim.logic.model.model.wires.Pin;
 import net.mograsim.logic.model.model.wires.PinUsage;
-import net.mograsim.logic.model.modeladapter.LogicModelParameters;
+import net.mograsim.logic.model.modeladapter.CoreModelParameters;
 
 public class SimpleRectangularHardcodedModelComponentAdapter implements ComponentAdapter<SimpleRectangularHardcodedModelComponent>
 {
@@ -23,7 +23,7 @@ public class SimpleRectangularHardcodedModelComponentAdapter implements Componen
        }
 
        @Override
-       public void createAndLinkComponent(Timeline timeline, LogicModelParameters params,
+       public void createAndLinkComponent(Timeline timeline, CoreModelParameters params,
                        SimpleRectangularHardcodedModelComponent modelComponent, Map<Pin, CoreWire> logicWiresPerPin)
        {
                Map<String, ReadEnd> readEnds = new HashMap<>();
@@ -34,7 +34,7 @@ public class SimpleRectangularHardcodedModelComponentAdapter implements Componen
                Runnable recalculate = () -> state.updateAndGet(s -> modelComponent.recalculate(s, readEnds, readWriteEnds));
                LogicObserver logicObs = c -> timeline.addEvent(e -> recalculate.run(), params.gateProcessTime);
 
-               modelComponent.setLogicModelBindingAndResetState(state, recalculate);
+               modelComponent.setCoreModelBindingAndResetState(state, recalculate);
 
                for (Pin pin : modelComponent.getPins().values())
                {
index bfe8308..3cfa5f2 100644 (file)
@@ -7,7 +7,7 @@ import net.mograsim.logic.core.wires.CoreWire;
 import net.mograsim.logic.core.wires.CoreWire.ReadEnd;
 import net.mograsim.logic.model.model.components.atomic.ModelSplitter;
 import net.mograsim.logic.model.model.wires.Pin;
-import net.mograsim.logic.model.modeladapter.LogicModelParameters;
+import net.mograsim.logic.model.modeladapter.CoreModelParameters;
 
 public class SplitterAdapter implements ComponentAdapter<ModelSplitter>
 {
@@ -18,7 +18,7 @@ public class SplitterAdapter implements ComponentAdapter<ModelSplitter>
        }
 
        @Override
-       public void createAndLinkComponent(Timeline timeline, LogicModelParameters params, ModelSplitter modelComponent,
+       public void createAndLinkComponent(Timeline timeline, CoreModelParameters params, ModelSplitter modelComponent,
                        Map<Pin, CoreWire> logicWiresPerPin)
        {
                CoreWire input = logicWiresPerPin.get(modelComponent.getPin("I"));
@@ -29,6 +29,6 @@ public class SplitterAdapter implements ComponentAdapter<ModelSplitter>
                        CoreWire.fuse(input, output, i, 0);
                        outputEnds[i] = output.createReadOnlyEnd();
                }
-               modelComponent.setLogicModelBinding(input.createReadOnlyEnd(), outputEnds);
+               modelComponent.setCoreModelBinding(input.createReadOnlyEnd(), outputEnds);
        }
 }
\ No newline at end of file
index 1263e0a..56a838b 100644 (file)
@@ -9,7 +9,7 @@ import net.mograsim.logic.core.wires.CoreWire.ReadEnd;
 import net.mograsim.logic.core.wires.CoreWire.ReadWriteEnd;
 import net.mograsim.logic.model.model.components.atomic.ModelTriStateBuffer;
 import net.mograsim.logic.model.model.wires.Pin;
-import net.mograsim.logic.model.modeladapter.LogicModelParameters;
+import net.mograsim.logic.model.modeladapter.CoreModelParameters;
 
 public class TriStateBufferAdapter implements ComponentAdapter<ModelTriStateBuffer>
 {
@@ -21,7 +21,7 @@ public class TriStateBufferAdapter implements ComponentAdapter<ModelTriStateBuff
 
        @SuppressWarnings("unused")
        @Override
-       public void createAndLinkComponent(Timeline timeline, LogicModelParameters params, ModelTriStateBuffer modelTsb,
+       public void createAndLinkComponent(Timeline timeline, CoreModelParameters params, ModelTriStateBuffer modelTsb,
                        Map<Pin, CoreWire> logicWiresPerPin)
        {
                ReadEnd in = logicWiresPerPin.get(modelTsb.getPin("IN")).createReadOnlyEnd();
index cd09bd8..ecf3a4d 100644 (file)
@@ -80,11 +80,11 @@ public class WireForcingAtomicHighLevelStateHandler implements AtomicHighLevelSt
        {
                BitVector result = BitVector.of(Bit.ZERO, logicWidth);
                for (ModelWire wire : wiresToForceInverted)
-                       if (wire.hasLogicModelBinding())
+                       if (wire.hasCoreModelBinding())
                                result = result.or(wire.getWireValues());
                result = result.not();
                for (ModelWire wire : wiresToForce)
-                       if (wire.hasLogicModelBinding())
+                       if (wire.hasCoreModelBinding())
                                result = result.and(wire.getWireValues());
                return result;
        }
@@ -98,11 +98,11 @@ public class WireForcingAtomicHighLevelStateHandler implements AtomicHighLevelSt
                else
                        vector = (BitVector) newState;
                for (ModelWire wire : wiresToForce)
-                       if (wire.hasLogicModelBinding())
+                       if (wire.hasCoreModelBinding())
                                wire.forceWireValues(vector);
                vector = vector.not();
                for (ModelWire wire : wiresToForceInverted)
-                       if (wire.hasLogicModelBinding())
+                       if (wire.hasCoreModelBinding())
                                wire.forceWireValues(vector);
        }
 
index 8da1dbb..8f40ced 100644 (file)
@@ -7,7 +7,7 @@ import net.mograsim.logic.model.model.components.ModelComponent;
 import net.mograsim.logic.model.model.components.atomic.ModelAndGate;
 import net.mograsim.logic.model.model.wires.Pin;
 import net.mograsim.logic.model.model.wires.PinUsage;
-import net.mograsim.logic.model.modeladapter.ViewLogicModelAdapter;
+import net.mograsim.logic.model.modeladapter.LogicCoreAdapter;
 import net.mograsim.logic.model.serializing.IdentifyParams;
 import net.mograsim.logic.model.serializing.IndirectModelComponentCreator;
 import net.mograsim.logic.model.snippets.Renderer;
@@ -59,7 +59,7 @@ public class ModelMemoryWA extends ModelComponent
                return rWPin;
        }
 
-       public void setLogicModelBinding(WordAddressableMemoryComponent memory)
+       public void setCoreModelBinding(WordAddressableMemoryComponent memory)
        {
                this.memory = memory;
        }
@@ -100,7 +100,7 @@ public class ModelMemoryWA extends ModelComponent
 
        static
        {
-               ViewLogicModelAdapter.addComponentAdapter(new WordAddressableMemoryAdapter());
+               LogicCoreAdapter.addComponentAdapter(new WordAddressableMemoryAdapter());
                IndirectModelComponentCreator.setComponentSupplier(ModelAndGate.class.getCanonicalName(), (m, p, n) ->
                {
                        ModelMemoryWAParams params = JsonHandler.fromJsonTree(p, ModelMemoryWAParams.class);
index 51a0883..6b63261 100644 (file)
@@ -28,7 +28,7 @@ public class WordAddressableMemoryAdapter implements ComponentAdapter<ModelMemor
                ReadEnd address = logicWiresPerPin.get(modelComponent.getAddressPin()).createReadOnlyEnd();
                ReadEnd mode = logicWiresPerPin.get(modelComponent.getReadWritePin()).createReadOnlyEnd();
                WordAddressableMemoryComponent mem = new WordAddressableMemoryComponent(timeline, 2, modelComponent.getDefinition(), data, mode, address);
-               modelComponent.setLogicModelBinding(mem);
+               modelComponent.setCoreModelBinding(mem);
        }
 
 }
index f669a49..bff6d61 100644 (file)
@@ -15,8 +15,8 @@ import net.mograsim.logic.model.model.components.atomic.ModelNotGate;
 import net.mograsim.logic.model.model.components.atomic.ModelOrGate;
 import net.mograsim.logic.model.model.wires.ModelWire;
 import net.mograsim.logic.model.model.wires.ModelWireCrossPoint;
-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.preferences.Preferences;
 
 public class SimulationPreview implements IThemePreview
@@ -37,7 +37,7 @@ public class SimulationPreview implements IThemePreview
                Preferences.setPreferences(currentThemePreferences);
 
                ViewModelModifiable model = new ViewModelModifiable();
-               LogicModelParameters params = new LogicModelParameters();
+               CoreModelParameters params = new CoreModelParameters();
                params.gateProcessTime = 50;
                params.wireTravelTime = 10;
 
@@ -80,7 +80,7 @@ public class SimulationPreview implements IThemePreview
                o2.moveCenterTo(150, 72.5);
                new ModelWire(model, p2, o2);
 
-               Timeline t = ViewLogicModelAdapter.convert(model, params);
+               Timeline t = LogicCoreAdapter.convert(model, params);
                exec = new LogicExecuter(t);
 
                rIn.clicked(0, 0);