Package org.jboss.util.state
Class State
- java.lang.Object
-
- org.jboss.util.state.State
-
public class State extends java.lang.Object
The respresentation of a state in a state machine.- Version:
- $Revision$
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.HashMap
allowedTransitions
HashMapprivate java.lang.Object
data
Arbitrary state dataprivate java.lang.String
name
The name of the state
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description State
addTransition(Transition transition)
Add a transition to the allowed transition map.java.lang.Object
getData()
java.lang.String
getName()
Get the state name.Transition
getTransition(java.lang.String name)
Lookup an allowed transition given its name.java.util.Map
getTransitions()
Get the Mapof allowed transitions for this state. boolean
isAcceptState()
An accept state is indicated by no transitionsvoid
setData(java.lang.Object data)
java.lang.String
toString()
-
-
-
Method Detail
-
getName
public java.lang.String getName()
Get the state name.- Returns:
- the name of the state.
-
getData
public java.lang.Object getData()
-
setData
public void setData(java.lang.Object data)
-
isAcceptState
public boolean isAcceptState()
An accept state is indicated by no transitions- Returns:
- true if this is an accept state, false otherwise.
-
addTransition
public State addTransition(Transition transition)
Add a transition to the allowed transition map.- Parameters:
transition
-- Returns:
- this to allow chained addTransition calls
-
getTransition
public Transition getTransition(java.lang.String name)
Lookup an allowed transition given its name.- Parameters:
name
- - the name of a valid transition from this state.- Returns:
- the valid transition if it exists, null otherwise.
-
getTransitions
public java.util.Map getTransitions()
Get the Mapof allowed transitions for this state. - Returns:
- the allowed transitions map.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-