ABLE 2.0.0 07/02/2003 10:25:01

com.ibm.conversation
Interface CpStateMachine

All Known Implementing Classes:
BasicCpStateMachine

public interface CpStateMachine

The CpStateMachine interface represents a state machine for a conversation policy.

Note that neither the "current role" nor the "current state" of the policy is stored here. The CpStateMachine thus describes only the state-transition structure of the conversation policy, which does not change during its execution. This permits a single CpStateMachine instance to be shared among several ConversationPolicyHandlers.

See Also:
CpStateMachineHandler

Method Summary
 void addRole(java.lang.String newRole)
          Adds the given role to the set of roles supported by the policy.
 void addState(CpState newState)
          Adds the given state to the policy state machine.
 void clear()
          Removes all roles, states, and transitions that have been added to this state machine.
 CpState getInitialState()
          Returns the initial state of the policy.
 java.lang.String getInitialStateName()
          Returns the name of the policy's initial state.
 int getNumStates()
          Returns the number of states in the policy state machine.
 java.lang.String getPolicyName()
          Returns the name of the policy.
 java.util.Collection getRoles()
          Returns a Collection containing the roles supported by the policy.
 CpState getState(java.lang.String name)
          Returns the state with the given name
 java.util.Collection getStates()
          Returns a Collection containing all the states in the poliy state machine.
 CpStateTransition getTransition(java.lang.String stateName, java.lang.String transitionName)
          Returns the transition with the given transitionName whose source is the given stateName.
 CpState newState(int stateType)
          Creates and returns a new CpState of the given state type.
 CpStateTransition newTransition(int transitionType)
          Creates and returns a new CpStateTransition of the given transition type.
 void setInitialStateName(java.lang.String newName)
          Sets the name of the policy's initial state
 void setPolicyName(java.lang.String newName)
          Sets the name of the policy.
 

Method Detail

getPolicyName

public java.lang.String getPolicyName()
Returns the name of the policy.

Returns:
The policy's name, of null if undefined.

setPolicyName

public void setPolicyName(java.lang.String newName)
Sets the name of the policy.

Parameters:
newName - The new name of the policy.

getRoles

public java.util.Collection getRoles()
Returns a Collection containing the roles supported by the policy.

Each entry in the Collection is a String.

Returns:
The roles defined by the policy.

addRole

public void addRole(java.lang.String newRole)
Adds the given role to the set of roles supported by the policy.

Parameters:
newRole - The role to be added.

getInitialState

public CpState getInitialState()
Returns the initial state of the policy.

Returns:
The initial state of the policy, or null if undefined.

getInitialStateName

public java.lang.String getInitialStateName()
Returns the name of the policy's initial state.

Returns:
The name of the policy's initial state, or null if undefined.

setInitialStateName

public void setInitialStateName(java.lang.String newName)
Sets the name of the policy's initial state

Parameters:
newName - The name of the new initial state.

getNumStates

public int getNumStates()
Returns the number of states in the policy state machine.

Returns:
The number of states in the policy.

getStates

public java.util.Collection getStates()
Returns a Collection containing all the states in the poliy state machine.

Each entry in the Collection is a CpState.

Returns:
The states in the policy.

getState

public CpState getState(java.lang.String name)
Returns the state with the given name

Parameters:
name - The state's name.
Returns:
The state with the given name, or null if not found.

addState

public void addState(CpState newState)
Adds the given state to the policy state machine.

Parameters:
newState - The state to be added.

getTransition

public CpStateTransition getTransition(java.lang.String stateName,
                                       java.lang.String transitionName)
Returns the transition with the given transitionName whose source is the given stateName.

Parameters:
stateName - The name of the source state.
transitionName - The name of the transition.
Returns:
The transition matching the args, or null if not found.

clear

public void clear()
Removes all roles, states, and transitions that have been added to this state machine.

newState

public CpState newState(int stateType)
Creates and returns a new CpState of the given state type.

Parameters:
stateType - The state type.
Returns:
The new state.
See Also:
for possible state types.

newTransition

public CpStateTransition newTransition(int transitionType)
Creates and returns a new CpStateTransition of the given transition type.

See CpStateTransition for possible transition types.

Parameters:
transitionType - The transition type.
Returns:
The new transition.

ABLE 2.0.0 07/02/2003 10:25:01

(C) Copyright IBM Corporation 1999, 2003