Skip to content

Commit

Permalink
[refactor] Makes enums more readable.
Browse files Browse the repository at this point in the history
  • Loading branch information
ruslanpa committed Feb 6, 2015
1 parent 6e49fc0 commit 6f59f25
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 36 deletions.
30 changes: 10 additions & 20 deletions command/src/main/java/com/iluwatar/Size.java
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;
}
}
24 changes: 8 additions & 16 deletions command/src/main/java/com/iluwatar/Visibility.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,16 @@
*/
public enum Visibility {

VISIBLE, INVISIBLE;
VISIBLE("visible"), INVISIBLE("invisible"), UNDEFINED("");

@Override
public String toString() {

String s = "";
private String title;

switch (this) {
case INVISIBLE:
s = "invisible";
break;
case VISIBLE:
s = "visible";
break;
default:
break;
Visibility(String title) {
this.title = title;
}

}
return s;
@Override
public String toString() {
return title;
}
}

0 comments on commit 6f59f25

Please sign in to comment.