From 43a82a2b8b025c1c4107a13fd2e808f4ca3f6edc Mon Sep 17 00:00:00 2001 From: lempinen Date: Tue, 5 Nov 2013 11:30:52 +0000 Subject: [PATCH] IndexVariables fixed for cases when there is a history dataset refs #4529 git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@28170 ac1ea38d-2e2b-0410-8846-a27921b304fc --- .../org/simantics/sysdyn/adapter/TimesIndexVariable.java | 5 +++-- .../org/simantics/sysdyn/adapter/ValuesIndexVariable.java | 7 ++++--- .../simantics/sysdyn/representation/utils/UnitUtils.java | 1 + 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/TimesIndexVariable.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/TimesIndexVariable.java index 1076ad74..329e4cd2 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/TimesIndexVariable.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/TimesIndexVariable.java @@ -35,10 +35,11 @@ public class TimesIndexVariable extends IndexVariable { for(int j = 0; j < ds.times.length; j++) { result[i][j] = ds.times[j]; } - } else { - result[i] = new double[0]; + break; // Show the first result found. (i.e. do not show history datasets) } } + if(result[i] == null) + result[i] = new double[0]; } return result; } diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ValuesIndexVariable.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ValuesIndexVariable.java index 687d5034..17f31520 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ValuesIndexVariable.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ValuesIndexVariable.java @@ -43,10 +43,11 @@ public class ValuesIndexVariable extends IndexVariable { double d = ((SysdynGameExperiment)experiment).getCurrentValue(variableNames.get(i)); result[i][ds.values.length - 1] = d; } - - } else { - result[i] = new double[0]; + break; // Show the first result found. (i.e. do not show history datasets) } + + if(result[i] == null) + result[i] = new double[0]; } } } diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/utils/UnitUtils.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/utils/UnitUtils.java index f594c5ec..758cc8b2 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/utils/UnitUtils.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/utils/UnitUtils.java @@ -41,6 +41,7 @@ public class UnitUtils { try { StringReader reader = new StringReader(expression); UnitParser parser = new UnitParser(reader); + System.out.println("expression " + expression); UnitCheckingNode node = (UnitCheckingNode) parser.expr(); reader.close(); Set components = UnitUtils.findComponents(node); -- 2.47.1