From 2bceaba2296f93adee751e9a76ad62916ea06177 Mon Sep 17 00:00:00 2001 From: jplaine Date: Thu, 26 Aug 2010 07:55:05 +0000 Subject: [PATCH] For some reason Double values use now MutableDoubleBinding, hence input values are now treated as MutableDouble objects .. hopefully works git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@17642 ac1ea38d-2e2b-0410-8846-a27921b304fc --- .../simantics/sysdyn/ui/project/DefaultVariable.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/DefaultVariable.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/DefaultVariable.java index 0f859dd2..a8a3bf38 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/DefaultVariable.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/DefaultVariable.java @@ -3,6 +3,8 @@ package org.simantics.sysdyn.ui.project; import org.simantics.databoard.binding.Binding; import org.simantics.databoard.binding.java.DoubleBindingDefault; import org.simantics.databoard.binding.java.StringBindingDefault; +import org.simantics.databoard.binding.mutable.MutableDouble; +import org.simantics.databoard.binding.mutable.MutableDoubleBinding; import org.simantics.databoard.type.DataType; import org.simantics.databoard.type.DoubleType; import org.simantics.db.Builtins; @@ -11,6 +13,7 @@ import org.simantics.db.Resource; import org.simantics.db.WriteGraph; import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.variable.ResourceVariable; +import org.simantics.layer0.Layer0; import org.simantics.sysdyn.SysdynResource; public class DefaultVariable extends ResourceVariable { @@ -21,7 +24,7 @@ public class DefaultVariable extends ResourceVariable { @Override public T getValue(ReadGraph graph) throws DatabaseException { - Builtins b = graph.getBuiltins(); + Layer0 b = Layer0.getInstance(graph); SysdynResource sr = SysdynResource.getInstance(graph); Resource represents = graph.getPossibleObject(resource, b.Represents); if(represents == null) return null; @@ -44,14 +47,15 @@ public class DefaultVariable extends ResourceVariable { public void setValue(WriteGraph graph, Object object, Binding binding) throws DatabaseException { Builtins b = graph.getBuiltins(); SysdynResource sr = SysdynResource.getInstance(graph); - if(!DoubleBindingDefault.INSTANCE.equals(binding)) return; +// if(!DoubleBindingDefault.INSTANCE.equals(binding)) return; +// if(!MutableDoubleBinding.INSTANCE.equals(binding)) return; Resource represents = graph.getPossibleObject(resource, b.Represents); if(represents == null) return; Resource expression = graph.getPossibleObject(represents, sr.HasExpression); if(expression == null) return; if(!graph.isInstanceOf(expression, sr.ParameterExpression)) return; - Double value = (Double)object; - graph.claimValue(expression, sr.HasEquation, value.toString(), StringBindingDefault.INSTANCE); + Double value = new Double(((MutableDouble)object).doubleValue()); + graph.claimLiteral(expression, sr.HasEquation, value.toString(), StringBindingDefault.INSTANCE); } @Override -- 2.47.1