[refactor] Update Action enum in mediator pattern.

This commit is contained in:
ruslanpa 2015-02-09 21:59:12 +02:00
parent c23f58e86f
commit 5b81a88d84

View File

@ -7,20 +7,15 @@ package com.iluwatar;
*/ */
public enum Action { public enum Action {
HUNT, TALE, GOLD, ENEMY; HUNT("hunted a rabbit"), TALE("tells a tale"), GOLD("found gold"), ENEMY("spotted enemies"), NONE("");
public String toString() { private String title;
switch (this) { Action(String title) {
case ENEMY: this.title = title;
return "spotted enemies"; }
case GOLD:
return "found gold"; public String toString() {
case HUNT: return title;
return "hunted a rabbit";
case TALE:
return "tells a tale";
}
return "";
} }
} }