]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
For some reason Double values use now MutableDoubleBinding, hence input values are...
authorjplaine <jplaine@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Thu, 26 Aug 2010 07:55:05 +0000 (07:55 +0000)
committerjplaine <jplaine@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Thu, 26 Aug 2010 07:55:05 +0000 (07:55 +0000)
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@17642 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/DefaultVariable.java

index 0f859dd2aaaab22cb4b0d000e1853d6e24b30246..a8a3bf382f627be894f03334ee7c7dc8eb1cff2f 100644 (file)
@@ -3,6 +3,8 @@ package org.simantics.sysdyn.ui.project;
 import org.simantics.databoard.binding.Binding;\r
 import org.simantics.databoard.binding.java.DoubleBindingDefault;\r
 import org.simantics.databoard.binding.java.StringBindingDefault;\r
+import org.simantics.databoard.binding.mutable.MutableDouble;\r
+import org.simantics.databoard.binding.mutable.MutableDoubleBinding;\r
 import org.simantics.databoard.type.DataType;\r
 import org.simantics.databoard.type.DoubleType;\r
 import org.simantics.db.Builtins;\r
@@ -11,6 +13,7 @@ import org.simantics.db.Resource;
 import org.simantics.db.WriteGraph;\r
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.db.layer0.variable.ResourceVariable;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.sysdyn.SysdynResource;\r
 \r
 public class DefaultVariable extends ResourceVariable {\r
@@ -21,7 +24,7 @@ public class DefaultVariable extends ResourceVariable {
 \r
        @Override\r
        public <T> T getValue(ReadGraph graph) throws DatabaseException {\r
-               Builtins b = graph.getBuiltins();\r
+               Layer0 b = Layer0.getInstance(graph);\r
                SysdynResource sr = SysdynResource.getInstance(graph);\r
                Resource represents = graph.getPossibleObject(resource, b.Represents);\r
                if(represents == null) return null;\r
@@ -44,14 +47,15 @@ public class DefaultVariable extends ResourceVariable {
        public void setValue(WriteGraph graph, Object object, Binding binding) throws DatabaseException {\r
                Builtins b = graph.getBuiltins();\r
                SysdynResource sr = SysdynResource.getInstance(graph);\r
-               if(!DoubleBindingDefault.INSTANCE.equals(binding)) return;\r
+//             if(!DoubleBindingDefault.INSTANCE.equals(binding)) return;\r
+//             if(!MutableDoubleBinding.INSTANCE.equals(binding)) return;\r
                Resource represents = graph.getPossibleObject(resource, b.Represents);\r
                if(represents == null) return;\r
                Resource expression = graph.getPossibleObject(represents, sr.HasExpression);\r
                if(expression == null) return;\r
                if(!graph.isInstanceOf(expression, sr.ParameterExpression)) return;\r
-               Double value = (Double)object;\r
-               graph.claimValue(expression, sr.HasEquation, value.toString(), StringBindingDefault.INSTANCE);\r
+               Double value = new Double(((MutableDouble)object).doubleValue());\r
+               graph.claimLiteral(expression, sr.HasEquation, value.toString(), StringBindingDefault.INSTANCE);\r
        }\r
        \r
        @Override\r