State
Usage
- Also known as: Objects for State
- Alter an object's behavior when its state changes
- Allow an object to alter its behavior when its internal state changes
- The object will appear to change its class
Participants
Context
State
- Defines the interface of interest to clients
- Maintains an instance of a ConcreteState subclass that defines the current state
ConcreteState
- Defines an interface for encapsulating the behavior associated with a particular state of the Context
- Each subclass implements a behavior associated with a state of Context
