X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.logic.model%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fmodel%2Fsnippets%2Fhighlevelstatehandlers%2Fstandard%2FStandardHighLevelStateHandler.java;h=490b267658c68d66199030f43acae9e757a3bfeb;hb=5140b424c507b8f22f80b452e475d0b56a3a36ce;hp=af3ad22b1999b01df7f949b976119a624cd2414b;hpb=662fb8ae0007c317aa210b1de50499b47f38477a;p=Mograsim.git 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 af3ad22b..490b2676 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 @@ -1,5 +1,6 @@ package net.mograsim.logic.model.snippets.highlevelstatehandlers.standard; +import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; @@ -20,7 +21,9 @@ public class StandardHighLevelStateHandler implements HighLevelStateHandler { private final SubmodelComponent component; private final Map subcomponentHighLevelStateHandlers; + private final Map subcomponentHighLevelStateHandlersUnmodifiable; private final Map atomicHighLevelStateHandlers; + private final Map atomicHighLevelStateHandlersUnmodifiable; public StandardHighLevelStateHandler(SubmodelComponent component) { @@ -31,7 +34,9 @@ public class StandardHighLevelStateHandler implements HighLevelStateHandler { this.component = component; this.subcomponentHighLevelStateHandlers = new HashMap<>(); + this.subcomponentHighLevelStateHandlersUnmodifiable = Collections.unmodifiableMap(subcomponentHighLevelStateHandlers); this.atomicHighLevelStateHandlers = new HashMap<>(); + this.atomicHighLevelStateHandlersUnmodifiable = Collections.unmodifiableMap(atomicHighLevelStateHandlers); if (params != null) { params.subcomponentHighLevelStates.forEach(this::addSubcomponentHighLevelState); @@ -68,6 +73,17 @@ public class StandardHighLevelStateHandler implements HighLevelStateHandler subcomponentHighLevelStateHandlers.put(subcomponentStateID, handler); } + public void removeSubcomponentHighLevelState(String subcomponentStateID) + { + checkHighLevelStateIDPart(subcomponentStateID); + subcomponentHighLevelStateHandlers.remove(subcomponentStateID); + } + + public Map getSubcomponentHighLevelStates() + { + return subcomponentHighLevelStateHandlersUnmodifiable; + } + public AtomicHighLevelStateHandler addAtomicHighLevelState(String atomicStateID, AtomicHighLevelStateHandlerParams handlerParams) { return addAtomicHighLevelState(atomicStateID, @@ -96,6 +112,17 @@ public class StandardHighLevelStateHandler implements HighLevelStateHandler atomicHighLevelStateHandlers.put(atomicStateID, handler); } + public void removeAtomicHighLevelState(String atomicStateID) + { + checkHighLevelStateIDPart(atomicStateID); + atomicHighLevelStateHandlers.remove(atomicStateID); + } + + public Map getAtomicHighLevelStates() + { + return atomicHighLevelStateHandlersUnmodifiable; + } + private static void checkHighLevelStateIDPart(String stateIDPart) { if (stateIDPart.indexOf('.') != -1)