站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 4.0.1 sp1 common API Documentation 英文版文档

StateMachine (JBoss/Common API) - JBoss 4.0.1 sp1 common API Documentation 英文版文档


org.jboss.util.state
Class StateMachine

java.lang.Object
  extended byorg.jboss.util.state.StateMachine
All Implemented Interfaces:
Cloneable

public class StateMachine
extends Object
implements Cloneable

The representation of a finite state machine.

Version:
$Revision: 1.13 $
Author:
Scott.Stark@jboss.org

Constructor Summary
StateMachine(Set states, State startState)
          Create a state machine given its states and start state.
StateMachine(Set states, State startState, String description)
          Create a state machine given its states and start state.
 
Method Summary
 Object clone()
          Make a copy of the StateMachine maintaining the current state.
 State getCurrentState()
          Get the current state of the state machine.
 String getDescription()
          Get the state machine description.
 State getStartState()
          Get the start state of the state machine.
 Set getStates()
          Get the states of the state machine.
 State nextState(String actionName)
          Transition to the next state given the name of a valid transition.
 State reset()
          Reset the state machine back to the start state
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StateMachine

public StateMachine(Set states,
                    State startState)
Create a state machine given its states and start state.

Parameters:
states - - Set for the state machine
startState - - the starting state

StateMachine

public StateMachine(Set states,
                    State startState,
                    String description)
Create a state machine given its states and start state.

Parameters:
states - - Set for the state machine
startState - - the starting state
description - - an optional description of the state machine
Method Detail

clone

public Object clone()
Make a copy of the StateMachine maintaining the current state.

Returns:
a copy of the StateMachine.

getDescription

public String getDescription()
Get the state machine description.

Returns:
an possibly null description.

getCurrentState

public State getCurrentState()
Get the current state of the state machine.

Returns:
the current state.

getStartState

public State getStartState()
Get the start state of the state machine.

Returns:
the start state.

getStates

public Set getStates()
Get the states of the state machine.

Returns:
the machine states.

nextState

public State nextState(String actionName)
                throws IllegalTransitionException
Transition to the next state given the name of a valid transition.

Parameters:
actionName - - the name of transition that is valid for the current state.
Returns:
Throws:
IllegalTransitionException

reset

public State reset()
Reset the state machine back to the start state

Returns:
the start state

toString

public String toString()


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.