Grammar fixes to state pattern

This commit is contained in:
Ilkka Seppälä 2021-06-22 20:15:34 +03:00
parent 9a2c5aa9aa
commit b014dc2f00
No known key found for this signature in database
GPG Key ID: 31B7C8F5CC412ECB
3 changed files with 5 additions and 6 deletions

View File

@ -20,10 +20,10 @@ change its class.
## Explanation
Real world example
Real-world example
> When observing a mammoth in its natural habitat it seems to change its behavior based on the
> situation. It may first appear calm but over time when it detects a threat it gets angry and
> situation. It may first appear calm, but over time when it detects a threat, it gets angry and
> dangerous to its surroundings.
In plain words
@ -125,7 +125,7 @@ public class Mammoth {
}
```
And here is the full example how the mammoth behaves over time.
Here is the full example of how the mammoth behaves over time.
```java
var mammoth = new Mammoth();
@ -156,7 +156,7 @@ Use the State pattern in either of the following cases
* An object's behavior depends on its state, and it must change its behavior at run-time depending on that state
* Operations have large, multipart conditional statements that depend on the object's state. This state is usually represented by one or more enumerated constants. Often, several operations will contain this same conditional structure. The State pattern puts each branch of the conditional in a separate class. This lets you treat the object's state as an object in its own right that can vary independently from other objects.
## Real world examples
## Known uses
* [javax.faces.lifecycle.Lifecycle#execute()](http://docs.oracle.com/javaee/7/api/javax/faces/lifecycle/Lifecycle.html#execute-javax.faces.context.FacesContext-) controlled by [FacesServlet](http://docs.oracle.com/javaee/7/api/javax/faces/webapp/FacesServlet.html), the behavior is dependent on current phase of lifecycle.
* [JDiameter - Diameter State Machine](https://github.com/npathai/jdiameter/blob/master/core/jdiameter/api/src/main/java/org/jdiameter/api/app/State.java)

View File

@ -24,7 +24,7 @@
package com.iluwatar.state;
/**
* In State pattern the container object has an internal state object that defines the current
* In the State pattern, the container object has an internal state object that defines the current
* behavior. The state object can be changed to alter the behavior.
*
* <p>This can be a cleaner way for an object to change its behavior at runtime without resorting

View File

@ -31,5 +31,4 @@ public interface State {
void onEnterState();
void observe();
}