|
||||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
See:
Description
Interface Summary | |
IStateListener | Listens to Stateful instances who have their state changed, which triggers a new action to be set. |
Class Summary | |
State | The basic state object. |
StateCategory | Creates new categories for State collections. |
Stateful | |
StateSet | A simple StateMachine where the transition to state mapping is 1-to-1. |
Transition | A specific subclass of State so that the StateMachine can tell the difference between the states and the Transitions, and the applications will get compiler errors, instead of runtime errors. |
The states are encapsulated in the State class. These can only be created by the StateSet or StateMachine classes. They are designed such that the outside managing class maintains the state objects in a well known place. This replaces the need for a String lookup, and creates a well-defined set of states which cause a better handling of in-bounds detection (compiler checked, not runtime checked).
A StateSet is a simple mechanism for setting a state across multiple objects. It has no concept of transistions.
A StateMachine, on the other hand, has a notion of transitions. In a state machine, the current state is handled internally. Outside forces send the machine a transition, which moves the current state to another based on a matrix. This allows for control over valid transition checking, and a better real-life correspondence.
Therefore, one could say that a StateCategory is a StateMachine where the State to Transition relationship is 1-to-1, and there are no invalid transitions.
|
||||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |