From: lempinen Date: Fri, 8 Feb 2013 12:38:33 +0000 (+0000) Subject: Treat variables with pre() and delay() functions as continuous variables instead... X-Git-Tag: simantics-1.10.1~45 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=40f0eda18d1bb68dbe5b2be584a7332c7359b9e4;p=simantics%2Fsysdyn.git Treat variables with pre() and delay() functions as continuous variables instead of parameter variables (fixes #4059) git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@26742 ac1ea38d-2e2b-0410-8846-a27921b304fc --- diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Variability.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Variability.java index dda7cbd4..c5d0a340 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Variability.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Variability.java @@ -13,7 +13,9 @@ package org.simantics.sysdyn.representation; import java.io.StringReader; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; +import java.util.List; import java.util.Set; import org.simantics.sysdyn.expressionParser.ExpressionParser; @@ -33,6 +35,12 @@ public enum Variability { PARAMETER("parameter"), CONSTANT("constant"), CONTINUOUS(""); + + + private static List timeDependentFunctions = Arrays.asList( + "pre", + "delay" + ); private String text; @@ -256,6 +264,15 @@ public enum Variability { references.remove(t.image); } } + + // Check used functions + for(String function : parser.getFunctionCallReferences().keySet()) { + if(functions.containsKey(function) && functions.get(function).hasTimeReference()) + return Variability.CONTINUOUS; + else if (timeDependentFunctions.contains(function)) { + return Variability.CONTINUOUS; + } + } // Go through each reference for(String reference : references) { @@ -264,11 +281,6 @@ public enum Variability { } } - for(String function : parser.getFunctionCallReferences().keySet()) { - if(functions.containsKey(function) && functions.get(function).hasTimeReference()) - return Variability.CONTINUOUS; - } - // All found variables were sheets or non-continuous return Variability.PARAMETER; }