1 17 package org.eclipse.emf.ecore.xml.namespace; 18 19 import java.util.Arrays ; 20 import java.util.Collections ; 21 import java.util.List ; 22 23 import org.eclipse.emf.common.util.AbstractEnumerator; 24 25 34 public final class SpaceType extends AbstractEnumerator 35 { 36 45 public static final int DEFAULT = 0; 46 47 56 public static final int PRESERVE = 1; 57 58 70 public static final SpaceType DEFAULT_LITERAL = new SpaceType(DEFAULT, "default"); 71 72 84 public static final SpaceType PRESERVE_LITERAL = new SpaceType(PRESERVE, "preserve"); 85 86 92 private static final SpaceType[] VALUES_ARRAY = 93 new SpaceType[] 94 { 95 DEFAULT_LITERAL, 96 PRESERVE_LITERAL, 97 }; 98 99 105 public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); 106 107 113 public static SpaceType get(String name) 114 { 115 for (int i = 0; i < VALUES_ARRAY.length; ++i) 116 { 117 SpaceType result = VALUES_ARRAY[i]; 118 if (result.toString().equals(name)) 119 { 120 return result; 121 } 122 } 123 return null; 124 } 125 126 132 public static SpaceType get(int value) 133 { 134 switch (value) 135 { 136 case DEFAULT: return DEFAULT_LITERAL; 137 case PRESERVE: return PRESERVE_LITERAL; 138 } 139 return null; 140 } 141 142 148 private SpaceType(int value, String name) 149 { 150 super(value, name); 151 } 152 153 } | Popular Tags |