Debian Codegraph @

tests/org.eclipse.emf.test.common/src/org/eclipse/emf/test/models/customer/USState.java

raw
1 /**
2 * Copyright (c) 2007 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v2.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v20.html
7 *
8 * Contributors:
9 * IBM - Initial API and implementation
10 */
11 package org.eclipse.emf.test.models.customer;
12
13 import java.util.Arrays;
14 import java.util.Collections;
15 import java.util.List;
16
17 import org.eclipse.emf.common.util.Enumerator;
18
19 /**
20 * <!-- begin-user-doc -->
21 * A representation of the literals of the enumeration '<em><b>US State</b></em>',
22 * and utility methods for working with them.
23 * <!-- end-user-doc -->
24 * @see org.eclipse.emf.test.models.customer.CustomerPackage#getUSState()
25 * @model extendedMetaData="name='USState'"
26 * @generated
27 */
28 public enum USState implements Enumerator
29 {
30 /**
31 * The '<em><b>AK</b></em>' literal object.
32 * <!-- begin-user-doc -->
33 * <!-- end-user-doc -->
34 * @see #AK_VALUE
35 * @generated
36 * @ordered
37 */
38 AK(0, "AK", "AK"),
39
40 /**
41 * The '<em><b>AL</b></em>' literal object.
42 * <!-- begin-user-doc -->
43 * <!-- end-user-doc -->
44 * @see #AL_VALUE
45 * @generated
46 * @ordered
47 */
48 AL(1, "AL", "AL"),
49
50 /**
51 * The '<em><b>AR</b></em>' literal object.
52 * <!-- begin-user-doc -->
53 * <!-- end-user-doc -->
54 * @see #AR_VALUE
55 * @generated
56 * @ordered
57 */
58 AR(2, "AR", "AR");
59
60 /**
61 * The '<em><b>AK</b></em>' literal value.
62 * <!-- begin-user-doc -->
63 * <p>
64 * If the meaning of '<em><b>AK</b></em>' literal object isn't clear,
65 * there really should be more of a description here...
66 * </p>
67 * <!-- end-user-doc -->
68 * @see #AK
69 * @model
70 * @generated
71 * @ordered
72 */
73 public static final int AK_VALUE = 0;
74
75 /**
76 * The '<em><b>AL</b></em>' literal value.
77 * <!-- begin-user-doc -->
78 * <p>
79 * If the meaning of '<em><b>AL</b></em>' literal object isn't clear,
80 * there really should be more of a description here...
81 * </p>
82 * <!-- end-user-doc -->
83 * @see #AL
84 * @model
85 * @generated
86 * @ordered
87 */
88 public static final int AL_VALUE = 1;
89
90 /**
91 * The '<em><b>AR</b></em>' literal value.
92 * <!-- begin-user-doc -->
93 * <p>
94 * If the meaning of '<em><b>AR</b></em>' literal object isn't clear,
95 * there really should be more of a description here...
96 * </p>
97 * <!-- end-user-doc -->
98 * @see #AR
99 * @model
100 * @generated
101 * @ordered
102 */
103 public static final int AR_VALUE = 2;
104
105 /**
106 * An array of all the '<em><b>US State</b></em>' enumerators.
107 * <!-- begin-user-doc -->
108 * <!-- end-user-doc -->
109 * @generated
110 */
111 private static final USState[] VALUES_ARRAY =
112 new USState[]
113 {
114 AK,
115 AL,
116 AR,
117 };
118
119 /**
120 * A public read-only list of all the '<em><b>US State</b></em>' enumerators.
121 * <!-- begin-user-doc -->
122 * <!-- end-user-doc -->
123 * @generated
124 */
125 public static final List<USState> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY));
126
127 /**
128 * Returns the '<em><b>US State</b></em>' literal with the specified literal value.
129 * <!-- begin-user-doc -->
130 * <!-- end-user-doc -->
131 * @param literal the literal.
132 * @return the matching enumerator or <code>null</code>.
133 * @generated
134 */
135 public static USState get(String literal)
136 {
137 for (int i = 0; i < VALUES_ARRAY.length; ++i)
138 {
139 USState result = VALUES_ARRAY[i];
140 if (result.toString().equals(literal))
141 {
142 return result;
143 }
144 }
145 return null;
146 }
147
148 /**
149 * Returns the '<em><b>US State</b></em>' literal with the specified name.
150 * <!-- begin-user-doc -->
151 * <!-- end-user-doc -->
152 * @param name the name.
153 * @return the matching enumerator or <code>null</code>.
154 * @generated
155 */
156 public static USState getByName(String name)
157 {
158 for (int i = 0; i < VALUES_ARRAY.length; ++i)
159 {
160 USState result = VALUES_ARRAY[i];
161 if (result.getName().equals(name))
162 {
163 return result;
164 }
165 }
166 return null;
167 }
168
169 /**
170 * Returns the '<em><b>US State</b></em>' literal with the specified integer value.
171 * <!-- begin-user-doc -->
172 * <!-- end-user-doc -->
173 * @param value the integer value.
174 * @return the matching enumerator or <code>null</code>.
175 * @generated
176 */
177 public static USState get(int value)
178 {
179 switch (value)
180 {
181 case AK_VALUE: return AK;
182 case AL_VALUE: return AL;
183 case AR_VALUE: return AR;
184 }
185 return null;
186 }
187
188 /**
189 * <!-- begin-user-doc -->
190 * <!-- end-user-doc -->
191 * @generated
192 */
193 private final int value;
194
195 /**
196 * <!-- begin-user-doc -->
197 * <!-- end-user-doc -->
198 * @generated
199 */
200 private final String name;
201
202 /**
203 * <!-- begin-user-doc -->
204 * <!-- end-user-doc -->
205 * @generated
206 */
207 private final String literal;
208
209 /**
210 * Only this class can construct instances.
211 * <!-- begin-user-doc -->
212 * <!-- end-user-doc -->
213 * @generated
214 */
215 private USState(int value, String name, String literal)
216 {
217 this.value = value;
218 this.name = name;
219 this.literal = literal;
220 }
221
222 /**
223 * <!-- begin-user-doc -->
224 * <!-- end-user-doc -->
225 * @generated
226 */
227 @Override
228 public int getValue()
229 {
230 return value;
231 }
232
233 /**
234 * <!-- begin-user-doc -->
235 * <!-- end-user-doc -->
236 * @generated
237 */
238 @Override
239 public String getName()
240 {
241 return name;
242 }
243
244 /**
245 * <!-- begin-user-doc -->
246 * <!-- end-user-doc -->
247 * @generated
248 */
249 @Override
250 public String getLiteral()
251 {
252 return literal;
253 }
254
255 /**
256 * Returns the literal value of the enumerator, which is its string representation.
257 * <!-- begin-user-doc -->
258 * <!-- end-user-doc -->
259 * @generated
260 */
261 @Override
262 public String toString()
263 {
264 return literal;
265 }
266
267 } //USState