]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Removed equations context from org.simantics.scl.runtime 38/38/2
authorHannu Niemistö <hannu.niemisto@semantum.fi>
Thu, 18 Aug 2016 16:21:08 +0000 (19:21 +0300)
committerHannu Niemistö <hannu.niemisto@semantum.fi>
Fri, 19 Aug 2016 07:06:34 +0000 (10:06 +0300)
Change-Id: I0c7c3a6d1abd4f9c7c4039e3e666d591b83c6f0c

bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/types/Types.java
bundles/org.simantics.scl.runtime/META-INF/MANIFEST.MF
bundles/org.simantics.scl.runtime/scl/Expressions/Equations.scl [deleted file]
bundles/org.simantics.scl.runtime/src/org/simantics/scl/runtime/equations/EquationContext.java [deleted file]
bundles/org.simantics.scl.runtime/src/org/simantics/scl/runtime/equations/TestEquationContext.java [deleted file]

index f0c9dbddfb2e1383ff746aa9b1a1ce7f1f12e552..5e332742ab29debd7f8c3674c4b2ac38f993448f 100644 (file)
@@ -86,6 +86,8 @@ public class Types {
     public static final TCon VEC_COMP = con(BUILTIN, "VecComp");
     public static final TCon BINDING = con(BUILTIN, "Binding");
 
+    public static final TCon TYPE = con(BUILTIN, "Type");
+    
     public static final TCon DYNAMIC = con("Prelude", "Dynamic");
     public static final TCon VARIANT = con(BUILTIN, "Variant");
     
index d88e4403a2c85fc1405ad860ea690ac2471a66f1..64d5ac63dbeccba336c6b73cc6fd463e016a9497 100755 (executable)
@@ -6,7 +6,6 @@ Bundle-Version: 0.4.0.qualifier
 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
 Export-Package: org.simantics.scl.runtime,
  org.simantics.scl.runtime.collection,
- org.simantics.scl.runtime.equations,
  org.simantics.scl.runtime.exceptions,
  org.simantics.scl.runtime.function,
  org.simantics.scl.runtime.io,
diff --git a/bundles/org.simantics.scl.runtime/scl/Expressions/Equations.scl b/bundles/org.simantics.scl.runtime/scl/Expressions/Equations.scl
deleted file mode 100644 (file)
index e695a00..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-effect Equation\r
-    "equation"\r
-    "org.simantics.scl.runtime.equations.EquationContext"\r
-\r
-importJava "org.simantics.scl.runtime.equations.EquationContext" where\r
-    data EquationContext\r
-\r
-    listenEquationVariable :: String -> (a -> <Equation,Proc> ()) -> <Equation,Proc> ()\r
-    setEquationVariable :: String -> a -> <Equation> ()\r
-    applyEquationContext :: (<Equation,Proc> a) -> EquationContext -> <Proc> a \r
-    \r
-importJava "org.simantics.scl.runtime.equations.TestEquationContext" where\r
-    solveEquations :: (<Equation,e> a) -> <e> [(String,String)]
\ No newline at end of file
diff --git a/bundles/org.simantics.scl.runtime/src/org/simantics/scl/runtime/equations/EquationContext.java b/bundles/org.simantics.scl.runtime/src/org/simantics/scl/runtime/equations/EquationContext.java
deleted file mode 100644 (file)
index f20dd6f..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-package org.simantics.scl.runtime.equations;\r
-\r
-import org.simantics.scl.runtime.SCLContext;\r
-import org.simantics.scl.runtime.function.Function;\r
-import org.simantics.scl.runtime.tuple.Tuple0;\r
-\r
-public interface EquationContext {\r
-    void listenEquationVariable(String variableName, Function callback);\r
-    void setEquationVariable(String variableName, Object value);\r
-    \r
-    public static Object applyEquationContext(Function f, EquationContext equationContext) {\r
-        SCLContext context = SCLContext.getCurrent();\r
-        Object oldEquationContext = context.put("equation", equationContext);\r
-        try {\r
-            return f.apply(Tuple0.INSTANCE);\r
-        } finally {\r
-            context.put("equation", oldEquationContext);\r
-        }\r
-    }\r
-}\r
diff --git a/bundles/org.simantics.scl.runtime/src/org/simantics/scl/runtime/equations/TestEquationContext.java b/bundles/org.simantics.scl.runtime/src/org/simantics/scl/runtime/equations/TestEquationContext.java
deleted file mode 100644 (file)
index 856ef28..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-package org.simantics.scl.runtime.equations;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collections;\r
-import java.util.List;\r
-\r
-import org.simantics.scl.runtime.SCLContext;\r
-import org.simantics.scl.runtime.function.Function;\r
-import org.simantics.scl.runtime.tuple.Tuple0;\r
-import org.simantics.scl.runtime.tuple.Tuple2;\r
-\r
-import gnu.trove.map.hash.THashMap;\r
-import gnu.trove.procedure.TObjectObjectProcedure;\r
-\r
-public class TestEquationContext implements EquationContext {\r
-\r
-    public static final boolean TRACE = true;\r
-    \r
-    THashMap<String, Object> values = new THashMap<String, Object>(); \r
-    THashMap<String, ArrayList<Function>> listenerMap = new THashMap<String, ArrayList<Function>>(); \r
-\r
-    @Override\r
-    public void listenEquationVariable(String variableName, Function listener) {\r
-        if(TRACE)\r
-            System.out.println("listenEquationVariable(" + variableName + ", " + listener + ")");\r
-        if(values.containsKey(variableName)) {\r
-            Object value = values.get(variableName);\r
-            if(TRACE)\r
-                System.out.println("    apply " + value);\r
-            listener.apply(value);\r
-        }\r
-        else {\r
-            if(TRACE)\r
-                System.out.println("    add listener");\r
-            ArrayList<Function> listeners = listenerMap.get(variableName);\r
-            if(listeners == null) {\r
-                listeners = new ArrayList<Function>();\r
-                listenerMap.put(variableName, listeners);\r
-            }\r
-            listeners.add(listener);\r
-        }\r
-    }\r
-\r
-    @Override\r
-    public void setEquationVariable(String variableName, Object value) {\r
-        if(TRACE)\r
-            System.out.println("setEquationVariable(" + variableName + ", " + value + ")");\r
-        if(values.containsKey(variableName))\r
-            throw new IllegalStateException("Value for " + variableName + " already defined (oldValue=" + values.get(variableName) + \r
-                    ", newValue=" + value + ").");\r
-        values.put(variableName, value);\r
-        ArrayList<Function> listeners = listenerMap.remove(variableName);\r
-        SCLContext context = SCLContext.getCurrent();\r
-        if(listeners != null) {\r
-            Object oldEquationContex = context.put("equation", this);\r
-            try {\r
-                for(Function listener : listeners) {\r
-                    if(TRACE)\r
-                        System.out.println("    apply " + listener + " " + value);\r
-                    listener.apply(value);\r
-                }\r
-            } finally {\r
-                context.put("equation", oldEquationContex);\r
-            }\r
-        }\r
-    }\r
-    \r
-    public static List<Tuple2> solveEquations(Function f) {\r
-        TestEquationContext equationContext = new TestEquationContext();\r
-        SCLContext context = SCLContext.getCurrent();\r
-        Object oldEquationContext = context.put("equation", equationContext);\r
-        try {\r
-            f.apply(Tuple0.INSTANCE);\r
-        } finally {\r
-            context.put("equation", oldEquationContext);\r
-        }\r
-        ArrayList<Tuple2> result = new ArrayList<Tuple2>(equationContext.values.size());\r
-        equationContext.values.forEachEntry(new TObjectObjectProcedure<String, Object>() {\r
-            @Override\r
-            public boolean execute(String a, Object b) {\r
-                result.add(new Tuple2(a, String.valueOf(b)));\r
-                return true;\r
-            }\r
-        });\r
-        Collections.sort(result, (t1, t2) -> {\r
-            return ((String)t1.c0).compareTo((String)t2.c0);\r
-        });\r
-        return result;\r
-    }\r
-    \r
-    public THashMap<String, Object> getValues() {\r
-        return values;\r
-    }\r
-\r
-}\r