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
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
\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
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