| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||||||
| History |
|
| 1.2;1.2 |
| 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 | * <history> 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 | 17 | super(); |
| 44 | 17 | } |
| 45 | ||
| 46 | /** |
|
| 47 | * Get the transition. |
|
| 48 | * |
|
| 49 | * @return Returns the transition. |
|
| 50 | */ |
|
| 51 | public final Transition getTransition() { |
|
| 52 | 8 | 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 | 5 | this.transition = transition; |
| 62 | 5 | } |
| 63 | ||
| 64 | /** |
|
| 65 | * Is this history "deep" (as against "shallow"). |
|
| 66 | * |
|
| 67 | * @return Returns whether this is a "deep" history |
|
| 68 | */ |
|
| 69 | public final boolean isDeep() { |
|
| 70 | 17 | 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 "shallow" or |
|
| 77 | * "deep" |
|
| 78 | */ |
|
| 79 | public final void setType(final String type) { |
|
| 80 | 6 | if (type.equals("deep")) { |
| 81 | 5 | isDeep = true; |
| 82 | } |
|
| 83 | //shallow is by default |
|
| 84 | 6 | } |
| 85 | ||
| 86 | } |
|
| 87 |