Replaced HighLevelStateHandlerContext with SubmodelComponent
authorDaniel Kirschten <daniel.kirschten@gmx.de>
Thu, 12 Sep 2019 09:43:50 +0000 (11:43 +0200)
committerDaniel Kirschten <daniel.kirschten@gmx.de>
Thu, 12 Sep 2019 09:43:50 +0000 (11:43 +0200)
net.mograsim.logic.model/src/net/mograsim/logic/model/snippets/highlevelstatehandlers/standard/HighLevelStateHandlerContext.java [deleted file]
net.mograsim.logic.model/src/net/mograsim/logic/model/snippets/highlevelstatehandlers/standard/StandardHighLevelStateHandler.java
net.mograsim.logic.model/src/net/mograsim/logic/model/snippets/highlevelstatehandlers/standard/StandardHighLevelStateHandlerSnippetSuppliers.java
net.mograsim.logic.model/src/net/mograsim/logic/model/snippets/highlevelstatehandlers/standard/atomic/BitVectorSplittingAtomicHighLevelStateHandler.java
net.mograsim.logic.model/src/net/mograsim/logic/model/snippets/highlevelstatehandlers/standard/atomic/DelegatingAtomicHighLevelStateHandler.java
net.mograsim.logic.model/src/net/mograsim/logic/model/snippets/highlevelstatehandlers/standard/atomic/WireForcingAtomicHighLevelStateHandler.java
net.mograsim.logic.model/src/net/mograsim/logic/model/snippets/highlevelstatehandlers/standard/subcomponent/DelegatingSubcomponentHighLevelStateHandler.java

diff --git a/net.mograsim.logic.model/src/net/mograsim/logic/model/snippets/highlevelstatehandlers/standard/HighLevelStateHandlerContext.java b/net.mograsim.logic.model/src/net/mograsim/logic/model/snippets/highlevelstatehandlers/standard/HighLevelStateHandlerContext.java
deleted file mode 100644 (file)
index ba3ae19..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-package net.mograsim.logic.model.snippets.highlevelstatehandlers.standard;
-
-import net.mograsim.logic.model.model.components.submodels.SubmodelComponent;
-
-public class HighLevelStateHandlerContext
-{
-       public final SubmodelComponent component;
-       public final String stateID;
-
-       public HighLevelStateHandlerContext(SubmodelComponent component, String stateID)
-       {
-               this.component = component;
-               this.stateID = stateID;
-       }
-}
\ No newline at end of file
index c5eb6da..58e8e64 100644 (file)
@@ -54,16 +54,15 @@ public class StandardHighLevelStateHandler implements HighLevelStateHandler
        }
 
        public <P, H extends SubcomponentHighLevelStateHandler> H addSubcomponentHighLevelState(String subcomponentStateID,
-                       BiFunction<HighLevelStateHandlerContext, P, H> handlerConstructor, P handlerParams)
+                       BiFunction<SubmodelComponent, P, H> handlerConstructor, P handlerParams)
        {
                return addSubcomponentHighLevelState(subcomponentStateID, c -> handlerConstructor.apply(c, handlerParams));
        }
 
        public <H extends SubcomponentHighLevelStateHandler> H addSubcomponentHighLevelState(String subcomponentStateID,
-                       Function<HighLevelStateHandlerContext, H> handlerConstructor)
+                       Function<SubmodelComponent, H> handlerConstructor)
        {
-               HighLevelStateHandlerContext context = new HighLevelStateHandlerContext(component, subcomponentStateID);
-               H handler = handlerConstructor.apply(context);
+               H handler = handlerConstructor.apply(component);
                addSubcomponentHighLevelState(subcomponentStateID, handler);
                return handler;
        }
@@ -93,16 +92,15 @@ public class StandardHighLevelStateHandler implements HighLevelStateHandler
        }
 
        public <P, H extends AtomicHighLevelStateHandler> H addAtomicHighLevelState(String subcomponentStateID,
-                       BiFunction<HighLevelStateHandlerContext, P, H> handlerConstructor, P handlerParams)
+                       BiFunction<SubmodelComponent, P, H> handlerConstructor, P handlerParams)
        {
                return addAtomicHighLevelState(subcomponentStateID, c -> handlerConstructor.apply(c, handlerParams));
        }
 
        public <H extends AtomicHighLevelStateHandler> H addAtomicHighLevelState(String subcomponentStateID,
-                       Function<HighLevelStateHandlerContext, H> handlerConstructor)
+                       Function<SubmodelComponent, H> handlerConstructor)
        {
-               HighLevelStateHandlerContext context = new HighLevelStateHandlerContext(component, subcomponentStateID);
-               H handler = handlerConstructor.apply(context);
+               H handler = handlerConstructor.apply(component);
                addAtomicHighLevelState(subcomponentStateID, handler);
                return handler;
        }
