net.groboclown.util.states.v1
Philosophy of This State Design
The purpose of the states package is to use a well designed
state and state-machine system.
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).
StateSet vs. StateMachine
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.
|