com.ptc.windchill.upgrade.util.fsm
Class State

java.lang.Object
  extended bycom.ptc.windchill.upgrade.util.fsm.State
Direct Known Subclasses:
AbstractState, AbstractState, DemoStateMachineDefinition.AbstractDemoState, StartStateDefinition.StartState, StopStateDefinition.StopState

public abstract class State
extends Object

A state within a StateMachine instance.

State instantiation is done via StateInstantiator at the request of StateMachines whenever a transition to a state occurs.

See Also:
StateMachine, StateInstantiator

Field Summary
private  StateDefinition stateDefinition_
           
private  StateMachine stateMachine_
           
 
Constructor Summary
protected State(StateMachine state_machine, StateDefinition state_definition)
           
 
Method Summary
protected  void activate(Event activating_event)
          Called by a StateMachine when transitioning to this State.
protected  void deactivate(Event deactivating_event)
          Called by a StateMachine when transitioning away from this State.
(package private)  List getEventTypes()
          A package internal method: return the event types registered with the state definition for this state
(package private)  StateDefinition getStateDefinition()
          A package internal method: The state's StateDefinition
 StateMachine getStateMachine()
          The State's StateMachine.
 StateMachine getStateMachine(Class sub_state_machine)
           
(package private)  void handleEvent(Event event)
          A package internal method: delegate the event handling to the state definition
(package private)  boolean isEventTypeEnabled(EventType event_type)
          A package internal method: return whether events of the specified type are enabled for this state instance based on the results of the corresponding conditions
 boolean isStartState()
          Indicate if this state is a start state.
(package private)  boolean isStateDefinition(StateDefinition state_definition)
          A package internal method: whether this state's definition and the specified one are reference-equal
 boolean isStopState()
          Indicate if this state is a stop state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

stateMachine_

private StateMachine stateMachine_

stateDefinition_

private StateDefinition stateDefinition_
Constructor Detail

State

protected State(StateMachine state_machine,
                StateDefinition state_definition)
Method Detail

isStateDefinition

final boolean isStateDefinition(StateDefinition state_definition)
A package internal method: whether this state's definition and the specified one are reference-equal


getStateDefinition

final StateDefinition getStateDefinition()
A package internal method: The state's StateDefinition


getEventTypes

final List getEventTypes()
A package internal method: return the event types registered with the state definition for this state


handleEvent

final void handleEvent(Event event)
A package internal method: delegate the event handling to the state definition


isEventTypeEnabled

final boolean isEventTypeEnabled(EventType event_type)
A package internal method: return whether events of the specified type are enabled for this state instance based on the results of the corresponding conditions


getStateMachine

public final StateMachine getStateMachine()
The State's StateMachine.

Returns:
a non-null StateMachine instance

getStateMachine

public final StateMachine getStateMachine(Class sub_state_machine)

isStartState

public final boolean isStartState()
Indicate if this state is a start state.


isStopState

public final boolean isStopState()
Indicate if this state is a stop state.


activate

protected void activate(Event activating_event)
Called by a StateMachine when transitioning to this State. This will be invoked event if transitioning from a state, back to that same state.

Subtypes may override the method to allocate state resources and access event information. There is no need to invoke State.activate(Event) in this case.


deactivate

protected void deactivate(Event deactivating_event)
Called by a StateMachine when transitioning away from this State. This will be invoked event if transitioning from a state, back to that same state.

Subtypes may override the method to ensure state resources are cleaned up. There is no need to invoke State.deactivate(Event) in this case.