State mode:
Allows an object to change its behavior when the internal state changes, and the object looks as if it had modified its class.
Points:
1. State mode allows an object to have different behavior based on its internal state
2. Unlike the program state Machine (PSM), the state mode is represented by the class
3. The context delegates the behavior to the current state object
4. By encapsulating each state into a class, we localize any changes that need to be made later
5, the state mode and the policy mode have the same class diagram, but they have different meanings
6. Policy mode usually configures the context class with behavior or algorithm
7. State mode allows the context to change behavior as the state changes
8. The state or context class can be controlled by the status change
9. Using state mode often leads to a significant increase in the number of classes in the design
10. The status class can be shared by multiple context instances
Java design mode----State mode