forked from iluwatar/java-design-patterns
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request iluwatar#29 from ruslanpa/master
[refactor] Makes enums more readable.
- Loading branch information
Showing
9 changed files
with
57 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,22 @@ | ||
package com.iluwatar; | ||
|
||
/** | ||
* | ||
* | ||
* Enumeration for target size. | ||
* | ||
*/ | ||
public enum Size { | ||
|
||
SMALL, NORMAL, LARGE; | ||
|
||
@Override | ||
public String toString() { | ||
SMALL("small"), NORMAL("normal"), LARGE("large"), UNDEFINED(""); | ||
|
||
private String title; | ||
|
||
String s = ""; | ||
Size(String title) { | ||
this.title = title; | ||
} | ||
|
||
switch (this) { | ||
case LARGE: | ||
s = "large"; | ||
break; | ||
case NORMAL: | ||
s = "normal"; | ||
break; | ||
case SMALL: | ||
s = "small"; | ||
break; | ||
default: | ||
break; | ||
} | ||
return s; | ||
@Override | ||
public String toString() { | ||
return title; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,5 @@ | |
*/ | ||
public interface Potion { | ||
|
||
public void drink(); | ||
|
||
void drink(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters