1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.commons.scxml;
19
20 import org.w3c.dom.Node;
21
22 /***
23 * Interface for a component that may be used by the SCXML engines to
24 * evaluate the expressions within the SCXML document.
25 *
26 */
27 public interface Evaluator {
28
29 /***
30 * Evaluate an expression.
31 *
32 * @param ctx variable context
33 * @param expr expression
34 * @return a result of the evaluation
35 * @throws SCXMLExpressionException A malformed exception
36 */
37 Object eval(Context ctx, String expr)
38 throws SCXMLExpressionException;
39
40 /***
41 * Evaluate a condition.
42 * Manifests as "cond" attributes of <transition>,
43 * <if> and <elseif> elements.
44 *
45 * @param ctx variable context
46 * @param expr expression
47 * @return true/false
48 * @throws SCXMLExpressionException A malformed exception
49 */
50 Boolean evalCond(Context ctx, String expr)
51 throws SCXMLExpressionException;
52
53 /***
54 * Evaluate a location that returns a Node within an XML data tree.
55 * Manifests as "location" attributes of <assign> element.
56 *
57 * @param ctx variable context
58 * @param expr expression
59 * @return The location node.
60 * @throws SCXMLExpressionException A malformed exception
61 */
62 Node evalLocation(Context ctx, String expr)
63 throws SCXMLExpressionException;
64
65 /***
66 * Create a new child context.
67 *
68 * @param parent parent context
69 * @return new child context
70 */
71 Context newContext(Context parent);
72
73 }
74