From 392fbda88f4fb2df7870aec7a3a0dcde277c1691 Mon Sep 17 00:00:00 2001 From: Daniel Kirschten Date: Mon, 15 Jul 2019 19:11:38 +0200 Subject: [PATCH] Made sanity checks in Delegating(...)HighLevelStateHandler faster --- .../standard/atomic/DelegatingAtomicHighLevelStateHandler.java | 2 +- .../DelegatingSubcomponentHighLevelStateHandler.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 0ed207f4..bd211324 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 @@ -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; 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 79ec244d..bc864d1e 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 @@ -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; -- 2.17.1