State
Intent
Allow an object to alter its behavior when its internal state changes.
How to
1.Context delegates state-specific requests to the current ConcreteState object.
2.Clients can configure a context with State objects. Once a context is configured, its clients don't have to deal with the State objects directly.
3.Either Context or the ConcreteState subclasses can decide which state succeeds another and under what circumstances.
Context
defines the interface of interest to clients.
maintains an instance of a ConcreteState subclass that defines the current state.
State
defines an interface for encapsulating the behavior associated with a particular state of the Context.
ConcreteState subclasses
each subclass implements a behavior associated with a state of the Context.
Known cases