[refactor] Makes enums more readable.
This commit is contained in:
		| @@ -1,32 +1,22 @@ | ||||
| package com.iluwatar; | ||||
|  | ||||
| /** | ||||
|  *  | ||||
|  * | ||||
|  * Enumeration for target size. | ||||
|  * | ||||
|  */ | ||||
| public enum Size { | ||||
|  | ||||
| 	SMALL, NORMAL, LARGE; | ||||
|     SMALL("small"), NORMAL("normal"), LARGE("large"), UNDEFINED(""); | ||||
|      | ||||
|     private String title; | ||||
|  | ||||
| 	@Override | ||||
|     Size(String title) { | ||||
|         this.title = title; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| 	public String toString() { | ||||
|  | ||||
| 		String s = ""; | ||||
|  | ||||
| 		switch (this) { | ||||
| 		case LARGE: | ||||
| 			s = "large"; | ||||
| 			break; | ||||
| 		case NORMAL: | ||||
| 			s = "normal"; | ||||
| 			break; | ||||
| 		case SMALL: | ||||
| 			s = "small"; | ||||
| 			break; | ||||
| 		default: | ||||
| 			break; | ||||
| 		} | ||||
| 		return s; | ||||
|         return title; | ||||
| 	} | ||||
| } | ||||
|   | ||||
| @@ -7,24 +7,16 @@ package com.iluwatar; | ||||
|  */ | ||||
| public enum Visibility { | ||||
|  | ||||
| 	VISIBLE, INVISIBLE; | ||||
| 	VISIBLE("visible"), INVISIBLE("invisible"), UNDEFINED(""); | ||||
|  | ||||
| 	@Override | ||||
|     private String title; | ||||
|  | ||||
|     Visibility(String title) { | ||||
|         this.title = title; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| 	public String toString() { | ||||
|  | ||||
| 		String s = ""; | ||||
|  | ||||
| 		switch (this) { | ||||
| 		case INVISIBLE: | ||||
| 			s = "invisible"; | ||||
| 			break; | ||||
| 		case VISIBLE: | ||||
| 			s = "visible"; | ||||
| 			break; | ||||
| 		default: | ||||
| 			break; | ||||
|  | ||||
| 		} | ||||
| 		return s; | ||||
| 		return title; | ||||
| 	} | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user