Skip to content

Package: Color

Color

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