1 16 package org.apache.commons.lang.enum; 17 18 import java.util.Iterator; 19 import java.util.List; 20 import java.util.Map; 21 22 28 public abstract class Broken2OperationEnum extends Enum { 29 public static final Broken2OperationEnum PLUS = new PlusOperation(); 42 private static class PlusOperation extends Broken2OperationEnum { 43 private PlusOperation() { 44 super("Plus"); 45 } 46 public int eval(int a, int b) { 47 return (a + b); 48 } 49 } 50 public static final Broken2OperationEnum MINUS = new MinusOperation(); 51 private static class MinusOperation extends Broken2OperationEnum { 52 private MinusOperation() { 53 super("Minus"); 54 } 55 public int eval(int a, int b) { 56 return (a - b); 57 } 58 } 59 60 private Broken2OperationEnum(String name) { 61 super(name); 62 } 63 64 public final Class getEnumClass() { 65 return ColorEnum.class; 66 } 67 68 public abstract int eval(int a, int b); 69 70 public static Broken2OperationEnum getEnum(String name) { 71 return (Broken2OperationEnum) getEnum(Broken2OperationEnum.class, name); 72 } 73 74 public static Map getEnumMap() { 75 return getEnumMap(Broken2OperationEnum.class); 76 } 77 78 public static List getEnumList() { 79 return getEnumList(Broken2OperationEnum.class); 80 } 81 82 public static Iterator iterator() { 83 return iterator(Broken2OperationEnum.class); 84 } 85 } 86 | Popular Tags |