index d052cb1..158adda 100644 (file)
@@ -4,6 +4,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.util.Map;
 
+import net.mograsim.logic.model.model.components.submodels.SubmodelComponent;
 import net.mograsim.logic.model.snippets.CodeSnippetSupplier;
 import net.mograsim.logic.model.snippets.highlevelstatehandlers.standard.atomic.AtomicHighLevelStateHandler;
 import net.mograsim.logic.model.snippets.highlevelstatehandlers.standard.subcomponent.SubcomponentHighLevelStateHandler;
@@ -11,8 +12,8 @@ import net.mograsim.logic.model.util.JsonHandler;
 
 public class StandardHighLevelStateHandlerSnippetSuppliers
 {
-       public static final CodeSnippetSupplier<HighLevelStateHandlerContext, AtomicHighLevelStateHandler> atomicHandlerSupplier;
-       public static final CodeSnippetSupplier<HighLevelStateHandlerContext, SubcomponentHighLevelStateHandler> subcomponentHandlerSupplier;
+       public static final CodeSnippetSupplier<SubmodelComponent, AtomicHighLevelStateHandler> atomicHandlerSupplier;
+       public static final CodeSnippetSupplier<SubmodelComponent, SubcomponentHighLevelStateHandler> subcomponentHandlerSupplier;
 
        static
        {
index 443f847..7ae2912 100644 (file)
@@ -9,7 +9,6 @@ import net.mograsim.logic.core.types.BitVector;
 import net.mograsim.logic.model.model.components.submodels.SubmodelComponent;
 import net.mograsim.logic.model.serializing.IdentifyParams;
 import net.mograsim.logic.model.snippets.SnippetDefinintion;
-import net.mograsim.logic.model.snippets.highlevelstatehandlers.standard.HighLevelStateHandlerContext;
 import net.mograsim.logic.model.snippets.highlevelstatehandlers.standard.StandardHighLevelStateHandlerSnippetSuppliers;
 
 public class BitVectorSplittingAtomicHighLevelStateHandler implements AtomicHighLevelStateHandler
@@ -21,15 +20,15 @@ public class BitVectorSplittingAtomicHighLevelStateHandler implements AtomicHigh
        private final List<Integer> vectorPartLengthesUnmodifiable;
        private int length;
 
-       public BitVectorSplittingAtomicHighLevelStateHandler(HighLevelStateHandlerContext context)
+       public BitVectorSplittingAtomicHighLevelStateHandler(SubmodelComponent component)
        {
-               this(context, null);
+               this(component, null);
        }
 
-       public BitVectorSplittingAtomicHighLevelStateHandler(HighLevelStateHandlerContext context,
+       public BitVectorSplittingAtomicHighLevelStateHandler(SubmodelComponent component,
                        BitVectorSplittingAtomicHighLevelStateHandlerParams params)
        {
-               this.component = context.component;
+               this.component = component;
                this.vectorPartTargets = new ArrayList<>();
                this.vectorPartTargetsUnmodifiable = Collections.unmodifiableList(vectorPartTargets);
                this.vectorPartLengthes = new ArrayList<>();
index e91c0c4..9d2645d 100644 (file)
@@ -4,7 +4,6 @@ import net.mograsim.logic.model.model.components.ModelComponent;
 import net.mograsim.logic.model.model.components.submodels.SubmodelComponent;
 import net.mograsim.logic.model.serializing.IdentifyParams;
 import net.mograsim.logic.model.snippets.SnippetDefinintion;
-import net.mograsim.logic.model.snippets.highlevelstatehandlers.standard.HighLevelStateHandlerContext;
 import net.mograsim.logic.model.snippets.highlevelstatehandlers.standard.StandardHighLevelStateHandlerSnippetSuppliers;
 
 public class DelegatingAtomicHighLevelStateHandler implements AtomicHighLevelStateHandler
@@ -13,14 +12,14 @@ public class DelegatingAtomicHighLevelStateHandler implements AtomicHighLevelSta
        private ModelComponent delegateTarget;
        private String subStateID;
 
-       public DelegatingAtomicHighLevelStateHandler(HighLevelStateHandlerContext context)
+       public DelegatingAtomicHighLevelStateHandler(SubmodelComponent component)
        {
-               this(context, null);
+               this(component, null);
        }
 
-       public DelegatingAtomicHighLevelStateHandler(HighLevelStateHandlerContext context, DelegatingAtomicHighLevelStateHandlerParams params)
+       public DelegatingAtomicHighLevelStateHandler(SubmodelComponent component, DelegatingAtomicHighLevelStateHandlerParams params)
        {
-               this.parentComponent = context.component;
+               this.parentComponent = component;
                if (params != null)
                {
                        // TODO document this
index ac0f8a4..276f541 100644 (file)
@@ -13,7 +13,6 @@ import net.mograsim.logic.model.model.components.submodels.SubmodelComponent;
 import net.mograsim.logic.model.model.wires.ModelWire;
 import net.mograsim.logic.model.serializing.IdentifyParams;
 import net.mograsim.logic.model.snippets.SnippetDefinintion;
-import net.mograsim.logic.model.snippets.highlevelstatehandlers.standard.HighLevelStateHandlerContext;
 import net.mograsim.logic.model.snippets.highlevelstatehandlers.standard.StandardHighLevelStateHandlerSnippetSuppliers;
 
 public class WireForcingAtomicHighLevelStateHandler implements AtomicHighLevelStateHandler
@@ -25,14 +24,14 @@ public class WireForcingAtomicHighLevelStateHandler implements AtomicHighLevelSt
        private final List<ModelWire> wiresToForceInverted;
        private final List<ModelWire> wiresToForceInvertedUnmodifiable;
 
-       public WireForcingAtomicHighLevelStateHandler(HighLevelStateHandlerContext context)
+       public WireForcingAtomicHighLevelStateHandler(SubmodelComponent component)
        {
-               this(context, null);
+               this(component, null);
        }
 
-       public WireForcingAtomicHighLevelStateHandler(HighLevelStateHandlerContext context, WireForcingAtomicHighLevelStateHandlerParams params)
+       public WireForcingAtomicHighLevelStateHandler(SubmodelComponent component, WireForcingAtomicHighLevelStateHandlerParams params)
        {
-               this.component = context.component;
+               this.component = component;
                this.wiresToForce = new ArrayList<>();
                this.wiresToForceUnmodifiable = Collections.unmodifiableList(wiresToForce);
                this.wiresToForceInverted = new ArrayList<>();
index 069a6cb..12a9888 100644 (file)
@@ -4,7 +4,6 @@ import net.mograsim.logic.model.model.components.ModelComponent;
 import net.mograsim.logic.model.model.components.submodels.SubmodelComponent;
 import net.mograsim.logic.model.serializing.IdentifyParams;
 import net.mograsim.logic.model.snippets.SnippetDefinintion;
-import net.mograsim.logic.model.snippets.highlevelstatehandlers.standard.HighLevelStateHandlerContext;
 import net.mograsim.logic.model.snippets.highlevelstatehandlers.standard.StandardHighLevelStateHandlerSnippetSuppliers;
 
 public class DelegatingSubcomponentHighLevelStateHandler implements SubcomponentHighLevelStateHandler
@@ -13,15 +12,15 @@ public class DelegatingSubcomponentHighLevelStateHandler implements Subcomponent
        private ModelComponent delegateTarget;
        private String prefix;
 
-       public DelegatingSubcomponentHighLevelStateHandler(HighLevelStateHandlerContext context)
+       public DelegatingSubcomponentHighLevelStateHandler(SubmodelComponent component)
        {
-               this(context, null);
+               this(component, null);
        }
 
-       public DelegatingSubcomponentHighLevelStateHandler(HighLevelStateHandlerContext context,
+       public DelegatingSubcomponentHighLevelStateHandler(SubmodelComponent component,
                        DelegatingSubcomponentHighLevelStateHandlerParams params)
        {
-               this.parentComponent = context.component;
+               this.parentComponent = component;
                if (params != null)
                {
                        // TODO document this