]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
IndexVariables fixed for cases when there is a history dataset
authorlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Tue, 5 Nov 2013 11:30:52 +0000 (11:30 +0000)
committerlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Tue, 5 Nov 2013 11:30:52 +0000 (11:30 +0000)
refs #4529

git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@28170 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/TimesIndexVariable.java
org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ValuesIndexVariable.java
org.simantics.sysdyn/src/org/simantics/sysdyn/representation/utils/UnitUtils.java

index 1076ad747f36f922a73374453d47e0fddc053d3c..329e4cd2947a56ee935471bce302ad91c37c89f1 100644 (file)
@@ -35,10 +35,11 @@ public class TimesIndexVariable extends IndexVariable<double[][]> {
                        for(int j = 0; j < ds.times.length; j++) {\r
                            result[i][j] = ds.times[j];\r
                        }\r
-                   } else {\r
-                       result[i] = new double[0];\r
+                       break; // Show the first result found. (i.e. do not show history datasets)\r
                    }\r
                }\r
+               if(result[i] == null)\r
+                result[i] = new double[0];\r
            }\r
                return result;\r
        }\r
index 687d50341ed77e6ff33356b2ee94ead3c6a68164..17f315203ce1c8fa15ea51ec56f9bbf98354cdca 100644 (file)
@@ -43,10 +43,11 @@ public class ValuesIndexVariable extends IndexVariable<double[][]> {
                                double d = ((SysdynGameExperiment)experiment).getCurrentValue(variableNames.get(i));\r
                                result[i][ds.values.length - 1] = d;\r
                            }\r
-       \r
-                       } else {\r
-                           result[i] = new double[0];\r
+                           break; // Show the first result found. (i.e. do not show history datasets)\r
                        }\r
+                       \r
+                       if(result[i] == null)\r
+                           result[i] = new double[0];\r
                    }\r
                }\r
         }\r
index f594c5ec9c57fce784a0767015fc69b57964ca97..758cc8b2d52dd69f4ffe187c1d4b2158c9d2eedf 100644 (file)
@@ -41,6 +41,7 @@ public class UnitUtils {
         try {\r
             StringReader reader = new StringReader(expression);\r
             UnitParser parser = new UnitParser(reader);\r
+            System.out.println("expression " + expression);\r
             UnitCheckingNode node = (UnitCheckingNode) parser.expr();\r
             reader.close();\r
             Set<String> components = UnitUtils.findComponents(node);\r