1 7 package org.enhydra.dods.editor.Doml; 8 9 import java.util.Arrays ; 10 import java.util.Collections ; 11 import java.util.List ; 12 13 import org.eclipse.emf.common.util.AbstractEnumerator; 14 15 24 public final class TrueFalse extends AbstractEnumerator { 25 34 public static final int TRUE = 0; 35 36 45 public static final int FALSE = 1; 46 47 59 public static final TrueFalse TRUE_LITERAL = new TrueFalse(TRUE, "true"); 60 61 73 public static final TrueFalse FALSE_LITERAL = new TrueFalse(FALSE, "false"); 74 75 81 private static final TrueFalse[] VALUES_ARRAY = 82 new TrueFalse[] { 83 TRUE_LITERAL, 84 FALSE_LITERAL, 85 }; 86 87 93 public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); 94 95 101 public static TrueFalse get(String name) { 102 for (int i = 0; i < VALUES_ARRAY.length; ++i) { 103 TrueFalse result = VALUES_ARRAY[i]; 104 if (result.toString().equals(name)) { 105 return result; 106 } 107 } 108 return null; 109 } 110 111 117 public static TrueFalse get(int value) { 118 switch (value) { 119 case TRUE: return TRUE_LITERAL; 120 case FALSE: return FALSE_LITERAL; 121 } 122 return null; 123 } 124 125 131 private TrueFalse(int value, String name) { 132 super(value, name); 133 } 134 135 } | Popular Tags |