]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/SCLValueAccessor.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.db.layer0 / src / org / simantics / db / layer0 / variable / SCLValueAccessor.java
index 82dcec1c63485c4dc38565a5f886dd2f8dc2861e..5d4915d94035d204ba0c966dd949ebfc0d55256f 100644 (file)
@@ -1,96 +1,96 @@
-package org.simantics.db.layer0.variable;\r
-\r
-import org.simantics.databoard.binding.Binding;\r
-import org.simantics.databoard.type.Datatype;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.WriteGraph;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.scl.runtime.SCLContext;\r
-import org.simantics.scl.runtime.function.Function1;\r
-import org.simantics.scl.runtime.function.Function2;\r
-import org.simantics.scl.runtime.function.Function3;\r
-\r
-public class SCLValueAccessor implements ValueAccessor {\r
-\r
-       private final Function1<Variable,Object> getValue1;\r
-       private final Function2<Variable,Binding,Object> getValue2;\r
-       private final Function2<Variable,Object,Object> setValue2;\r
-       private final Function3<Variable,Object,Binding,Object> setValue3;\r
-       private final Function1<Variable,Datatype> getDatatype;\r
-       \r
-       public SCLValueAccessor(Function1<Variable, Object> getValue1, Function2<Variable, Binding, Object> getValue2,\r
-                       Function2<Variable, Object, Object> setValue2, Function3<Variable, Object, Binding, Object> setValue3,\r
-                       Function1<Variable, Datatype> getDatatype) {\r
-               this.getValue1 = getValue1;\r
-               this.getValue2 = getValue2;\r
-               this.setValue2 = setValue2;\r
-               this.setValue3 = setValue3;\r
-               this.getDatatype = getDatatype;\r
-       }\r
-\r
-       @Override\r
-       public Object getValue(ReadGraph graph, Variable context) throws DatabaseException {\r
-        SCLContext sclContext = SCLContext.getCurrent();\r
-        Object oldGraph = sclContext.put("graph", graph);\r
-        try {\r
-            return getValue1.apply(context);\r
-        } catch (Throwable t) {\r
-            throw new DatabaseException(t);\r
-        } finally {\r
-            sclContext.put("graph", oldGraph);\r
-        }\r
-       }\r
-\r
-       @Override\r
-       public Object getValue(ReadGraph graph, Variable context, Binding binding) throws DatabaseException {\r
-        SCLContext sclContext = SCLContext.getCurrent();\r
-        Object oldGraph = sclContext.put("graph", graph);\r
-        try {\r
-            return getValue2.apply(context, binding);\r
-        } catch (Throwable t) {\r
-            throw new DatabaseException(t);\r
-        } finally {\r
-            sclContext.put("graph", oldGraph);\r
-        }\r
-       }\r
-\r
-       @Override\r
-       public void setValue(WriteGraph graph, Variable context, Object value) throws DatabaseException {\r
-        SCLContext sclContext = SCLContext.getCurrent();\r
-        Object oldGraph = sclContext.put("graph", graph);\r
-        try {\r
-            setValue2.apply(context, value);\r
-        } catch (Throwable t) {\r
-            throw new DatabaseException(t);\r
-        } finally {\r
-            sclContext.put("graph", oldGraph);\r
-        }\r
-       }\r
-\r
-       @Override\r
-       public void setValue(WriteGraph graph, Variable context, Object value, Binding binding) throws DatabaseException {\r
-        SCLContext sclContext = SCLContext.getCurrent();\r
-        Object oldGraph = sclContext.put("graph", graph);\r
-        try {\r
-            setValue3.apply(context, value, binding);\r
-        } catch (Throwable t) {\r
-            throw new DatabaseException(t);\r
-        } finally {\r
-            sclContext.put("graph", oldGraph);\r
-        }\r
-       }\r
-\r
-       @Override\r
-       public Datatype getDatatype(ReadGraph graph, Variable context) throws DatabaseException {\r
-        SCLContext sclContext = SCLContext.getCurrent();\r
-        Object oldGraph = sclContext.put("graph", graph);\r
-        try {\r
-            return getDatatype.apply(context);\r
-        } catch (Throwable t) {\r
-            throw new DatabaseException(t);\r
-        } finally {\r
-            sclContext.put("graph", oldGraph);\r
-        }\r
-       }\r
-\r
-}\r
+package org.simantics.db.layer0.variable;
+
+import org.simantics.databoard.binding.Binding;
+import org.simantics.databoard.type.Datatype;
+import org.simantics.db.ReadGraph;
+import org.simantics.db.WriteGraph;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.scl.runtime.SCLContext;
+import org.simantics.scl.runtime.function.Function1;
+import org.simantics.scl.runtime.function.Function2;
+import org.simantics.scl.runtime.function.Function3;
+
+public class SCLValueAccessor implements ValueAccessor {
+
+       private final Function1<Variable,Object> getValue1;
+       private final Function2<Variable,Binding,Object> getValue2;
+       private final Function2<Variable,Object,Object> setValue2;
+       private final Function3<Variable,Object,Binding,Object> setValue3;
+       private final Function1<Variable,Datatype> getDatatype;
+       
+       public SCLValueAccessor(Function1<Variable, Object> getValue1, Function2<Variable, Binding, Object> getValue2,
+                       Function2<Variable, Object, Object> setValue2, Function3<Variable, Object, Binding, Object> setValue3,
+                       Function1<Variable, Datatype> getDatatype) {
+               this.getValue1 = getValue1;
+               this.getValue2 = getValue2;
+               this.setValue2 = setValue2;
+               this.setValue3 = setValue3;
+               this.getDatatype = getDatatype;
+       }
+
+       @Override
+       public Object getValue(ReadGraph graph, Variable context) throws DatabaseException {
+        SCLContext sclContext = SCLContext.getCurrent();
+        Object oldGraph = sclContext.put("graph", graph);
+        try {
+            return getValue1.apply(context);
+        } catch (Throwable t) {
+            throw new DatabaseException(t);
+        } finally {
+            sclContext.put("graph", oldGraph);
+        }
+       }
+
+       @Override
+       public Object getValue(ReadGraph graph, Variable context, Binding binding) throws DatabaseException {
+        SCLContext sclContext = SCLContext.getCurrent();
+        Object oldGraph = sclContext.put("graph", graph);
+        try {
+            return getValue2.apply(context, binding);
+        } catch (Throwable t) {
+            throw new DatabaseException(t);
+        } finally {
+            sclContext.put("graph", oldGraph);
+        }
+       }
+
+       @Override
+       public void setValue(WriteGraph graph, Variable context, Object value) throws DatabaseException {
+        SCLContext sclContext = SCLContext.getCurrent();
+        Object oldGraph = sclContext.put("graph", graph);
+        try {
+            setValue2.apply(context, value);
+        } catch (Throwable t) {
+            throw new DatabaseException(t);
+        } finally {
+            sclContext.put("graph", oldGraph);
+        }
+       }
+
+       @Override
+       public void setValue(WriteGraph graph, Variable context, Object value, Binding binding) throws DatabaseException {
+        SCLContext sclContext = SCLContext.getCurrent();
+        Object oldGraph = sclContext.put("graph", graph);
+        try {
+            setValue3.apply(context, value, binding);
+        } catch (Throwable t) {
+            throw new DatabaseException(t);
+        } finally {
+            sclContext.put("graph", oldGraph);
+        }
+       }
+
+       @Override
+       public Datatype getDatatype(ReadGraph graph, Variable context) throws DatabaseException {
+        SCLContext sclContext = SCLContext.getCurrent();
+        Object oldGraph = sclContext.put("graph", graph);
+        try {
+            return getDatatype.apply(context);
+        } catch (Throwable t) {
+            throw new DatabaseException(t);
+        } finally {
+            sclContext.put("graph", oldGraph);
+        }
+       }
+
+}