mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-16 06:58:54 +00:00
27 lines
453 B
Java
27 lines
453 B
Java
package com.iluwatar;
|
|
|
|
/**
|
|
*
|
|
* Peaceful state.
|
|
*
|
|
*/
|
|
public class PeacefulState implements State {
|
|
|
|
private Mammoth mammoth;
|
|
|
|
public PeacefulState(Mammoth mammoth) {
|
|
this.mammoth = mammoth;
|
|
}
|
|
|
|
@Override
|
|
public void observe() {
|
|
System.out.println(String.format("%s is calm and peaceful.", mammoth));
|
|
}
|
|
|
|
@Override
|
|
public void onEnterState() {
|
|
System.out.println(String.format("%s calms down.", mammoth));
|
|
}
|
|
|
|
}
|