##### Coverage Report - org.apache.commons.scxml.Context

Classes in this File | Line Coverage | Branch Coverage | Complexity
Context |
N/A |
N/A |
| 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 java.util.Map;
21 |  |
22 |  |
     /**
23 |  |
      * A Context or &quot;scope&quot; for storing variables; usually tied to
24 |  |
      * a SCXML root or State object.
25 |  |
      */
26 |  |
     public interface Context {
27 |  |
         /**
28 |  |
          * Assigns a new value to an existing variable or creates a new one.
29 |  |
          * The method searches the chain of parent Contexts for variable
30 |  |
          * existence.
31 |  |
          *
32 |  |
          * @param name The variable name
33 |  |
          * @param value The variable value
34 |  |
          */
35 |  |
         void set(String name, Object value);
36 |  |
37 |  |
         /**
38 |  |
          * Assigns a new value to an existing variable or creates a new one.
39 |  |
          * The method allows to shaddow a variable of the same name up the
40 |  |
          * Context chain.
41 |  |
          *
42 |  |
          * @param name The variable name
43 |  |
          * @param value The variable value
44 |  |
          */
45 |  |
         void setLocal(String name, Object value);
46 |  |
47 |  |
         /**
48 |  |
          * Get the value of this variable; delegating to parent.
49 |  |
          *
50 |  |
          * @param name The name of the variable
51 |  |
          * @return The value (or null)
52 |  |
          */
53 |  |
         Object get(String name);
54 |  |
55 |  |
         /**
56 |  |
          * Check if this variable exists, delegating to parent.
57 |  |
          *
58 |  |
          * @param name The name of the variable
59 |  |
          * @return Whether a variable with the name exists in this Context
60 |  |
          */
61 |  |
         boolean has(String name);
62 |  |
63 |  |
         /**
64 |  |
          * Get the Map of all variables in this Context.
65 |  |
          *
66 |  |
          * @return Local variable entries Map
67 |  |
          * To get variables in parent Context, call getParent().getVars().
68 |  |
          * @see #getParent()
69 |  |
          */
70 |  |
         Map getVars();
71 |  |
72 |  |
         /**
73 |  |
          * Clear this Context.
74 |  |
          */
75 |  |
         void reset();
76 |  |
77 |  |
         /**
78 |  |
          * Get the parent Context, may be null.
79 |  |
          *
80 |  |
          * @return The parent Context in a chained Context environment
81 |  |
          */
82 |  |
         Context getParent();
83 |  |
84 |  |
     }