View Javadoc

    1   /*
    2    *
    3    *   Copyright 2005-2006 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  /***
    21   * The class in this SCXML object model that corresponds to the
    22   * &lt;history&gt; SCXML pseudo state element.
    23   *
    24   */
    25  public class History extends TransitionTarget {
    26
    27      /***
    28       * Whether this is a shallow or deep history, the default is shallow.
    29       */
    30      private boolean isDeep;
    31
    32      /***
    33       * A conditionless transition representing the default history state
    34       * and indicates the state to transition to if the parent state has
    35       * never been entered before.
    36       */
    37      private Transition transition;
    38
    39      /***
    40       * Default no-args constructor for XML Digester.
    41       */
    42      public History() {
    43          super();
    44      }
    45
    46      /***
    47       * Get the transition.
    48       *
    49       * @return Returns the transition.
    50       */
    51      public final Transition getTransition() {
    52          return transition;
    53      }
    54
    55      /***
    56       * Set the transition.
    57       *
    58       * @param transition The transition to set.
    59       */
    60      public final void setTransition(final Transition transition) {
    61          this.transition = transition;
    62      }
    63
    64      /***
    65       * Is this history &quot;deep&quot; (as against &quot;shallow&quot;).
    66       *
    67       * @return Returns whether this is a &quot;deep&quot; history
    68       */
    69      public final boolean isDeep() {
    70          return isDeep;
    71      }
    72
    73      /***
    74       * This method is invoked by XML digester when parsing SCXML markup.
    75       *
    76       * @param type The history type, which can be &quot;shallow&quot; or
    77       * &quot;deep&quot;
    78       */
    79      public final void setType(final String type) {
    80          if (type.equals("deep")) {
    81              isDeep = true;
    82          }
    83          //shallow is by default
    84      }
    85
    86  }
    87