]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.modeling/src/org/simantics/modeling/TypeMonitorContext.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.modeling / src / org / simantics / modeling / TypeMonitorContext.java
index 8536f753ed8e86d0ec289875971f64f61d67b53c..2a9df74228b505a281a16af54d49b010860ad6c2 100644 (file)
@@ -1,95 +1,95 @@
-package org.simantics.modeling;\r
-\r
-\r
-public class TypeMonitorContext /*extends ContextModule*/ {\r
-/*     \r
-    public static SCLValue GET_MONITOR_METHOD;\r
-       static {\r
-               try {\r
-            GET_MONITOR_METHOD = ActualCompileRequest.ENVIRONMENT.getValueRef(ActualCompileRequest.CONTEXT_MODULE + "/getMonitorValue");\r
-               } catch (ValueNotFound e) {\r
-                       e.printStackTrace();\r
-               }\r
-       }       \r
-       \r
-       final private THashMap<String, Pair<String,Type>> properties;\r
-       \r
-       public TypeMonitorContext(THashMap<String, Pair<String,Type>> properties) {\r
-               super("MonitorContext");\r
-               this.properties = properties;\r
-       }\r
-\r
-       private Pair<String,Type> decodeProperty(String name) {\r
-\r
-           Pair<String,Type> entry = properties.get(name);\r
-               if(entry != null) return entry;\r
-               \r
-               String[] parts = name.split("\\.");\r
-               if(parts.length == 2) {\r
-                       return Pair.make("/" + parts[0] + "#" + parts[1], (Type)Types.DOUBLE);\r
-               }\r
-               \r
-               return null;\r
-               \r
-       }\r
-       \r
-       @Override\r
-       protected Expression createValueExpression(String name) {\r
-               \r
-           Pair<String,Type> entry = decodeProperty(name);\r
-               if(entry == null) return null;\r
-\r
-               return new EApply(Locations.NO_LOCATION,\r
-                               new EConstant(GET_MONITOR_METHOD, entry.second),\r
-                               new EGetContext(1, ActualCompileRequest.STRUCTURAL_COMPONENT),\r
-                               new EGetContext(0, ActualCompileRequest.READ_GRAPH_INTERNAL),\r
-                               new EExternalConstant(entry.first, Types.STRING)\r
-                               );\r
-       }\r
-\r
-       @Override\r
-       protected SCLValue createValue(String name) {\r
-               final SCLValue value = super.createValue(name);\r
-               if(value != null && value.getType().equals(Types.DOUBLE)) {\r
-                       TVar A = Types.var(Kinds.STAR);\r
-                       value.setType(\r
-                                       Types.forAll(A, \r
-                                                       Types.constrained(Types.pred(Types.REAL, A), A)\r
-                                                       ));\r
-                       value.setMacroRule(new BasicMacroRule(1) {\r
-                               @Override\r
-                               public Expression apply(SimplificationContext context,\r
-                                               Type[] typeParameters, Expression[] parameters) {\r
-                                       Expression result = new EApply(\r
-                                                       Locations.NO_LOCATION,\r
-                                                       new EConstant(ActualCompileRequest.FROM_DOUBLE, typeParameters[0]),\r
-                                                       parameters[0],\r
-                                                       value.getExpression().copy()\r
-                                                       );\r
-                                       return result;\r
-                               }\r
-                       });\r
-                       value.setInlineInSimplification(false);\r
-               }\r
-               return value;\r
-       }\r
-\r
-       @Override\r
-       public TypeConstructor getTypeConstructor(TCon type) {\r
-               if(type.name.equals("ReadGraph"))\r
-                       return ActualCompileRequest.READ_GRAPH_TYPE_CONSTRUCTOR;\r
-               if(type.name.equals("Resource"))\r
-                       return ActualCompileRequest.RESOURCE_TYPE_CONSTRUCTOR;\r
-        if(type.name.equals("Variable"))\r
-            return ActualCompileRequest.VARIABLE_TYPE_CONSTRUCTOR;\r
-               if(type.name.equals("Binding"))\r
-                       return ActualCompileRequest.BINDING_TYPE_CONSTRUCTOR;\r
-               return null;\r
-       }\r
-\r
-    @Override\r
-    public Collection<ImportDeclaration> getDependencies() {\r
-        return Collections.emptyList();\r
-    }\r
-*/\r
+package org.simantics.modeling;
+
+
+public class TypeMonitorContext /*extends ContextModule*/ {
+/*     
+    public static SCLValue GET_MONITOR_METHOD;
+       static {
+               try {
+            GET_MONITOR_METHOD = ActualCompileRequest.ENVIRONMENT.getValueRef(ActualCompileRequest.CONTEXT_MODULE + "/getMonitorValue");
+               } catch (ValueNotFound e) {
+                       e.printStackTrace();
+               }
+       }       
+       
+       final private THashMap<String, Pair<String,Type>> properties;
+       
+       public TypeMonitorContext(THashMap<String, Pair<String,Type>> properties) {
+               super("MonitorContext");
+               this.properties = properties;
+       }
+
+       private Pair<String,Type> decodeProperty(String name) {
+
+           Pair<String,Type> entry = properties.get(name);
+               if(entry != null) return entry;
+               
+               String[] parts = name.split("\\.");
+               if(parts.length == 2) {
+                       return Pair.make("/" + parts[0] + "#" + parts[1], (Type)Types.DOUBLE);
+               }
+               
+               return null;
+               
+       }
+       
+       @Override
+       protected Expression createValueExpression(String name) {
+               
+           Pair<String,Type> entry = decodeProperty(name);
+               if(entry == null) return null;
+
+               return new EApply(Locations.NO_LOCATION,
+                               new EConstant(GET_MONITOR_METHOD, entry.second),
+                               new EGetContext(1, ActualCompileRequest.STRUCTURAL_COMPONENT),
+                               new EGetContext(0, ActualCompileRequest.READ_GRAPH_INTERNAL),
+                               new EExternalConstant(entry.first, Types.STRING)
+                               );
+       }
+
+       @Override
+       protected SCLValue createValue(String name) {
+               final SCLValue value = super.createValue(name);
+               if(value != null && value.getType().equals(Types.DOUBLE)) {
+                       TVar A = Types.var(Kinds.STAR);
+                       value.setType(
+                                       Types.forAll(A, 
+                                                       Types.constrained(Types.pred(Types.REAL, A), A)
+                                                       ));
+                       value.setMacroRule(new BasicMacroRule(1) {
+                               @Override
+                               public Expression apply(SimplificationContext context,
+                                               Type[] typeParameters, Expression[] parameters) {
+                                       Expression result = new EApply(
+                                                       Locations.NO_LOCATION,
+                                                       new EConstant(ActualCompileRequest.FROM_DOUBLE, typeParameters[0]),
+                                                       parameters[0],
+                                                       value.getExpression().copy()
+                                                       );
+                                       return result;
+                               }
+                       });
+                       value.setInlineInSimplification(false);
+               }
+               return value;
+       }
+
+       @Override
+       public TypeConstructor getTypeConstructor(TCon type) {
+               if(type.name.equals("ReadGraph"))
+                       return ActualCompileRequest.READ_GRAPH_TYPE_CONSTRUCTOR;
+               if(type.name.equals("Resource"))
+                       return ActualCompileRequest.RESOURCE_TYPE_CONSTRUCTOR;
+        if(type.name.equals("Variable"))
+            return ActualCompileRequest.VARIABLE_TYPE_CONSTRUCTOR;
+               if(type.name.equals("Binding"))
+                       return ActualCompileRequest.BINDING_TYPE_CONSTRUCTOR;
+               return null;
+       }
+
+    @Override
+    public Collection<ImportDeclaration> getDependencies() {
+        return Collections.emptyList();
+    }
+*/
 }
\ No newline at end of file