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
Diagram
State
Participants
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
  • Each subclass implements a behavior associated with a state of Context