mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-15 10:58:51 +00:00
added mediator sample
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
package com.iluwatar;
|
||||
|
||||
public enum Action {
|
||||
|
||||
HUNT, TALE, GOLD, ENEMY;
|
||||
|
||||
public String toString() {
|
||||
|
||||
String s = "";
|
||||
switch (this) {
|
||||
case ENEMY:
|
||||
s = "spotted enemies";
|
||||
break;
|
||||
case GOLD:
|
||||
s = "found gold";
|
||||
break;
|
||||
case HUNT:
|
||||
s = "hunted a rabbit";
|
||||
break;
|
||||
case TALE:
|
||||
s = "tells a tale";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return s;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user