View Javadoc

    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.model;
    19
    20  import java.util.HashSet;
    21  import java.util.Set;
    22
    23  /***
    24   * The class in this SCXML object model that corresponds to the
    25   * &lt;parallel&gt; SCXML element, which is a wrapper element to
    26   * encapsulate parallel state machines. For the &lt;parallel&gt; element
    27   * to be useful, each of its &lt;state&gt; substates must itself be
    28   * complex, that is, one with either &lt;state&gt; or &lt;parallel&gt;
    29   * children.
    30   *
    31   */
    32  public class Parallel extends TransitionTarget {
    33
    34      /***
    35       * The set of parallel state machines contained in this &lt;parallel&gt;.
    36       */
    37      private Set states;
    38
    39      /***
    40       * Constructor.
    41       */
    42      public Parallel() {
    43          this.states = new HashSet();
    44      }
    45
    46      /***
    47       * Get the set of parallel state machines contained in this Parallel.
    48       *
    49       * @return Returns the state.
    50       */
    51      public final Set getStates() {
    52          return states;
    53      }
    54
    55      /***
    56       * Add a State to the list of parallel state machines contained
    57       * in this Parallel.
    58       *
    59       * @param state The state to add.
    60       */
    61      public final void addState(final State state) {
    62          if (state != null) {
    63              this.states.add(state);
    64          }
    65      }
    66
    67  }
    68