1 /**
2 * <copyright>
3 * </copyright>
4 *
5 * $Id$
6 */
7 package BusinessDomainDsl;
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>Multiplicity</b></em>',
18 * and utility methods for working with them.
19 * <!-- end-user-doc -->
20 * @see BusinessDomainDsl.BusinessDomainDslPackage#getMultiplicity()
21 * @model
22 * @generated
23 */
24 public enum Multiplicity implements Enumerator {
25 /**
26 * The '<em><b>Zero Many</b></em>' literal object.
27 * <!-- begin-user-doc -->
28 * <!-- end-user-doc -->
29 * @see #ZERO_MANY_VALUE
30 * @generated
31 * @ordered
32 */
33 ZERO_MANY(0, "ZeroMany", "ZeroMany"),
34
35 /**
36 * The '<em><b>One</b></em>' literal object.
37 * <!-- begin-user-doc -->
38 * <!-- end-user-doc -->
39 * @see #ONE_VALUE
40 * @generated
41 * @ordered
42 */
43 ONE(1, "One", "One"),
44
45 /**
46 * The '<em><b>Zero One</b></em>' literal object.
47 * <!-- begin-user-doc -->
48 * <!-- end-user-doc -->
49 * @see #ZERO_ONE_VALUE
50 * @generated
51 * @ordered
52 */
53 ZERO_ONE(2, "ZeroOne", "ZeroOne"),
54
55 /**
56 * The '<em><b>One Many</b></em>' literal object.
57 * <!-- begin-user-doc -->
58 * <!-- end-user-doc -->
59 * @see #ONE_MANY_VALUE
60 * @generated
61 * @ordered
62 */
63 ONE_MANY(3, "OneMany", "OneMany");
64
65 /**
66 * The '<em><b>Zero Many</b></em>' literal value.
67 * <!-- begin-user-doc -->
68 * <p>
69 * If the meaning of '<em><b>Zero Many</b></em>' literal object isn't clear,
70 * there really should be more of a description here...
71 * </p>
72 * <!-- end-user-doc -->
73 * @see #ZERO_MANY
74 * @model name="ZeroMany"
75 * @generated
76 * @ordered
77 */
78 public static final int ZERO_MANY_VALUE = 0;
79
80 /**
81 * The '<em><b>One</b></em>' literal value.
82 * <!-- begin-user-doc -->
83 * <p>
84 * If the meaning of '<em><b>One</b></em>' literal object isn't clear,
85 * there really should be more of a description here...
86 * </p>
87 * <!-- end-user-doc -->
88 * @see #ONE
89 * @model name="One"
90 * @generated
91 * @ordered
92 */
93 public static final int ONE_VALUE = 1;
94
95 /**
96 * The '<em><b>Zero One</b></em>' literal value.
97 * <!-- begin-user-doc -->
98 * <p>
99 * If the meaning of '<em><b>Zero One</b></em>' literal object isn't clear,
100 * there really should be more of a description here...
101 * </p>
102 * <!-- end-user-doc -->
103 * @see #ZERO_ONE
104 * @model name="ZeroOne"
105 * @generated
106 * @ordered
107 */
108 public static final int ZERO_ONE_VALUE = 2;
109
110 /**
111 * The '<em><b>One Many</b></em>' literal value.
112 * <!-- begin-user-doc -->
113 * <p>
114 * If the meaning of '<em><b>One Many</b></em>' literal object isn't clear,
115 * there really should be more of a description here...
116 * </p>
117 * <!-- end-user-doc -->
118 * @see #ONE_MANY
119 * @model name="OneMany"
120 * @generated
121 * @ordered
122 */
123 public static final int ONE_MANY_VALUE = 3;
124
125 /**
126 * An array of all the '<em><b>Multiplicity</b></em>' enumerators.
127 * <!-- begin-user-doc -->
128 * <!-- end-user-doc -->
129 * @generated
130 */
131 private static final Multiplicity[] VALUES_ARRAY =
132 new Multiplicity[] {
133 ZERO_MANY,
134 ONE,
135 ZERO_ONE,
136 ONE_MANY,
137 };
138
139 /**
140 * A public read-only list of all the '<em><b>Multiplicity</b></em>' enumerators.
141 * <!-- begin-user-doc -->
142 * <!-- end-user-doc -->
143 * @generated
144 */
145 public static final List<Multiplicity> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY));
146
147 /**
148 * Returns the '<em><b>Multiplicity</b></em>' literal with the specified literal value.
149 * <!-- begin-user-doc -->
150 * <!-- end-user-doc -->
151 * @generated
152 */
153 public static Multiplicity get(String literal) {
154 for (int i = 0; i < VALUES_ARRAY.length; ++i) {
155 Multiplicity result = VALUES_ARRAY[i];
156 if (result.toString().equals(literal)) {
157 return result;
158 }
159 }
160 return null;
161 }
162
163 /**
164 * Returns the '<em><b>Multiplicity</b></em>' literal with the specified name.
165 * <!-- begin-user-doc -->
166 * <!-- end-user-doc -->
167 * @generated
168 */
169 public static Multiplicity getByName(String name) {
170 for (int i = 0; i < VALUES_ARRAY.length; ++i) {
171 Multiplicity result = VALUES_ARRAY[i];
172 if (result.getName().equals(name)) {
173 return result;
174 }
175 }
176 return null;
177 }
178
179 /**
180 * Returns the '<em><b>Multiplicity</b></em>' literal with the specified integer value.
181 * <!-- begin-user-doc -->
182 * <!-- end-user-doc -->
183 * @generated
184 */
185 public static Multiplicity get(int value) {
186 switch (value) {
187 case ZERO_MANY_VALUE: return ZERO_MANY;
188 case ONE_VALUE: return ONE;
189 case ZERO_ONE_VALUE: return ZERO_ONE;
190 case ONE_MANY_VALUE: return ONE_MANY;
191 }
192 return null;
193 }
194
195 /**
196 * <!-- begin-user-doc -->
197 * <!-- end-user-doc -->
198 * @generated
199 */
200 private final int value;
201
202 /**
203 * <!-- begin-user-doc -->
204 * <!-- end-user-doc -->
205 * @generated
206 */
207 private final String name;
208
209 /**
210 * <!-- begin-user-doc -->
211 * <!-- end-user-doc -->
212 * @generated
213 */
214 private final String literal;
215
216 /**
217 * Only this class can construct instances.
218 * <!-- begin-user-doc -->
219 * <!-- end-user-doc -->
220 * @generated
221 */
222 private Multiplicity(int value, String name, String literal) {
223 this.value = value;
224 this.name = name;
225 this.literal = literal;
226 }
227
228 /**
229 * <!-- begin-user-doc -->
230 * <!-- end-user-doc -->
231 * @generated
232 */
233 public int getValue() {
234 return value;
235 }
236
237 /**
238 * <!-- begin-user-doc -->
239 * <!-- end-user-doc -->
240 * @generated
241 */
242 public String getName() {
243 return name;
244 }
245
246 /**
247 * <!-- begin-user-doc -->
248 * <!-- end-user-doc -->
249 * @generated
250 */
251 public String getLiteral() {
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 return literal;
264 }
265
266 } //Multiplicity