1 | /** |
2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.pcm.repository; |
7 | |
8 | import java.util.Arrays; |
9 | import java.util.Collections; |
10 | import java.util.List; |
11 | |
12 | import org.eclipse.emf.common.util.Enumerator; |
13 | |
14 | /** |
15 | * <!-- begin-user-doc --> |
16 | * A representation of the literals of the enumeration '<em><b>Primitive Type Enum</b></em>', |
17 | * and utility methods for working with them. |
18 | * <!-- end-user-doc --> |
19 | * <!-- begin-model-doc --> |
20 | * Primitive types for usage in datatype and interface definitions |
21 | * <!-- end-model-doc --> |
22 | * @see de.uka.ipd.sdq.pcm.repository.RepositoryPackage#getPrimitiveTypeEnum() |
23 | * @model |
24 | * @generated |
25 | */ |
26 | public enum PrimitiveTypeEnum implements Enumerator { |
27 | /** |
28 | * The '<em><b>INT</b></em>' literal object. |
29 | * <!-- begin-user-doc --> |
30 | * <!-- end-user-doc --> |
31 | * @see #INT_VALUE |
32 | * @generated |
33 | * @ordered |
34 | */ |
35 | INT(0, "INT", "INT"), |
36 | |
37 | /** |
38 | * The '<em><b>STRING</b></em>' literal object. |
39 | * <!-- begin-user-doc --> |
40 | * <!-- end-user-doc --> |
41 | * @see #STRING_VALUE |
42 | * @generated |
43 | * @ordered |
44 | */ |
45 | STRING(1, "STRING", "STRING"), |
46 | |
47 | /** |
48 | * The '<em><b>BOOL</b></em>' literal object. |
49 | * <!-- begin-user-doc --> |
50 | * <!-- end-user-doc --> |
51 | * @see #BOOL_VALUE |
52 | * @generated |
53 | * @ordered |
54 | */ |
55 | BOOL(2, "BOOL", "BOOL"), |
56 | |
57 | /** |
58 | * The '<em><b>DOUBLE</b></em>' literal object. |
59 | * <!-- begin-user-doc --> |
60 | * <!-- end-user-doc --> |
61 | * @see #DOUBLE_VALUE |
62 | * @generated |
63 | * @ordered |
64 | */ |
65 | DOUBLE(3, "DOUBLE", "DOUBLE"), |
66 | |
67 | /** |
68 | * The '<em><b>CHAR</b></em>' literal object. |
69 | * <!-- begin-user-doc --> |
70 | * <!-- end-user-doc --> |
71 | * @see #CHAR_VALUE |
72 | * @generated |
73 | * @ordered |
74 | */ |
75 | CHAR(4, "CHAR", "CHAR"), |
76 | |
77 | /** |
78 | * The '<em><b>BYTE</b></em>' literal object. |
79 | * <!-- begin-user-doc --> |
80 | * <!-- end-user-doc --> |
81 | * @see #BYTE_VALUE |
82 | * @generated |
83 | * @ordered |
84 | */ |
85 | BYTE(5, "BYTE", "BYTE"), |
86 | |
87 | /** |
88 | * The '<em><b>LONG</b></em>' literal object. |
89 | * <!-- begin-user-doc --> |
90 | * <!-- end-user-doc --> |
91 | * @see #LONG_VALUE |
92 | * @generated |
93 | * @ordered |
94 | */ |
95 | LONG(6, "LONG", "LONG"); |
96 | |
97 | /** |
98 | * <!-- begin-user-doc --> |
99 | * <!-- end-user-doc --> |
100 | * @generated |
101 | */ |
102 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
103 | |
104 | /** |
105 | * The '<em><b>INT</b></em>' literal value. |
106 | * <!-- begin-user-doc --> |
107 | * <p> |
108 | * If the meaning of '<em><b>INT</b></em>' literal object isn't clear, |
109 | * there really should be more of a description here... |
110 | * </p> |
111 | * <!-- end-user-doc --> |
112 | * @see #INT |
113 | * @model |
114 | * @generated |
115 | * @ordered |
116 | */ |
117 | public static final int INT_VALUE = 0; |
118 | |
119 | /** |
120 | * The '<em><b>STRING</b></em>' literal value. |
121 | * <!-- begin-user-doc --> |
122 | * <p> |
123 | * If the meaning of '<em><b>STRING</b></em>' literal object isn't clear, |
124 | * there really should be more of a description here... |
125 | * </p> |
126 | * <!-- end-user-doc --> |
127 | * @see #STRING |
128 | * @model |
129 | * @generated |
130 | * @ordered |
131 | */ |
132 | public static final int STRING_VALUE = 1; |
133 | |
134 | /** |
135 | * The '<em><b>BOOL</b></em>' literal value. |
136 | * <!-- begin-user-doc --> |
137 | * <p> |
138 | * If the meaning of '<em><b>BOOL</b></em>' literal object isn't clear, |
139 | * there really should be more of a description here... |
140 | * </p> |
141 | * <!-- end-user-doc --> |
142 | * @see #BOOL |
143 | * @model |
144 | * @generated |
145 | * @ordered |
146 | */ |
147 | public static final int BOOL_VALUE = 2; |
148 | |
149 | /** |
150 | * The '<em><b>DOUBLE</b></em>' literal value. |
151 | * <!-- begin-user-doc --> |
152 | * <p> |
153 | * If the meaning of '<em><b>DOUBLE</b></em>' literal object isn't clear, |
154 | * there really should be more of a description here... |
155 | * </p> |
156 | * <!-- end-user-doc --> |
157 | * @see #DOUBLE |
158 | * @model |
159 | * @generated |
160 | * @ordered |
161 | */ |
162 | public static final int DOUBLE_VALUE = 3; |
163 | |
164 | /** |
165 | * The '<em><b>CHAR</b></em>' literal value. |
166 | * <!-- begin-user-doc --> |
167 | * <p> |
168 | * If the meaning of '<em><b>CHAR</b></em>' literal object isn't clear, |
169 | * there really should be more of a description here... |
170 | * </p> |
171 | * <!-- end-user-doc --> |
172 | * @see #CHAR |
173 | * @model |
174 | * @generated |
175 | * @ordered |
176 | */ |
177 | public static final int CHAR_VALUE = 4; |
178 | |
179 | /** |
180 | * The '<em><b>BYTE</b></em>' literal value. |
181 | * <!-- begin-user-doc --> |
182 | * <p> |
183 | * If the meaning of '<em><b>BYTE</b></em>' literal object isn't clear, |
184 | * there really should be more of a description here... |
185 | * </p> |
186 | * <!-- end-user-doc --> |
187 | * @see #BYTE |
188 | * @model |
189 | * @generated |
190 | * @ordered |
191 | */ |
192 | public static final int BYTE_VALUE = 5; |
193 | |
194 | /** |
195 | * The '<em><b>LONG</b></em>' literal value. |
196 | * <!-- begin-user-doc --> |
197 | * <p> |
198 | * If the meaning of '<em><b>LONG</b></em>' literal object isn't clear, |
199 | * there really should be more of a description here... |
200 | * </p> |
201 | * <!-- end-user-doc --> |
202 | * @see #LONG |
203 | * @model |
204 | * @generated |
205 | * @ordered |
206 | */ |
207 | public static final int LONG_VALUE = 6; |
208 | |
209 | /** |
210 | * An array of all the '<em><b>Primitive Type Enum</b></em>' enumerators. |
211 | * <!-- begin-user-doc --> |
212 | * <!-- end-user-doc --> |
213 | * @generated |
214 | */ |
215 | private static final PrimitiveTypeEnum[] VALUES_ARRAY = |
216 | new PrimitiveTypeEnum[] { |
217 | INT, |
218 | STRING, |
219 | BOOL, |
220 | DOUBLE, |
221 | CHAR, |
222 | BYTE, |
223 | LONG, |
224 | }; |
225 | |
226 | /** |
227 | * A public read-only list of all the '<em><b>Primitive Type Enum</b></em>' enumerators. |
228 | * <!-- begin-user-doc --> |
229 | * <!-- end-user-doc --> |
230 | * @generated |
231 | */ |
232 | public static final List<PrimitiveTypeEnum> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); |
233 | |
234 | /** |
235 | * Returns the '<em><b>Primitive Type Enum</b></em>' literal with the specified literal value. |
236 | * <!-- begin-user-doc --> |
237 | * <!-- end-user-doc --> |
238 | * @generated |
239 | */ |
240 | public static PrimitiveTypeEnum get(String literal) { |
241 | for (int i = 0; i < VALUES_ARRAY.length; ++i) { |
242 | PrimitiveTypeEnum result = VALUES_ARRAY[i]; |
243 | if (result.toString().equals(literal)) { |
244 | return result; |
245 | } |
246 | } |
247 | return null; |
248 | } |
249 | |
250 | /** |
251 | * Returns the '<em><b>Primitive Type Enum</b></em>' literal with the specified name. |
252 | * <!-- begin-user-doc --> |
253 | * <!-- end-user-doc --> |
254 | * @generated |
255 | */ |
256 | public static PrimitiveTypeEnum getByName(String name) { |
257 | for (int i = 0; i < VALUES_ARRAY.length; ++i) { |
258 | PrimitiveTypeEnum result = VALUES_ARRAY[i]; |
259 | if (result.getName().equals(name)) { |
260 | return result; |
261 | } |
262 | } |
263 | return null; |
264 | } |
265 | |
266 | /** |
267 | * Returns the '<em><b>Primitive Type Enum</b></em>' literal with the specified integer value. |
268 | * <!-- begin-user-doc --> |
269 | * <!-- end-user-doc --> |
270 | * @generated |
271 | */ |
272 | public static PrimitiveTypeEnum get(int value) { |
273 | switch (value) { |
274 | case INT_VALUE: return INT; |
275 | case STRING_VALUE: return STRING; |
276 | case BOOL_VALUE: return BOOL; |
277 | case DOUBLE_VALUE: return DOUBLE; |
278 | case CHAR_VALUE: return CHAR; |
279 | case BYTE_VALUE: return BYTE; |
280 | case LONG_VALUE: return LONG; |
281 | } |
282 | return null; |
283 | } |
284 | |
285 | /** |
286 | * <!-- begin-user-doc --> |
287 | * <!-- end-user-doc --> |
288 | * @generated |
289 | */ |
290 | private final int value; |
291 | |
292 | /** |
293 | * <!-- begin-user-doc --> |
294 | * <!-- end-user-doc --> |
295 | * @generated |
296 | */ |
297 | private final String name; |
298 | |
299 | /** |
300 | * <!-- begin-user-doc --> |
301 | * <!-- end-user-doc --> |
302 | * @generated |
303 | */ |
304 | private final String literal; |
305 | |
306 | /** |
307 | * Only this class can construct instances. |
308 | * <!-- begin-user-doc --> |
309 | * <!-- end-user-doc --> |
310 | * @generated |
311 | */ |
312 | private PrimitiveTypeEnum(int value, String name, String literal) { |
313 | this.value = value; |
314 | this.name = name; |
315 | this.literal = literal; |
316 | } |
317 | |
318 | /** |
319 | * <!-- begin-user-doc --> |
320 | * <!-- end-user-doc --> |
321 | * @generated |
322 | */ |
323 | public int getValue() { |
324 | return value; |
325 | } |
326 | |
327 | /** |
328 | * <!-- begin-user-doc --> |
329 | * <!-- end-user-doc --> |
330 | * @generated |
331 | */ |
332 | public String getName() { |
333 | return name; |
334 | } |
335 | |
336 | /** |
337 | * <!-- begin-user-doc --> |
338 | * <!-- end-user-doc --> |
339 | * @generated |
340 | */ |
341 | public String getLiteral() { |
342 | return literal; |
343 | } |
344 | |
345 | /** |
346 | * Returns the literal value of the enumerator, which is its string representation. |
347 | * <!-- begin-user-doc --> |
348 | * <!-- end-user-doc --> |
349 | * @generated |
350 | */ |
351 | @Override |
352 | public String toString() { |
353 | return literal; |
354 | } |
355 | |
356 | } //PrimitiveTypeEnum |