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 DirtyDO extends AbstractEnumerator { 25 34 public static final int COMPATIBLE = 0; 35 36 45 public static final int DEPRECATE = 1; 46 47 56 public static final int OMIT = 2; 57 58 70 public static final DirtyDO COMPATIBLE_LITERAL = new DirtyDO(COMPATIBLE, "Compatible"); 71 72 84 public static final DirtyDO DEPRECATE_LITERAL = new DirtyDO(DEPRECATE, "Deprecate"); 85 86 98 public static final DirtyDO OMIT_LITERAL = new DirtyDO(OMIT, "Omit"); 99 100 106 private static final DirtyDO[] VALUES_ARRAY = 107 new DirtyDO[] { 108 COMPATIBLE_LITERAL, 109 DEPRECATE_LITERAL, 110 OMIT_LITERAL, 111 }; 112 113 119 public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); 120 121 127 public static DirtyDO get(String name) { 128 for (int i = 0; i < VALUES_ARRAY.length; ++i) { 129 DirtyDO result = VALUES_ARRAY[i]; 130 if (result.toString().equals(name)) { 131 return result; 132 } 133 } 134 return null; 135 } 136 137 143 public static DirtyDO get(int value) { 144 switch (value) { 145 case COMPATIBLE: return COMPATIBLE_LITERAL; 146 case DEPRECATE: return DEPRECATE_LITERAL; 147 case OMIT: return OMIT_LITERAL; 148 } 149 return null; 150 } 151 152 158 private DirtyDO(int value, String name) { 159 super(value, name); 160 } 161 162 } | Popular Tags |