Skip to content

Commit b014dc2

Browse files
committed
Grammar fixes to state pattern
1 parent 9a2c5aa commit b014dc2

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

state/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ change its class.
2020

2121
## Explanation
2222

23-
Real world example
23+
Real-world example
2424

2525
> When observing a mammoth in its natural habitat it seems to change its behavior based on the
26-
> situation. It may first appear calm but over time when it detects a threat it gets angry and
26+
> situation. It may first appear calm, but over time when it detects a threat, it gets angry and
2727
> dangerous to its surroundings.
2828
2929
In plain words
@@ -125,7 +125,7 @@ public class Mammoth {
125125
}
126126
```
127127

128-
And here is the full example how the mammoth behaves over time.
128+
Here is the full example of how the mammoth behaves over time.
129129

130130
```java
131131
var mammoth = new Mammoth();
@@ -156,7 +156,7 @@ Use the State pattern in either of the following cases
156156
* An object's behavior depends on its state, and it must change its behavior at run-time depending on that state
157157
* 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.
158158

159-
## Real world examples
159+
## Known uses
160160

161161
* [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.
162162
* [JDiameter - Diameter State Machine](https://github.com/npathai/jdiameter/blob/master/core/jdiameter/api/src/main/java/org/jdiameter/api/app/State.java)

state/src/main/java/com/iluwatar/state/App.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
package com.iluwatar.state;
2525

2626
/**
27-
* In State pattern the container object has an internal state object that defines the current
27+
* In the State pattern, the container object has an internal state object that defines the current
2828
* behavior. The state object can be changed to alter the behavior.
2929
*
3030
* <p>This can be a cleaner way for an object to change its behavior at runtime without resorting

state/src/main/java/com/iluwatar/state/State.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,4 @@ public interface State {
3131
void onEnterState();
3232

3333
void observe();
34-
3534
}

0 commit comments

Comments
 (0)