Made sanity checks in Delegating(...)HighLevelStateHandler faster
authorDaniel Kirschten <daniel.kirschten@gmx.de>
Mon, 15 Jul 2019 17:11:38 +0000 (19:11 +0200)
committerDaniel Kirschten <daniel.kirschten@gmx.de>
Mon, 15 Jul 2019 17:11:38 +0000 (19:11 +0200)
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/subcomponent/DelegatingSubcomponentHighLevelStateHandler.java

index 0ed207f..bd21132 100644 (file)
@@ -39,7 +39,7 @@ public class DelegatingAtomicHighLevelStateHandler implements AtomicHighLevelSta
        {
                if (delegateTarget == null)
                        this.delegateTarget = parentComponent;
-               else if (!parentComponent.submodel.getComponentsByName().containsValue(delegateTarget))
+               else if (parentComponent.submodel.getComponentsByName().get(delegateTarget.name) != delegateTarget)
                        throw new IllegalArgumentException(
                                        "Can only set components belonging to the submodel of the parent component of this handler as the delegate target");
                this.delegateTarget = delegateTarget;
index 79ec244..bc864d1 100644 (file)
@@ -40,7 +40,7 @@ public class DelegatingSubcomponentHighLevelStateHandler implements Subcomponent
        {
                if (delegateTarget == null)
                        this.delegateTarget = parentComponent;
-               else if (!parentComponent.submodel.getComponentsByName().containsValue(delegateTarget))
+               else if (parentComponent.submodel.getComponentsByName().get(delegateTarget.name) != delegateTarget)
                        throw new IllegalArgumentException(
                                        "Can only set components belonging to the submodel of the parent component of this handler as the delegate target");
                this.delegateTarget = delegateTarget;