diff options
Diffstat (limited to 'subprojects/viatra-runtime-matchers/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/IExpressionEvaluator.java')
-rw-r--r-- | subprojects/viatra-runtime-matchers/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/IExpressionEvaluator.java | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/subprojects/viatra-runtime-matchers/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/IExpressionEvaluator.java b/subprojects/viatra-runtime-matchers/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/IExpressionEvaluator.java new file mode 100644 index 00000000..686999f7 --- /dev/null +++ b/subprojects/viatra-runtime-matchers/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/IExpressionEvaluator.java | |||
@@ -0,0 +1,42 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010-2013, Zoltan Ujhelyi, Istvan Rath and Daniel Varro | ||
3 | * This program and the accompanying materials are made available under the | ||
4 | * terms of the Eclipse Public License v. 2.0 which is available at | ||
5 | * http://www.eclipse.org/legal/epl-v20.html. | ||
6 | * | ||
7 | * SPDX-License-Identifier: EPL-2.0 | ||
8 | *******************************************************************************/ | ||
9 | package tools.refinery.viatra.runtime.matchers.psystem; | ||
10 | |||
11 | /** | ||
12 | * An expression evaluator is used to execute arbitrary Java code during pattern matching. In order to include the | ||
13 | * evaluation in the planning seemlessly it is expected from the evaluator implementors to report all used PVariables by | ||
14 | * name. | ||
15 | * | ||
16 | * @author Zoltan Ujhelyi | ||
17 | * | ||
18 | */ | ||
19 | public interface IExpressionEvaluator { | ||
20 | |||
21 | /** | ||
22 | * A textual description of the expression. Used only for debug purposes, but must not be null. | ||
23 | */ | ||
24 | String getShortDescription(); | ||
25 | |||
26 | /** | ||
27 | * All input parameter names should be reported correctly. | ||
28 | */ | ||
29 | Iterable<String> getInputParameterNames(); | ||
30 | |||
31 | /** | ||
32 | * The expression evaluator code | ||
33 | * | ||
34 | * @param provider | ||
35 | * the value provider is an engine-specific way of reading internal variable tuples to evaluate the | ||
36 | * expression with | ||
37 | * @return the result of the expression: in case of predicate evaluation the return value must be true or false; | ||
38 | * otherwise the result can be an arbitrary object. No null values should be returned. | ||
39 | * @throws Exception | ||
40 | */ | ||
41 | Object evaluateExpression(IValueProvider provider) throws Exception; | ||
42 | } | ||