From 161465aa22d4246f34dde3037134cbd53df85735 Mon Sep 17 00:00:00 2001 From: lempinen Date: Thu, 11 Oct 2012 09:52:25 +0000 Subject: [PATCH] Valves are recognized in dependencies view to affect Stocks. (fixes #3707) git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@25979 ac1ea38d-2e2b-0410-8846-a27921b304fc --- .../ui/structure/DependencyGraphRequest.java | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/structure/DependencyGraphRequest.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/structure/DependencyGraphRequest.java index 27c95d3e..ca898582 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/structure/DependencyGraphRequest.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/structure/DependencyGraphRequest.java @@ -149,14 +149,18 @@ public class DependencyGraphRequest implements Read { return Collections.emptyList(); Collection dependants; - if(isInverted) - dependants = getDependants(g, graph, r, sr.Variable_isTailOf, sr.Variable_HasHead, sr.Dependency); - else { - dependants = getDependants(g, graph, r, sr.Variable_isHeadOf, sr.Variable_HasTail, sr.Dependency); - if (g.isInstanceOf(r, sr.Stock)) { - dependants.addAll(getDependants(g, graph, r, sr.Variable_isTailOf, sr.Variable_HasHead, sr.Flow)); - dependants.addAll(getDependants(g, graph, r, sr.Variable_isHeadOf, sr.Variable_HasTail, sr.Flow)); - } + if(isInverted) { + dependants = getDependants(g, graph, r, sr.Variable_isTailOf, sr.Variable_HasHead, sr.Dependency); + if (g.isInstanceOf(r, sr.Valve)) { + dependants.addAll(getDependants(g, graph, r, sr.Variable_isTailOf, sr.Variable_HasHead, sr.Flow)); + dependants.addAll(getDependants(g, graph, r, sr.Variable_isHeadOf, sr.Variable_HasTail, sr.Flow)); + } + } else { + dependants = getDependants(g, graph, r, sr.Variable_isHeadOf, sr.Variable_HasTail, sr.Dependency); + if (g.isInstanceOf(r, sr.Stock)) { + dependants.addAll(getDependants(g, graph, r, sr.Variable_isTailOf, sr.Variable_HasHead, sr.Flow)); + dependants.addAll(getDependants(g, graph, r, sr.Variable_isHeadOf, sr.Variable_HasTail, sr.Flow)); + } } return dependants; -- 2.47.1