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