State: sync post code blocks to repo exactly, split merged Red/Green/YellowState block, Java 25, H6 file labels, fix stale console output, README mapping
This commit is contained in:
19
README.md
19
README.md
@@ -407,6 +407,25 @@ javac 03-behavioral/observer/*.java -d out/observer
|
||||
java -cp out/observer observer.Main
|
||||
```
|
||||
|
||||
### State (`03-behavioral/state/`)
|
||||
|
||||
| Post Section | File(s) |
|
||||
|---|---|
|
||||
| With State: Traffic Light — the State interface | `TrafficLightState.java` |
|
||||
| With State: Traffic Light — the Context | `TrafficLight.java` |
|
||||
| With State: Traffic Light — RedState | `RedState.java` |
|
||||
| With State: Traffic Light — GreenState | `GreenState.java` |
|
||||
| With State: Traffic Light — YellowState | `YellowState.java` |
|
||||
| With State: Traffic Light — wiring it together | `Main.java` |
|
||||
|
||||
Note: the "Without State: The if-else Machine" snippet is illustrative only — it is not part of this repository's runnable example.
|
||||
|
||||
Run it:
|
||||
```bash
|
||||
javac 03-behavioral/state/*.java -d out/state
|
||||
java -cp out/state state.Main
|
||||
```
|
||||
|
||||
## Reference
|
||||
|
||||
- *Design Patterns: Elements of Reusable Object-Oriented Software* — Gamma, Helm, Johnson, Vlissides
|
||||
|
||||
Reference in New Issue
Block a user