]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.structural2/src/org/simantics/structural2/scl/ReadComponentTypeInterfaceRequest.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.structural2 / src / org / simantics / structural2 / scl / ReadComponentTypeInterfaceRequest.java
index 8180b3f1b13c6986f1a18a0fb24536180467f575..a93cbe8d4237abc857aa5bbbaa742d6c9b2b7929 100644 (file)
@@ -1,64 +1,64 @@
-package org.simantics.structural2.scl;\r
-\r
-import gnu.trove.map.hash.THashMap;\r
-\r
-import java.util.Map;\r
-\r
-import org.simantics.databoard.Bindings;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.common.request.ResourceRead;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.db.layer0.util.Layer0Utils;\r
-import org.simantics.layer0.Layer0;\r
-import org.simantics.scl.compiler.environment.Environment;\r
-import org.simantics.scl.compiler.environment.Environments;\r
-import org.simantics.scl.compiler.top.SCLExpressionCompilationException;\r
-import org.simantics.scl.compiler.types.Type;\r
-\r
-public class ReadComponentTypeInterfaceRequest extends ResourceRead<Map<String, ComponentTypeProperty>> {\r
-       \r
-    Environment environment;\r
-    \r
-       public ReadComponentTypeInterfaceRequest(Resource resource, Environment environment) {\r
-               super(resource);\r
-               this.environment = environment;\r
-       }\r
-\r
-       private void collect(ReadGraph graph, Resource t, THashMap<String, ComponentTypeProperty> result) throws DatabaseException {\r
-               Layer0 L0 = Layer0.getInstance(graph);\r
-               Map<String,Resource> domain = Layer0Utils.getDomainOf(graph, t); \r
-               for(Map.Entry<String, Resource> entry : domain.entrySet()) {\r
-                       String name = entry.getKey();\r
-                       Resource relation = entry.getValue();\r
-                       if(graph.isSubrelationOf(relation, L0.HasProperty)) {\r
-                               String typeName = graph.getPossibleRelatedValue(relation, L0.RequiresValueType, Bindings.STRING);\r
-                               if(typeName == null) continue;\r
-                               Type type;\r
-                               try {\r
-                                   type = Environments.getType(environment, typeName);\r
-                               } catch(SCLExpressionCompilationException e) {\r
-                                   e.printStackTrace();\r
-                                   continue;\r
-                               }\r
-                               ComponentTypeProperty property = new ComponentTypeProperty(relation, type);\r
-                               result.put(name, property);\r
-                       }\r
-               }\r
-       }\r
-       \r
-       @Override\r
-       public Map<String, ComponentTypeProperty> perform(ReadGraph graph)\r
-                       throws DatabaseException {\r
-               \r
-               THashMap<String, ComponentTypeProperty> result = \r
-                               new THashMap<String, ComponentTypeProperty>();\r
-               \r
-               collect(graph, resource, result);\r
-               //for(Resource t : graph.getSupertypes(resource)) collect(graph, t, result);\r
-               \r
-               return result;\r
-               \r
-       }\r
-\r
-}\r
+package org.simantics.structural2.scl;
+
+import gnu.trove.map.hash.THashMap;
+
+import java.util.Map;
+
+import org.simantics.databoard.Bindings;
+import org.simantics.db.ReadGraph;
+import org.simantics.db.Resource;
+import org.simantics.db.common.request.ResourceRead;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.db.layer0.util.Layer0Utils;
+import org.simantics.layer0.Layer0;
+import org.simantics.scl.compiler.environment.Environment;
+import org.simantics.scl.compiler.environment.Environments;
+import org.simantics.scl.compiler.top.SCLExpressionCompilationException;
+import org.simantics.scl.compiler.types.Type;
+
+public class ReadComponentTypeInterfaceRequest extends ResourceRead<Map<String, ComponentTypeProperty>> {
+       
+    Environment environment;
+    
+       public ReadComponentTypeInterfaceRequest(Resource resource, Environment environment) {
+               super(resource);
+               this.environment = environment;
+       }
+
+       private void collect(ReadGraph graph, Resource t, THashMap<String, ComponentTypeProperty> result) throws DatabaseException {
+               Layer0 L0 = Layer0.getInstance(graph);
+               Map<String,Resource> domain = Layer0Utils.getDomainOf(graph, t); 
+               for(Map.Entry<String, Resource> entry : domain.entrySet()) {
+                       String name = entry.getKey();
+                       Resource relation = entry.getValue();
+                       if(graph.isSubrelationOf(relation, L0.HasProperty)) {
+                               String typeName = graph.getPossibleRelatedValue(relation, L0.RequiresValueType, Bindings.STRING);
+                               if(typeName == null) continue;
+                               Type type;
+                               try {
+                                   type = Environments.getType(environment, typeName);
+                               } catch(SCLExpressionCompilationException e) {
+                                   e.printStackTrace();
+                                   continue;
+                               }
+                               ComponentTypeProperty property = new ComponentTypeProperty(relation, type);
+                               result.put(name, property);
+                       }
+               }
+       }
+       
+       @Override
+       public Map<String, ComponentTypeProperty> perform(ReadGraph graph)
+                       throws DatabaseException {
+               
+               THashMap<String, ComponentTypeProperty> result = 
+                               new THashMap<String, ComponentTypeProperty>();
+               
+               collect(graph, resource, result);
+               //for(Resource t : graph.getSupertypes(resource)) collect(graph, t, result);
+               
+               return result;
+               
+       }
+
+}