1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package EssentialOCL; |
8 | |
9 | import java.util.Arrays; |
10 | import java.util.Collections; |
11 | import java.util.List; |
12 | |
13 | import org.eclipse.emf.common.util.Enumerator; |
14 | |
15 | /** |
16 | * <!-- begin-user-doc --> |
17 | * A representation of the literals of the enumeration '<em><b>Collection Kind</b></em>', |
18 | * and utility methods for working with them. |
19 | * <!-- end-user-doc --> |
20 | * @see EssentialOCL.EssentialOCLPackage#getCollectionKind() |
21 | * @model |
22 | * @generated |
23 | */ |
24 | public enum CollectionKind implements Enumerator { |
25 | /** |
26 | * The '<em><b>Set</b></em>' literal object. |
27 | * <!-- begin-user-doc --> |
28 | * <!-- end-user-doc --> |
29 | * @see #SET_VALUE |
30 | * @generated |
31 | * @ordered |
32 | */ |
33 | SET(0, "Set", "Set"), |
34 | |
35 | /** |
36 | * The '<em><b>Ordered Set</b></em>' literal object. |
37 | * <!-- begin-user-doc --> |
38 | * <!-- end-user-doc --> |
39 | * @see #ORDERED_SET_VALUE |
40 | * @generated |
41 | * @ordered |
42 | */ |
43 | ORDERED_SET(1, "OrderedSet", "OrderedSet"), |
44 | |
45 | /** |
46 | * The '<em><b>Bag</b></em>' literal object. |
47 | * <!-- begin-user-doc --> |
48 | * <!-- end-user-doc --> |
49 | * @see #BAG_VALUE |
50 | * @generated |
51 | * @ordered |
52 | */ |
53 | BAG(2, "Bag", "Bag"), |
54 | |
55 | /** |
56 | * The '<em><b>Sequence</b></em>' literal object. |
57 | * <!-- begin-user-doc --> |
58 | * <!-- end-user-doc --> |
59 | * @see #SEQUENCE_VALUE |
60 | * @generated |
61 | * @ordered |
62 | */ |
63 | SEQUENCE(3, "Sequence", "Sequence"), |
64 | |
65 | /** |
66 | * The '<em><b>Collection</b></em>' literal object. |
67 | * <!-- begin-user-doc --> |
68 | * <!-- end-user-doc --> |
69 | * @see #COLLECTION_VALUE |
70 | * @generated |
71 | * @ordered |
72 | */ |
73 | COLLECTION(4, "Collection", "Collection"); |
74 | |
75 | /** |
76 | * The '<em><b>Set</b></em>' literal value. |
77 | * <!-- begin-user-doc --> |
78 | * <p> |
79 | * If the meaning of '<em><b>Set</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 #SET |
84 | * @model name="Set" |
85 | * @generated |
86 | * @ordered |
87 | */ |
88 | public static final int SET_VALUE = 0; |
89 | |
90 | /** |
91 | * The '<em><b>Ordered Set</b></em>' literal value. |
92 | * <!-- begin-user-doc --> |
93 | * <p> |
94 | * If the meaning of '<em><b>Ordered Set</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 #ORDERED_SET |
99 | * @model name="OrderedSet" |
100 | * @generated |
101 | * @ordered |
102 | */ |
103 | public static final int ORDERED_SET_VALUE = 1; |
104 | |
105 | /** |
106 | * The '<em><b>Bag</b></em>' literal value. |
107 | * <!-- begin-user-doc --> |
108 | * <p> |
109 | * If the meaning of '<em><b>Bag</b></em>' literal object isn't clear, |
110 | * there really should be more of a description here... |
111 | * </p> |
112 | * <!-- end-user-doc --> |
113 | * @see #BAG |
114 | * @model name="Bag" |
115 | * @generated |
116 | * @ordered |
117 | */ |
118 | public static final int BAG_VALUE = 2; |
119 | |
120 | /** |
121 | * The '<em><b>Sequence</b></em>' literal value. |
122 | * <!-- begin-user-doc --> |
123 | * <p> |
124 | * If the meaning of '<em><b>Sequence</b></em>' literal object isn't clear, |
125 | * there really should be more of a description here... |
126 | * </p> |
127 | * <!-- end-user-doc --> |
128 | * @see #SEQUENCE |
129 | * @model name="Sequence" |
130 | * @generated |
131 | * @ordered |
132 | */ |
133 | public static final int SEQUENCE_VALUE = 3; |
134 | |
135 | /** |
136 | * The '<em><b>Collection</b></em>' literal value. |
137 | * <!-- begin-user-doc --> |
138 | * <p> |
139 | * If the meaning of '<em><b>Collection</b></em>' literal object isn't clear, |
140 | * there really should be more of a description here... |
141 | * </p> |
142 | * <!-- end-user-doc --> |
143 | * @see #COLLECTION |
144 | * @model name="Collection" |
145 | * @generated |
146 | * @ordered |
147 | */ |
148 | public static final int COLLECTION_VALUE = 4; |
149 | |
150 | /** |
151 | * An array of all the '<em><b>Collection Kind</b></em>' enumerators. |
152 | * <!-- begin-user-doc --> |
153 | * <!-- end-user-doc --> |
154 | * @generated |
155 | */ |
156 | private static final CollectionKind[] VALUES_ARRAY = |
157 | new CollectionKind[] { |
158 | SET, |
159 | ORDERED_SET, |
160 | BAG, |
161 | SEQUENCE, |
162 | COLLECTION, |
163 | }; |
164 | |
165 | /** |
166 | * A public read-only list of all the '<em><b>Collection Kind</b></em>' enumerators. |
167 | * <!-- begin-user-doc --> |
168 | * <!-- end-user-doc --> |
169 | * @generated |
170 | */ |
171 | public static final List<CollectionKind> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); |
172 | |
173 | /** |
174 | * Returns the '<em><b>Collection Kind</b></em>' literal with the specified literal value. |
175 | * <!-- begin-user-doc --> |
176 | * <!-- end-user-doc --> |
177 | * @generated |
178 | */ |
179 | public static CollectionKind get(String literal) { |
180 | for (int i = 0; i < VALUES_ARRAY.length; ++i) { |
181 | CollectionKind result = VALUES_ARRAY[i]; |
182 | if (result.toString().equals(literal)) { |
183 | return result; |
184 | } |
185 | } |
186 | return null; |
187 | } |
188 | |
189 | /** |
190 | * Returns the '<em><b>Collection Kind</b></em>' literal with the specified name. |
191 | * <!-- begin-user-doc --> |
192 | * <!-- end-user-doc --> |
193 | * @generated |
194 | */ |
195 | public static CollectionKind getByName(String name) { |
196 | for (int i = 0; i < VALUES_ARRAY.length; ++i) { |
197 | CollectionKind result = VALUES_ARRAY[i]; |
198 | if (result.getName().equals(name)) { |
199 | return result; |
200 | } |
201 | } |
202 | return null; |
203 | } |
204 | |
205 | /** |
206 | * Returns the '<em><b>Collection Kind</b></em>' literal with the specified integer value. |
207 | * <!-- begin-user-doc --> |
208 | * <!-- end-user-doc --> |
209 | * @generated |
210 | */ |
211 | public static CollectionKind get(int value) { |
212 | switch (value) { |
213 | case SET_VALUE: return SET; |
214 | case ORDERED_SET_VALUE: return ORDERED_SET; |
215 | case BAG_VALUE: return BAG; |
216 | case SEQUENCE_VALUE: return SEQUENCE; |
217 | case COLLECTION_VALUE: return COLLECTION; |
218 | } |
219 | return null; |
220 | } |
221 | |
222 | /** |
223 | * <!-- begin-user-doc --> |
224 | * <!-- end-user-doc --> |
225 | * @generated |
226 | */ |
227 | private final int value; |
228 | |
229 | /** |
230 | * <!-- begin-user-doc --> |
231 | * <!-- end-user-doc --> |
232 | * @generated |
233 | */ |
234 | private final String name; |
235 | |
236 | /** |
237 | * <!-- begin-user-doc --> |
238 | * <!-- end-user-doc --> |
239 | * @generated |
240 | */ |
241 | private final String literal; |
242 | |
243 | /** |
244 | * Only this class can construct instances. |
245 | * <!-- begin-user-doc --> |
246 | * <!-- end-user-doc --> |
247 | * @generated |
248 | */ |
249 | private CollectionKind(int value, String name, String literal) { |
250 | this.value = value; |
251 | this.name = name; |
252 | this.literal = literal; |
253 | } |
254 | |
255 | /** |
256 | * <!-- begin-user-doc --> |
257 | * <!-- end-user-doc --> |
258 | * @generated |
259 | */ |
260 | public int getValue() { |
261 | return value; |
262 | } |
263 | |
264 | /** |
265 | * <!-- begin-user-doc --> |
266 | * <!-- end-user-doc --> |
267 | * @generated |
268 | */ |
269 | public String getName() { |
270 | return name; |
271 | } |
272 | |
273 | /** |
274 | * <!-- begin-user-doc --> |
275 | * <!-- end-user-doc --> |
276 | * @generated |
277 | */ |
278 | public String getLiteral() { |
279 | return literal; |
280 | } |
281 | |
282 | /** |
283 | * Returns the literal value of the enumerator, which is its string representation. |
284 | * <!-- begin-user-doc --> |
285 | * <!-- end-user-doc --> |
286 | * @generated |
287 | */ |
288 | @Override |
289 | public String toString() { |
290 | return literal; |
291 | } |
292 | |
293 | } //CollectionKind |