]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.graph.compiler/src/org/simantics/graph/compiler/internal/store/PreValueStore.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.graph.compiler / src / org / simantics / graph / compiler / internal / store / PreValueStore.java
index 923fd9698d29003ea89d67a39e78995c4f37f1dd..8691588138e5dce4a258844a42ad03aae70fc937 100644 (file)
@@ -1,76 +1,76 @@
-package org.simantics.graph.compiler.internal.store;\r
-\r
-import gnu.trove.map.hash.TIntIntHashMap;\r
-import gnu.trove.map.hash.TIntObjectHashMap;\r
-import gnu.trove.procedure.TIntObjectProcedure;\r
-import gnu.trove.set.hash.TIntHashSet;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-\r
-import org.simantics.databoard.Bindings;\r
-import org.simantics.databoard.binding.Binding;\r
-import org.simantics.databoard.binding.mutable.Variant;\r
-import org.simantics.graph.compiler.internal.values.TreeValue;\r
-import org.simantics.graph.query.IDataTypeQuery;\r
-import org.simantics.graph.store.IStore;\r
-import org.simantics.graph.store.IndexMappingUtils;\r
-import org.simantics.graph.store.ValueStore;\r
-import org.simantics.ltk.Problem;\r
-\r
-public class PreValueStore implements IStore {\r
-\r
-       TIntObjectHashMap<IPreValue> preValues = new TIntObjectHashMap<IPreValue>();\r
-       TIntHashSet collisions = new TIntHashSet();\r
-       \r
-       @Override\r
-       public void map(TIntIntHashMap map) {\r
-               preValues = IndexMappingUtils.map(map, preValues, collisions);\r
-       }\r
-       \r
-       public void setValue(int id, IPreValue value) {\r
-               preValues.put(id, value);\r
-       }\r
-       \r
-       public void convertPreValues(final ValueStore values, final IDataTypeQuery dtq, final Collection<Problem> problems) {\r
-               preValues.forEachEntry(new TIntObjectProcedure<IPreValue>() {                   \r
-                       @Override\r
-                       public boolean execute(int resource, IPreValue preValue) {\r
-                               try {\r
-                                       Binding binding = dtq.getDataType(resource);\r
-                                       if(binding == null) {\r
-                                               problems.add(new Problem(\r
-                                                               preValue.getLocation(), \r
-                                                               "Literal does not have a data type."\r
-                                                       ));     \r
-                                               return true;\r
-                                       }\r
-                                       Object value = preValue.toValue(binding, problems);\r
-                                       values.setValue(resource,\r
-                                                       new Variant(binding, value)\r
-                                                       );                                              \r
-                               } catch(Exception e) {\r
-                                       e.printStackTrace();\r
-                               }\r
-                               return true;\r
-                       }\r
-               });\r
-               preValues.clear();\r
-       }\r
-       \r
-       public void forEachPreValue(TIntObjectProcedure<IPreValue> procedure) {\r
-               preValues.forEachEntry(procedure);\r
-       }\r
-       \r
-       public String getStringValue(int i) {\r
-               IPreValue value = preValues.get(i);\r
-               if(value == null || !(value instanceof TreeValue))\r
-                       return null;\r
-               ArrayList<Problem> problems = new ArrayList<Problem>();\r
-               String v = (String) ((TreeValue)value).toValue(Bindings.STRING, problems);\r
-               if(v == null || problems.size()>0)\r
-                       return null;\r
-               return v;\r
-       }\r
-\r
-}\r
+package org.simantics.graph.compiler.internal.store;
+
+import gnu.trove.map.hash.TIntIntHashMap;
+import gnu.trove.map.hash.TIntObjectHashMap;
+import gnu.trove.procedure.TIntObjectProcedure;
+import gnu.trove.set.hash.TIntHashSet;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.simantics.databoard.Bindings;
+import org.simantics.databoard.binding.Binding;
+import org.simantics.databoard.binding.mutable.Variant;
+import org.simantics.graph.compiler.internal.values.TreeValue;
+import org.simantics.graph.query.IDataTypeQuery;
+import org.simantics.graph.store.IStore;
+import org.simantics.graph.store.IndexMappingUtils;
+import org.simantics.graph.store.ValueStore;
+import org.simantics.ltk.Problem;
+
+public class PreValueStore implements IStore {
+
+       TIntObjectHashMap<IPreValue> preValues = new TIntObjectHashMap<IPreValue>();
+       TIntHashSet collisions = new TIntHashSet();
+       
+       @Override
+       public void map(TIntIntHashMap map) {
+               preValues = IndexMappingUtils.map(map, preValues, collisions);
+       }
+       
+       public void setValue(int id, IPreValue value) {
+               preValues.put(id, value);
+       }
+       
+       public void convertPreValues(final ValueStore values, final IDataTypeQuery dtq, final Collection<Problem> problems) {
+               preValues.forEachEntry(new TIntObjectProcedure<IPreValue>() {                   
+                       @Override
+                       public boolean execute(int resource, IPreValue preValue) {
+                               try {
+                                       Binding binding = dtq.getDataType(resource);
+                                       if(binding == null) {
+                                               problems.add(new Problem(
+                                                               preValue.getLocation(), 
+                                                               "Literal does not have a data type."
+                                                       ));     
+                                               return true;
+                                       }
+                                       Object value = preValue.toValue(binding, problems);
+                                       values.setValue(resource,
+                                                       new Variant(binding, value)
+                                                       );                                              
+                               } catch(Exception e) {
+                                       e.printStackTrace();
+                               }
+                               return true;
+                       }
+               });
+               preValues.clear();
+       }
+       
+       public void forEachPreValue(TIntObjectProcedure<IPreValue> procedure) {
+               preValues.forEachEntry(procedure);
+       }
+       
+       public String getStringValue(int i) {
+               IPreValue value = preValues.get(i);
+               if(value == null || !(value instanceof TreeValue))
+                       return null;
+               ArrayList<Problem> problems = new ArrayList<Problem>();
+               String v = (String) ((TreeValue)value).toValue(Bindings.STRING, problems);
+               if(v == null || problems.size()>0)
+                       return null;
+               return v;
+       }
+
+}