Improved comments for state pattern.
This commit is contained in:
parent
742f8376b3
commit
27a27594f4
@ -1,5 +1,10 @@
|
|||||||
package com.iluwatar;
|
package com.iluwatar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Angry state.
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class AngryState implements State {
|
public class AngryState implements State {
|
||||||
|
|
||||||
private Mammoth mammoth;
|
private Mammoth mammoth;
|
||||||
|
@ -2,10 +2,12 @@ package com.iluwatar;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* In State pattern the object (Mammoth) has internal state object (State) that
|
* In State pattern the container object (Mammoth) has an internal state object (State) that
|
||||||
* defines the current behavior. The state object can be changed to alter the
|
* defines the current behavior. The state object can be changed to alter the
|
||||||
* behavior.
|
* behavior.
|
||||||
*
|
*
|
||||||
|
* In this example the mammoth changes its behavior as time passes by.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
public class App {
|
public class App {
|
||||||
|
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
package com.iluwatar;
|
package com.iluwatar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Peaceful state.
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class PeacefulState implements State {
|
public class PeacefulState implements State {
|
||||||
|
|
||||||
private Mammoth mammoth;
|
private Mammoth mammoth;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user