SCLContext sclContext = SCLContext.getCurrent();
Object oldGraph = sclContext.get("graph");
try {
- CompileSCLMonitorRequest compileSCLMonitorRequest = new CompileSCLMonitorRequest(graph, context) {
- @Override
- protected String getExpressionText(ReadGraph graph) throws DatabaseException {
- return expression;
- }
- };
+ CompileSCLMonitorRequest compileSCLMonitorRequest = new ValidationCompilationRequest(graph, context, expression);
Function1<Variable,Object> exp = graph.syncRequest(compileSCLMonitorRequest);
sclContext.put("graph", graph);
//return exp.apply(context.getParent(graph));
return 100.0;
}
+ private static final class ValidationCompilationRequest extends CompileSCLMonitorRequest {
+ private final String expression;
+
+ private ValidationCompilationRequest(ReadGraph graph, Variable context, String expression)
+ throws DatabaseException {
+ super(graph, context);
+ this.expression = expression;
+ }
+
+ @Override
+ protected String getExpressionText(ReadGraph graph) throws DatabaseException {
+ return expression;
+ }
+
+ @Override
+ public int hashCode() {
+ return super.hashCode() + 37 * expression.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ return super.equals(obj) && ((ValidationCompilationRequest)obj).expression.equals(expression);
+ }
+ }
+
}
\ No newline at end of file