From c306a7b193d4191d2d531b8ed9840d79c44dcbc8 Mon Sep 17 00:00:00 2001 From: Daniel Kirschten Date: Thu, 12 Sep 2019 11:43:50 +0200 Subject: [PATCH] Replaced HighLevelStateHandlerContext with SubmodelComponent --- .../standard/HighLevelStateHandlerContext.java | 15 --------------- .../standard/StandardHighLevelStateHandler.java | 14 ++++++-------- ...dardHighLevelStateHandlerSnippetSuppliers.java | 5 +++-- ...ectorSplittingAtomicHighLevelStateHandler.java | 9 ++++----- .../DelegatingAtomicHighLevelStateHandler.java | 9 ++++----- .../WireForcingAtomicHighLevelStateHandler.java | 9 ++++----- ...legatingSubcomponentHighLevelStateHandler.java | 9 ++++----- 7 files changed, 25 insertions(+), 45 deletions(-) delete mode 100644 net.mograsim.logic.model/src/net/mograsim/logic/model/snippets/highlevelstatehandlers/standard/HighLevelStateHandlerContext.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 index ba3ae198..00000000 --- a/net.mograsim.logic.model/src/net/mograsim/logic/model/snippets/highlevelstatehandlers/standard/HighLevelStateHandlerContext.java +++ /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 diff --git a/net.mograsim.logic.model/src/net/mograsim/logic/model/snippets/highlevelstatehandlers/standard/StandardHighLevelStateHandler.java b/net.mograsim.logic.model/src/net/mograsim/logic/model/snippets/highlevelstatehandlers/standard/StandardHighLevelStateHandler.java index c5eb6da3..58e8e64c 100644 --- a/net.mograsim.logic.model/src/net/mograsim/logic/model/snippets/highlevelstatehandlers/standard/StandardHighLevelStateHandler.java +++ b/net.mograsim.logic.model/src/net/mograsim/logic/model/snippets/highlevelstatehandlers/standard/StandardHighLevelStateHandler.java @@ -54,16 +54,15 @@ public class StandardHighLevelStateHandler implements HighLevelStateHandler } public H addSubcomponentHighLevelState(String subcomponentStateID, - BiFunction handlerConstructor, P handlerParams) + BiFunction handlerConstructor, P handlerParams) { return addSubcomponentHighLevelState(subcomponentStateID, c -> handlerConstructor.apply(c, handlerParams)); } public H addSubcomponentHighLevelState(String subcomponentStateID, - Function handlerConstructor) + Function 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 H addAtomicHighLevelState(String subcomponentStateID, - BiFunction handlerConstructor, P handlerParams) + BiFunction handlerConstructor, P handlerParams) { return addAtomicHighLevelState(subcomponentStateID, c -> handlerConstructor.apply(c, handlerParams)); } public H addAtomicHighLevelState(String subcomponentStateID, - Function handlerConstructor) + Function handlerConstructor) { - HighLevelStateHandlerContext context = new HighLevelStateHandlerContext(component, subcomponentStateID); - H handler = handlerConstructor.apply(context); + H handler = handlerConstructor.apply(component); addAtomicHighLevelState(subcomponentStateID, handler); return handler; } diff --git a/net.mograsim.logic.model/src/net/mograsim/logic/model/snippets/highlevelstatehandlers/standard/StandardHighLevelStateHandlerSnippetSuppliers.java b/net.mograsim.logic.model/src/net/mograsim/logic/model/snippets/highlevelstatehandlers/standard/StandardHighLevelStateHandlerSnippetSuppliers.java index d052cb15..158adda2 100644 --- a/net.mograsim.logic.model/src/net/mograsim/logic/model/snippets/highlevelstatehandlers/standard/StandardHighLevelStateHandlerSnippetSuppliers.java +++ b/net.mograsim.logic.model/src/net/mograsim/logic/model/snippets/highlevelstatehandlers/standard/StandardHighLevelStateHandlerSnippetSuppliers.java @@ -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 atomicHandlerSupplier; - public static final CodeSnippetSupplier subcomponentHandlerSupplier; + public static final CodeSnippetSupplier atomicHandlerSupplier; + public static final CodeSnippetSupplier subcomponentHandlerSupplier; static { diff --git a/net.mograsim.logic.model/src/net/mograsim/logic/model/snippets/highlevelstatehandlers/standard/atomic/BitVectorSplittingAtomicHighLevelStateHandler.java b/net.mograsim.logic.model/src/net/mograsim/logic/model/snippets/highlevelstatehandlers/standard/atomic/BitVectorSplittingAtomicHighLevelStateHandler.java index 443f8475..7ae29128 100644 --- a/net.mograsim.logic.model/src/net/mograsim/logic/model/snippets/highlevelstatehandlers/standard/atomic/BitVectorSplittingAtomicHighLevelStateHandler.java +++ b/net.mograsim.logic.model/src/net/mograsim/logic/model/snippets/highlevelstatehandlers/standard/atomic/BitVectorSplittingAtomicHighLevelStateHandler.java @@ -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 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<>(); diff --git a/net.mograsim.logic.model/src/net/mograsim/logic/model/snippets/highlevelstatehandlers/standard/atomic/DelegatingAtomicHighLevelStateHandler.java b/net.mograsim.logic.model/src/net/mograsim/logic/model/snippets/highlevelstatehandlers/standard/atomic/DelegatingAtomicHighLevelStateHandler.java index e91c0c44..9d2645d7 100644 --- a/net.mograsim.logic.model/src/net/mograsim/logic/model/snippets/highlevelstatehandlers/standard/atomic/DelegatingAtomicHighLevelStateHandler.java +++ b/net.mograsim.logic.model/src/net/mograsim/logic/model/snippets/highlevelstatehandlers/standard/atomic/DelegatingAtomicHighLevelStateHandler.java @@ -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 diff --git a/net.mograsim.logic.model/src/net/mograsim/logic/model/snippets/highlevelstatehandlers/standard/atomic/WireForcingAtomicHighLevelStateHandler.java b/net.mograsim.logic.model/src/net/mograsim/logic/model/snippets/highlevelstatehandlers/standard/atomic/WireForcingAtomicHighLevelStateHandler.java index ac0f8a42..276f5415 100644 --- a/net.mograsim.logic.model/src/net/mograsim/logic/model/snippets/highlevelstatehandlers/standard/atomic/WireForcingAtomicHighLevelStateHandler.java +++ b/net.mograsim.logic.model/src/net/mograsim/logic/model/snippets/highlevelstatehandlers/standard/atomic/WireForcingAtomicHighLevelStateHandler.java @@ -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 wiresToForceInverted; private final List 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<>(); diff --git a/net.mograsim.logic.model/src/net/mograsim/logic/model/snippets/highlevelstatehandlers/standard/subcomponent/DelegatingSubcomponentHighLevelStateHandler.java b/net.mograsim.logic.model/src/net/mograsim/logic/model/snippets/highlevelstatehandlers/standard/subcomponent/DelegatingSubcomponentHighLevelStateHandler.java index 069a6cb3..12a98887 100644 --- a/net.mograsim.logic.model/src/net/mograsim/logic/model/snippets/highlevelstatehandlers/standard/subcomponent/DelegatingSubcomponentHighLevelStateHandler.java +++ b/net.mograsim.logic.model/src/net/mograsim/logic/model/snippets/highlevelstatehandlers/standard/subcomponent/DelegatingSubcomponentHighLevelStateHandler.java @@ -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 -- 2.17.1