##### 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 |  |
      * Licensed to the Apache Software Foundation (ASF) under one or more
3 |  |
      * contributor license agreements.  See the NOTICE file distributed with
4 |  |
      * this work for additional information regarding copyright ownership.
5 |  |
      * The ASF licenses this file to You under the Apache License, Version 2.0
6 |  |
      * (the "License"); you may not use this file except in compliance with
7 |  |
      * the License.  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 |  |
     package org.apache.commons.scxml;
18 |  |
19 |  |
     import java.util.Map;
20 |  |
21 |  |
     /**
22 |  |
      * A Context or &quot;scope&quot; for storing variables; usually tied to
23 |  |
      * a SCXML root or State object.
24 |  |
      */
25 |  |
     public interface Context {
26 |  |
         /**
27 |  |
          * Assigns a new value to an existing variable or creates a new one.
28 |  |
          * The method searches the chain of parent Contexts for variable
29 |  |
          * existence.
30 |  |
          *
31 |  |
          * @param name The variable name
32 |  |
          * @param value The variable value
33 |  |
          */
34 |  |
         void set(String name, Object value);
35 |  |
36 |  |
         /**
37 |  |
          * Assigns a new value to an existing variable or creates a new one.
38 |  |
          * The method allows to shaddow a variable of the same name up the
39 |  |
          * Context chain.
40 |  |
          *
41 |  |
          * @param name The variable name
42 |  |
          * @param value The variable value
43 |  |
          */
44 |  |
         void setLocal(String name, Object value);
45 |  |
46 |  |
         /**
47 |  |
          * Get the value of this variable; delegating to parent.
48 |  |
          *
49 |  |
          * @param name The name of the variable
50 |  |
          * @return The value (or null)
51 |  |
          */
52 |  |
         Object get(String name);
53 |  |
54 |  |
         /**
55 |  |
          * Check if this variable exists, delegating to parent.
56 |  |
          *
57 |  |
          * @param name The name of the variable
58 |  |
          * @return Whether a variable with the name exists in this Context
59 |  |
          */
60 |  |
         boolean has(String name);
61 |  |
62 |  |
         /**
63 |  |
          * Get the Map of all variables in this Context.
64 |  |
          *
65 |  |
          * @return Local variable entries Map
66 |  |
          * To get variables in parent Context, call getParent().getVars().
67 |  |
          * @see #getParent()
68 |  |
          */
69 |  |
         Map getVars();
70 |  |
71 |  |
         /**
72 |  |
          * Clear this Context.
73 |  |
          */
74 |  |
         void reset();
75 |  |
76 |  |
         /**
77 |  |
          * Get the parent Context, may be null.
78 |  |
          *
79 |  |
          * @return The parent Context in a chained Context environment
80 |  |
          */
81 |  |
         Context getParent();
82 |  |
83 |  |
     }