| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||||
| Evaluator |
|
| 1.0;1 |
| 1 | /* |
|
| 2 | * |
|
| 3 | * Copyright 2005 The Apache Software Foundation. |
|
| 4 | * |
|
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
|
| 6 | * you may not use this file except in compliance with the License. |
|
| 7 | * You may obtain a copy of the License at |
|
| 8 | * |
|
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
|
| 10 | * |
|
| 11 | * Unless required by applicable law or agreed to in writing, software |
|
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
|
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
| 14 | * See the License for the specific language governing permissions and |
|
| 15 | * limitations under the License. |
|
| 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 |