001 /* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017 package org.apache.commons.scxml; 018 019 import java.util.ArrayList; 020 import java.util.Collection; 021 import java.util.List; 022 023 /** 024 * A logical unit of progression in the execution of a SCXML model. 025 * 026 */ 027 public class Step { 028 029 /** 030 * Constructor. 031 */ 032 public Step() { 033 this.externalEvents = new ArrayList(); 034 this.beforeStatus = new Status(); 035 this.afterStatus = new Status(); 036 this.exitList = new ArrayList(); 037 this.entryList = new ArrayList(); 038 this.transitList = new ArrayList(); 039 } 040 041 /** 042 * @param externalEvents The external events received in this 043 * unit of progression 044 * @param beforeStatus The before status 045 */ 046 public Step(final Collection externalEvents, final Status beforeStatus) { 047 if (externalEvents != null) { 048 this.externalEvents = externalEvents; 049 } else { 050 this.externalEvents = new ArrayList(); 051 } 052 if (beforeStatus != null) { 053 this.beforeStatus = beforeStatus; 054 } else { 055 this.beforeStatus = new Status(); 056 } 057 this.afterStatus = new Status(); 058 this.exitList = new ArrayList(); 059 this.entryList = new ArrayList(); 060 this.transitList = new ArrayList(); 061 } 062 063 /** 064 * The external events in this step. 065 */ 066 private Collection externalEvents; 067 068 /** 069 * The status before this step. 070 */ 071 private Status beforeStatus; 072 073 /** 074 * The status after this step. 075 */ 076 private Status afterStatus; 077 078 /** 079 * The list of TransitionTargets that were exited during this step. 080 */ 081 private List exitList; 082 083 /** 084 * The list of TransitionTargets that were entered during this step. 085 */ 086 private List entryList; 087 088 /** 089 * The list of Transitions taken during this step. 090 */ 091 private List transitList; 092 093 /** 094 * @return Returns the afterStatus. 095 */ 096 public Status getAfterStatus() { 097 return afterStatus; 098 } 099 100 /** 101 * @param afterStatus The afterStatus to set. 102 */ 103 public void setAfterStatus(final Status afterStatus) { 104 this.afterStatus = afterStatus; 105 } 106 107 /** 108 * @return Returns the beforeStatus. 109 */ 110 public Status getBeforeStatus() { 111 return beforeStatus; 112 } 113 114 /** 115 * @param beforeStatus The beforeStatus to set. 116 */ 117 public void setBeforeStatus(final Status beforeStatus) { 118 this.beforeStatus = beforeStatus; 119 } 120 121 /** 122 * @return Returns the entryList. 123 */ 124 public List getEntryList() { 125 return entryList; 126 } 127 128 /** 129 * @return Returns the exitList. 130 */ 131 public List getExitList() { 132 return exitList; 133 } 134 135 /** 136 * @return Returns the externalEvents. 137 */ 138 public Collection getExternalEvents() { 139 return externalEvents; 140 } 141 142 /** 143 * @return Returns the transitList. 144 */ 145 public List getTransitList() { 146 return transitList; 147 } 148 149 } 150