Skip to content

Package: TestEnum

TestEnum

nameinstructionbranchcomplexitylinemethod
TestEnum(String, int, int, String, String)
M: 0 C: 14
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 5
100%
M: 0 C: 1
100%
get(String)
M: 0 C: 21
100%
M: 0 C: 4
100%
M: 0 C: 3
100%
M: 0 C: 5
100%
M: 0 C: 1
100%
get(int)
M: 12 C: 0
0%
M: 5 C: 0
0%
M: 5 C: 0
0%
M: 6 C: 0
0%
M: 1 C: 0
0%
getByName(String)
M: 21 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
getLiteral()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getName()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getValue()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
static {...}
M: 0 C: 79
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 11
100%
M: 0 C: 1
100%
toString()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%

Coverage

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