Fixed typo from build.p2.site org.apache.lucene4.queryparser definition
[simantics/platform.git] / bundles / org.simantics.scl.runtime / src / org / simantics / scl / runtime / equations / EquationContext.java
1 package org.simantics.scl.runtime.equations;\r
2 \r
3 import org.simantics.scl.runtime.SCLContext;\r
4 import org.simantics.scl.runtime.function.Function;\r
5 import org.simantics.scl.runtime.tuple.Tuple0;\r
6 \r
7 public interface EquationContext {\r
8     void listenEquationVariable(String variableName, Function callback);\r
9     void setEquationVariable(String variableName, Object value);\r
10     \r
11     public static Object applyEquationContext(Function f, EquationContext equationContext) {\r
12         SCLContext context = SCLContext.getCurrent();\r
13         Object oldEquationContext = context.put("equation", equationContext);\r
14         try {\r
15             return f.apply(Tuple0.INSTANCE);\r
16         } finally {\r
17             context.put("equation", oldEquationContext);\r
18         }\r
19     }\r
20 }\r