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