public final class SmcGuard extends SmcElement
transition
definition.
This contains the:
SmcTransition
,
SmcAction
SmcElement.TransType
_lineNumber, _name, NIL_STATE
Constructor and Description |
---|
SmcGuard(java.lang.String cond,
int lineNumber,
SmcTransition transition)
Creates a guard instance for the given transition, line
number and condition.
|
Modifier and Type | Method and Description |
---|---|
void |
accept(SmcVisitor visitor)
Calls the visitor's visit method for this finite state
machine element.
|
java.util.List<SmcAction> |
getActions()
Returns the transition action list.
|
java.lang.String |
getCondition()
Returns the guard condition.
|
java.lang.String |
getEndState()
Returns the transition end state name.
|
java.lang.String |
getPopArgs()
Returns the pop transition arguments.
|
java.lang.String |
getPushState()
Returns the push state name.
|
SmcTransition |
getTransition()
Returns the transition to which this guard belongs.
|
SmcElement.TransType |
getTransType()
Returns the transition type.
|
boolean |
hasActions()
Returns
true if this guard has at least one
action which is not emptyStateStack ; otherwise,
returns false . |
boolean |
hasCtxtReference()
Returns
true if this guard references the
ctxt variable and false otherwise. |
void |
setActions(java.util.List<SmcAction> actions)
Sets the transition actions.
|
void |
setEndState(java.lang.String endState)
Sets the transition end state name.
|
void |
setPopArgs(java.lang.String args)
Set the pop transition arguments.
|
void |
setPushState(java.lang.String state)
Sets the push state name.
|
void |
setTransType(SmcElement.TransType transType)
Sets the transition type.
|
java.lang.String |
toString()
Returns the transition guard text representation.
|
getLineNumber, getName, merge
public SmcGuard(java.lang.String cond, int lineNumber, SmcTransition transition)
cond
- transition guard condition.lineNumber
- where this guard appears in the .sm
file.transition
- guard belongs to this transition.public void accept(SmcVisitor visitor)
accept
in class SmcElement
visitor
- The visitor instance.SmcVisitor
public SmcTransition getTransition()
public java.lang.String getCondition()
public SmcElement.TransType getTransType()
public java.lang.String getEndState()
push
transition, then this is the state pushed on to the state
stack.public java.lang.String getPushState()
push
transition. This state becomes the current state after the
transition completes. It is not the state pushed on
to the state stack.public java.lang.String getPopArgs()
pop
transition.public boolean hasCtxtReference()
true
if this guard references the
ctxt
variable and false
otherwise. The
ctxt
variable plays a similar rote as this
or self
in object-oriented programming languages.
ctxt
is the first parameter for all transitions
and is a reference to the FSM context instance (even if
a transitions has no defined parameters it still has this
one).true
if this guard references the
ctxt
variable and false
otherwise.public boolean hasActions()
true
if this guard has at least one
action which is not emptyStateStack
; otherwise,
returns false
.true
if the guard has actions.public java.util.List<SmcAction> getActions()
public void setTransType(SmcElement.TransType transType)
transType
- the transition type.public void setEndState(java.lang.String endState)
endState
- the end state name.public void setPushState(java.lang.String state)
state
- a state name.public void setPopArgs(java.lang.String args)
args
- pop transition arguments.public void setActions(java.util.List<SmcAction> actions)
null
but
may be empty.actions
- transition actions.public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2015. Charles W. Rapp. All Rights Reserved. Use is subject to license terms.