]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
fixes #4966
authorjussi.koskela <jussi.koskela@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Wed, 18 Jun 2014 12:17:53 +0000 (12:17 +0000)
committerjussi.koskela <jussi.koskela@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Wed, 18 Jun 2014 12:17:53 +0000 (12:17 +0000)
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@29651 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ValueIndexVariableI.java

index d23ce8261bc2e8b02cd5d94161cfeb592fb9ef82..c414f3d6857ff34dba58c7ae6a96e2e6d7fe2a67 100644 (file)
@@ -20,8 +20,8 @@ public class  ValueIndexVariableI extends ValueIndexVariableBase<Double> {
        @Override\r
        public Double getValue() {\r
                double[] array = getValueFull();\r
-               if(array == null || array.length < index+1) return Double.NaN;\r
-               return array[0];\r
+               if(array == null || index < 0 || array.length < index+1) return Double.NaN;\r
+               return array[index];\r
        }\r
        \r
        @Override\r
@@ -29,7 +29,7 @@ public class  ValueIndexVariableI extends ValueIndexVariableBase<Double> {
                ensureInformationAvailable(graph);\r
                double[] existing = getValueFull();\r
                double[] newValue = Arrays.copyOf(existing, existing.length);\r
-               newValue[0] = (Double)value;\r
+               newValue[index] = (Double)value;\r
                super.setValue(graph, newValue);\r
        }\r
        \r