1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.featureconfig.util; |
8 | |
9 | import de.uka.ipd.sdq.featureconfig.*; |
10 | import java.util.Map; |
11 | |
12 | import org.eclipse.emf.common.util.DiagnosticChain; |
13 | import org.eclipse.emf.common.util.ResourceLocator; |
14 | import org.eclipse.emf.ecore.EPackage; |
15 | import org.eclipse.emf.ecore.util.EObjectValidator; |
16 | |
17 | import de.uka.ipd.sdq.featureconfig.AttributeValue; |
18 | import de.uka.ipd.sdq.featureconfig.ConfigNode; |
19 | import de.uka.ipd.sdq.featureconfig.ConfigState; |
20 | import de.uka.ipd.sdq.featureconfig.Configuration; |
21 | import de.uka.ipd.sdq.featureconfig.DoubleAttributeValue; |
22 | import de.uka.ipd.sdq.featureconfig.FeatureConfig; |
23 | import de.uka.ipd.sdq.featureconfig.FeatureConfigState; |
24 | import de.uka.ipd.sdq.featureconfig.IntegerAttributeValue; |
25 | import de.uka.ipd.sdq.featureconfig.featureconfigPackage; |
26 | import de.uka.ipd.sdq.identifier.util.IdentifierValidator; |
27 | |
28 | /** |
29 | * <!-- begin-user-doc --> |
30 | * The <b>Validator</b> for the model. |
31 | * <!-- end-user-doc --> |
32 | * @see de.uka.ipd.sdq.featureconfig.featureconfigPackage |
33 | * @generated |
34 | */ |
35 | public class featureconfigValidator extends EObjectValidator { |
36 | /** |
37 | * The cached model package |
38 | * <!-- begin-user-doc --> |
39 | * <!-- end-user-doc --> |
40 | * @generated |
41 | */ |
42 | public static final featureconfigValidator INSTANCE = new featureconfigValidator(); |
43 | |
44 | /** |
45 | * A constant for the {@link org.eclipse.emf.common.util.Diagnostic#getSource() source} of diagnostic {@link org.eclipse.emf.common.util.Diagnostic#getCode() codes} from this package. |
46 | * <!-- begin-user-doc --> |
47 | * <!-- end-user-doc --> |
48 | * @see org.eclipse.emf.common.util.Diagnostic#getSource() |
49 | * @see org.eclipse.emf.common.util.Diagnostic#getCode() |
50 | * @generated |
51 | */ |
52 | public static final String DIAGNOSTIC_SOURCE = "de.uka.ipd.sdq.featureconfig"; |
53 | |
54 | /** |
55 | * The {@link org.eclipse.emf.common.util.Diagnostic#getCode() code} for constraint 'Config Cardinality Invalid' of 'Config Node'. |
56 | * <!-- begin-user-doc --> |
57 | * <!-- end-user-doc --> |
58 | * @generated |
59 | */ |
60 | public static final int CONFIG_NODE__CONFIG_CARDINALITY_INVALID = 1; |
61 | |
62 | /** |
63 | * The {@link org.eclipse.emf.common.util.Diagnostic#getCode() code} for constraint 'Check Multiplicity Of Feature Group' of 'Config Node'. |
64 | * <!-- begin-user-doc --> |
65 | * <!-- end-user-doc --> |
66 | * @generated |
67 | */ |
68 | public static final int CONFIG_NODE__CHECK_MULTIPLICITY_OF_FEATURE_GROUP = 2; |
69 | |
70 | /** |
71 | * The {@link org.eclipse.emf.common.util.Diagnostic#getCode() code} for constraint 'Attribute Value Is Defined In Feature And Equals Type Integer' of 'Integer Attribute Value'. |
72 | * <!-- begin-user-doc --> |
73 | * <!-- end-user-doc --> |
74 | * @generated |
75 | */ |
76 | public static final int INTEGER_ATTRIBUTE_VALUE__ATTRIBUTE_VALUE_IS_DEFINED_IN_FEATURE_AND_EQUALS_TYPE_INTEGER = 3; |
77 | |
78 | /** |
79 | * The {@link org.eclipse.emf.common.util.Diagnostic#getCode() code} for constraint 'Attribute Value Is Defined In Feature And Equals Type Double' of 'Double Attribute Value'. |
80 | * <!-- begin-user-doc --> |
81 | * <!-- end-user-doc --> |
82 | * @generated |
83 | */ |
84 | public static final int DOUBLE_ATTRIBUTE_VALUE__ATTRIBUTE_VALUE_IS_DEFINED_IN_FEATURE_AND_EQUALS_TYPE_DOUBLE = 4; |
85 | |
86 | /** |
87 | * The {@link org.eclipse.emf.common.util.Diagnostic#getCode() code} for constraint 'Attribute Value Is Defined In Feature And Equals Type String' of 'String Attribute Value'. |
88 | * <!-- begin-user-doc --> |
89 | * <!-- end-user-doc --> |
90 | * @generated |
91 | */ |
92 | public static final int STRING_ATTRIBUTE_VALUE__ATTRIBUTE_VALUE_IS_DEFINED_IN_FEATURE_AND_EQUALS_TYPE_STRING = 5; |
93 | |
94 | /** |
95 | * The {@link org.eclipse.emf.common.util.Diagnostic#getCode() code} for constraint 'Attribute Value Is Defined In Feature And Equals Type External Object' of 'External Object Attribute Value'. |
96 | * <!-- begin-user-doc --> |
97 | * <!-- end-user-doc --> |
98 | * @generated |
99 | */ |
100 | public static final int EXTERNAL_OBJECT_ATTRIBUTE_VALUE__ATTRIBUTE_VALUE_IS_DEFINED_IN_FEATURE_AND_EQUALS_TYPE_EXTERNAL_OBJECT = 6; |
101 | |
102 | /** |
103 | * A constant with a fixed name that can be used as the base value for additional hand written constants. |
104 | * <!-- begin-user-doc --> |
105 | * <!-- end-user-doc --> |
106 | * @generated |
107 | */ |
108 | private static final int GENERATED_DIAGNOSTIC_CODE_COUNT = 6; |
109 | |
110 | /** |
111 | * A constant with a fixed name that can be used as the base value for additional hand written constants in a derived class. |
112 | * <!-- begin-user-doc --> |
113 | * <!-- end-user-doc --> |
114 | * @generated |
115 | */ |
116 | protected static final int DIAGNOSTIC_CODE_COUNT = GENERATED_DIAGNOSTIC_CODE_COUNT; |
117 | |
118 | /** |
119 | * The cached base package validator. |
120 | * <!-- begin-user-doc --> |
121 | * <!-- end-user-doc --> |
122 | * @generated |
123 | */ |
124 | protected IdentifierValidator identifierValidator; |
125 | |
126 | /** |
127 | * Creates an instance of the switch. |
128 | * <!-- begin-user-doc --> |
129 | * <!-- end-user-doc --> |
130 | * @generated |
131 | */ |
132 | public featureconfigValidator() { |
133 | super(); |
134 | identifierValidator = IdentifierValidator.INSTANCE; |
135 | } |
136 | |
137 | /** |
138 | * Returns the package of this validator switch. |
139 | * <!-- begin-user-doc --> |
140 | * <!-- end-user-doc --> |
141 | * @generated |
142 | */ |
143 | @Override |
144 | protected EPackage getEPackage() { |
145 | return featureconfigPackage.eINSTANCE; |
146 | } |
147 | |
148 | /** |
149 | * Calls <code>validateXXX</code> for the corresponding classifier of the model. |
150 | * <!-- begin-user-doc --> |
151 | * <!-- end-user-doc --> |
152 | * @generated |
153 | */ |
154 | @Override |
155 | protected boolean validate(int classifierID, Object value, DiagnosticChain diagnostics, Map<Object, Object> context) { |
156 | switch (classifierID) { |
157 | case featureconfigPackage.CONFIG_NODE: |
158 | return validateConfigNode((ConfigNode)value, diagnostics, context); |
159 | case featureconfigPackage.ATTRIBUTE_VALUE: |
160 | return validateAttributeValue((AttributeValue)value, diagnostics, context); |
161 | case featureconfigPackage.FEATURE_CONFIG: |
162 | return validateFeatureConfig((FeatureConfig)value, diagnostics, context); |
163 | case featureconfigPackage.CONFIGURATION: |
164 | return validateConfiguration((Configuration)value, diagnostics, context); |
165 | case featureconfigPackage.INTEGER_ATTRIBUTE_VALUE: |
166 | return validateIntegerAttributeValue((IntegerAttributeValue)value, diagnostics, context); |
167 | case featureconfigPackage.DOUBLE_ATTRIBUTE_VALUE: |
168 | return validateDoubleAttributeValue((DoubleAttributeValue)value, diagnostics, context); |
169 | case featureconfigPackage.STRING_ATTRIBUTE_VALUE: |
170 | return validateStringAttributeValue((StringAttributeValue)value, diagnostics, context); |
171 | case featureconfigPackage.EXTERNAL_OBJECT_ATTRIBUTE_VALUE: |
172 | return validateExternalObjectAttributeValue((ExternalObjectAttributeValue)value, diagnostics, context); |
173 | case featureconfigPackage.CONFIG_STATE: |
174 | return validateConfigState((ConfigState)value, diagnostics, context); |
175 | case featureconfigPackage.FEATURE_CONFIG_STATE: |
176 | return validateFeatureConfigState((FeatureConfigState)value, diagnostics, context); |
177 | default: |
178 | return true; |
179 | } |
180 | } |
181 | |
182 | /** |
183 | * <!-- begin-user-doc --> |
184 | * <!-- end-user-doc --> |
185 | * @generated |
186 | */ |
187 | public boolean validateConfigNode(ConfigNode configNode, DiagnosticChain diagnostics, Map<Object, Object> context) { |
188 | boolean result = validate_EveryMultiplicityConforms(configNode, diagnostics, context); |
189 | if (result || diagnostics != null) result &= validate_EveryDataValueConforms(configNode, diagnostics, context); |
190 | if (result || diagnostics != null) result &= validate_EveryReferenceIsContained(configNode, diagnostics, context); |
191 | if (result || diagnostics != null) result &= validate_EveryProxyResolves(configNode, diagnostics, context); |
192 | if (result || diagnostics != null) result &= validate_UniqueID(configNode, diagnostics, context); |
193 | if (result || diagnostics != null) result &= validate_EveryKeyUnique(configNode, diagnostics, context); |
194 | if (result || diagnostics != null) result &= validate_EveryMapEntryUnique(configNode, diagnostics, context); |
195 | if (result || diagnostics != null) result &= validateConfigNode_ConfigCardinalityInvalid(configNode, diagnostics, context); |
196 | if (result || diagnostics != null) result &= validateConfigNode_CheckMultiplicityOfFeatureGroup(configNode, diagnostics, context); |
197 | return result; |
198 | } |
199 | |
200 | /** |
201 | * Validates the ConfigCardinalityInvalid constraint of '<em>Config Node</em>'. |
202 | * <!-- begin-user-doc --> |
203 | * <!-- end-user-doc --> |
204 | * @generated |
205 | */ |
206 | public boolean validateConfigNode_ConfigCardinalityInvalid(ConfigNode configNode, DiagnosticChain diagnostics, Map<Object, Object> context) { |
207 | return configNode.ConfigCardinalityInvalid(diagnostics, context); |
208 | } |
209 | |
210 | /** |
211 | * Validates the CheckMultiplicityOfFeatureGroup constraint of '<em>Config Node</em>'. |
212 | * <!-- begin-user-doc --> |
213 | * <!-- end-user-doc --> |
214 | * @generated |
215 | */ |
216 | public boolean validateConfigNode_CheckMultiplicityOfFeatureGroup(ConfigNode configNode, DiagnosticChain diagnostics, Map<Object, Object> context) { |
217 | return configNode.CheckMultiplicityOfFeatureGroup(diagnostics, context); |
218 | } |
219 | |
220 | /** |
221 | * <!-- begin-user-doc --> |
222 | * <!-- end-user-doc --> |
223 | * @generated |
224 | */ |
225 | public boolean validateAttributeValue(AttributeValue attributeValue, DiagnosticChain diagnostics, Map<Object, Object> context) { |
226 | boolean result = validate_EveryMultiplicityConforms(attributeValue, diagnostics, context); |
227 | if (result || diagnostics != null) result &= validate_EveryDataValueConforms(attributeValue, diagnostics, context); |
228 | if (result || diagnostics != null) result &= validate_EveryReferenceIsContained(attributeValue, diagnostics, context); |
229 | if (result || diagnostics != null) result &= validate_EveryProxyResolves(attributeValue, diagnostics, context); |
230 | if (result || diagnostics != null) result &= validate_UniqueID(attributeValue, diagnostics, context); |
231 | if (result || diagnostics != null) result &= validate_EveryKeyUnique(attributeValue, diagnostics, context); |
232 | if (result || diagnostics != null) result &= validate_EveryMapEntryUnique(attributeValue, diagnostics, context); |
233 | if (result || diagnostics != null) result &= identifierValidator.validateIdentifier_idHasToBeUnique(attributeValue, diagnostics, context); |
234 | return result; |
235 | } |
236 | |
237 | /** |
238 | * <!-- begin-user-doc --> |
239 | * <!-- end-user-doc --> |
240 | * @generated |
241 | */ |
242 | public boolean validateFeatureConfig(FeatureConfig featureConfig, DiagnosticChain diagnostics, Map<Object, Object> context) { |
243 | return validate_EveryDefaultConstraint(featureConfig, diagnostics, context); |
244 | } |
245 | |
246 | /** |
247 | * <!-- begin-user-doc --> |
248 | * <!-- end-user-doc --> |
249 | * @generated |
250 | */ |
251 | public boolean validateConfiguration(Configuration configuration, DiagnosticChain diagnostics, Map<Object, Object> context) { |
252 | return validate_EveryDefaultConstraint(configuration, diagnostics, context); |
253 | } |
254 | |
255 | /** |
256 | * <!-- begin-user-doc --> |
257 | * <!-- end-user-doc --> |
258 | * @generated |
259 | */ |
260 | public boolean validateIntegerAttributeValue(IntegerAttributeValue integerAttributeValue, DiagnosticChain diagnostics, Map<Object, Object> context) { |
261 | boolean result = validate_EveryMultiplicityConforms(integerAttributeValue, diagnostics, context); |
262 | if (result || diagnostics != null) result &= validate_EveryDataValueConforms(integerAttributeValue, diagnostics, context); |
263 | if (result || diagnostics != null) result &= validate_EveryReferenceIsContained(integerAttributeValue, diagnostics, context); |
264 | if (result || diagnostics != null) result &= validate_EveryProxyResolves(integerAttributeValue, diagnostics, context); |
265 | if (result || diagnostics != null) result &= validate_UniqueID(integerAttributeValue, diagnostics, context); |
266 | if (result || diagnostics != null) result &= validate_EveryKeyUnique(integerAttributeValue, diagnostics, context); |
267 | if (result || diagnostics != null) result &= validate_EveryMapEntryUnique(integerAttributeValue, diagnostics, context); |
268 | if (result || diagnostics != null) result &= identifierValidator.validateIdentifier_idHasToBeUnique(integerAttributeValue, diagnostics, context); |
269 | if (result || diagnostics != null) result &= validateIntegerAttributeValue_AttributeValueIsDefinedInFeatureAndEqualsTypeInteger(integerAttributeValue, diagnostics, context); |
270 | return result; |
271 | } |
272 | |
273 | /** |
274 | * Validates the AttributeValueIsDefinedInFeatureAndEqualsTypeInteger constraint of '<em>Integer Attribute Value</em>'. |
275 | * <!-- begin-user-doc --> |
276 | * <!-- end-user-doc --> |
277 | * @generated |
278 | */ |
279 | public boolean validateIntegerAttributeValue_AttributeValueIsDefinedInFeatureAndEqualsTypeInteger(IntegerAttributeValue integerAttributeValue, DiagnosticChain diagnostics, Map<Object, Object> context) { |
280 | return integerAttributeValue.AttributeValueIsDefinedInFeatureAndEqualsTypeInteger(diagnostics, context); |
281 | } |
282 | |
283 | /** |
284 | * <!-- begin-user-doc --> |
285 | * <!-- end-user-doc --> |
286 | * @generated |
287 | */ |
288 | public boolean validateDoubleAttributeValue(DoubleAttributeValue doubleAttributeValue, DiagnosticChain diagnostics, Map<Object, Object> context) { |
289 | boolean result = validate_EveryMultiplicityConforms(doubleAttributeValue, diagnostics, context); |
290 | if (result || diagnostics != null) result &= validate_EveryDataValueConforms(doubleAttributeValue, diagnostics, context); |
291 | if (result || diagnostics != null) result &= validate_EveryReferenceIsContained(doubleAttributeValue, diagnostics, context); |
292 | if (result || diagnostics != null) result &= validate_EveryProxyResolves(doubleAttributeValue, diagnostics, context); |
293 | if (result || diagnostics != null) result &= validate_UniqueID(doubleAttributeValue, diagnostics, context); |
294 | if (result || diagnostics != null) result &= validate_EveryKeyUnique(doubleAttributeValue, diagnostics, context); |
295 | if (result || diagnostics != null) result &= validate_EveryMapEntryUnique(doubleAttributeValue, diagnostics, context); |
296 | if (result || diagnostics != null) result &= identifierValidator.validateIdentifier_idHasToBeUnique(doubleAttributeValue, diagnostics, context); |
297 | if (result || diagnostics != null) result &= validateDoubleAttributeValue_AttributeValueIsDefinedInFeatureAndEqualsTypeDouble(doubleAttributeValue, diagnostics, context); |
298 | return result; |
299 | } |
300 | |
301 | /** |
302 | * Validates the AttributeValueIsDefinedInFeatureAndEqualsTypeDouble constraint of '<em>Double Attribute Value</em>'. |
303 | * <!-- begin-user-doc --> |
304 | * <!-- end-user-doc --> |
305 | * @generated |
306 | */ |
307 | public boolean validateDoubleAttributeValue_AttributeValueIsDefinedInFeatureAndEqualsTypeDouble(DoubleAttributeValue doubleAttributeValue, DiagnosticChain diagnostics, Map<Object, Object> context) { |
308 | return doubleAttributeValue.AttributeValueIsDefinedInFeatureAndEqualsTypeDouble(diagnostics, context); |
309 | } |
310 | |
311 | /** |
312 | * <!-- begin-user-doc --> |
313 | * <!-- end-user-doc --> |
314 | * @generated |
315 | */ |
316 | public boolean validateStringAttributeValue(StringAttributeValue stringAttributeValue, DiagnosticChain diagnostics, Map<Object, Object> context) { |
317 | boolean result = validate_EveryMultiplicityConforms(stringAttributeValue, diagnostics, context); |
318 | if (result || diagnostics != null) result &= validate_EveryDataValueConforms(stringAttributeValue, diagnostics, context); |
319 | if (result || diagnostics != null) result &= validate_EveryReferenceIsContained(stringAttributeValue, diagnostics, context); |
320 | if (result || diagnostics != null) result &= validate_EveryProxyResolves(stringAttributeValue, diagnostics, context); |
321 | if (result || diagnostics != null) result &= validate_UniqueID(stringAttributeValue, diagnostics, context); |
322 | if (result || diagnostics != null) result &= validate_EveryKeyUnique(stringAttributeValue, diagnostics, context); |
323 | if (result || diagnostics != null) result &= validate_EveryMapEntryUnique(stringAttributeValue, diagnostics, context); |
324 | if (result || diagnostics != null) result &= identifierValidator.validateIdentifier_idHasToBeUnique(stringAttributeValue, diagnostics, context); |
325 | if (result || diagnostics != null) result &= validateStringAttributeValue_AttributeValueIsDefinedInFeatureAndEqualsTypeString(stringAttributeValue, diagnostics, context); |
326 | return result; |
327 | } |
328 | |
329 | /** |
330 | * Validates the AttributeValueIsDefinedInFeatureAndEqualsTypeString constraint of '<em>String Attribute Value</em>'. |
331 | * <!-- begin-user-doc --> |
332 | * <!-- end-user-doc --> |
333 | * @generated |
334 | */ |
335 | public boolean validateStringAttributeValue_AttributeValueIsDefinedInFeatureAndEqualsTypeString(StringAttributeValue stringAttributeValue, DiagnosticChain diagnostics, Map<Object, Object> context) { |
336 | return stringAttributeValue.AttributeValueIsDefinedInFeatureAndEqualsTypeString(diagnostics, context); |
337 | } |
338 | |
339 | /** |
340 | * <!-- begin-user-doc --> |
341 | * <!-- end-user-doc --> |
342 | * @generated |
343 | */ |
344 | public boolean validateExternalObjectAttributeValue(ExternalObjectAttributeValue externalObjectAttributeValue, DiagnosticChain diagnostics, Map<Object, Object> context) { |
345 | boolean result = validate_EveryMultiplicityConforms(externalObjectAttributeValue, diagnostics, context); |
346 | if (result || diagnostics != null) result &= validate_EveryDataValueConforms(externalObjectAttributeValue, diagnostics, context); |
347 | if (result || diagnostics != null) result &= validate_EveryReferenceIsContained(externalObjectAttributeValue, diagnostics, context); |
348 | if (result || diagnostics != null) result &= validate_EveryProxyResolves(externalObjectAttributeValue, diagnostics, context); |
349 | if (result || diagnostics != null) result &= validate_UniqueID(externalObjectAttributeValue, diagnostics, context); |
350 | if (result || diagnostics != null) result &= validate_EveryKeyUnique(externalObjectAttributeValue, diagnostics, context); |
351 | if (result || diagnostics != null) result &= validate_EveryMapEntryUnique(externalObjectAttributeValue, diagnostics, context); |
352 | if (result || diagnostics != null) result &= identifierValidator.validateIdentifier_idHasToBeUnique(externalObjectAttributeValue, diagnostics, context); |
353 | if (result || diagnostics != null) result &= validateExternalObjectAttributeValue_AttributeValueIsDefinedInFeatureAndEqualsTypeExternalObject(externalObjectAttributeValue, diagnostics, context); |
354 | return result; |
355 | } |
356 | |
357 | /** |
358 | * Validates the AttributeValueIsDefinedInFeatureAndEqualsTypeExternalObject constraint of '<em>External Object Attribute Value</em>'. |
359 | * <!-- begin-user-doc --> |
360 | * <!-- end-user-doc --> |
361 | * @generated |
362 | */ |
363 | public boolean validateExternalObjectAttributeValue_AttributeValueIsDefinedInFeatureAndEqualsTypeExternalObject(ExternalObjectAttributeValue externalObjectAttributeValue, DiagnosticChain diagnostics, Map<Object, Object> context) { |
364 | return externalObjectAttributeValue.AttributeValueIsDefinedInFeatureAndEqualsTypeExternalObject(diagnostics, context); |
365 | } |
366 | |
367 | /** |
368 | * <!-- begin-user-doc --> |
369 | * <!-- end-user-doc --> |
370 | * @generated |
371 | */ |
372 | public boolean validateConfigState(ConfigState configState, DiagnosticChain diagnostics, Map<Object, Object> context) { |
373 | return true; |
374 | } |
375 | |
376 | /** |
377 | * <!-- begin-user-doc --> |
378 | * <!-- end-user-doc --> |
379 | * @generated |
380 | */ |
381 | public boolean validateFeatureConfigState(FeatureConfigState featureConfigState, DiagnosticChain diagnostics, Map<Object, Object> context) { |
382 | return true; |
383 | } |
384 | |
385 | /** |
386 | * Returns the resource locator that will be used to fetch messages for this validator's diagnostics. |
387 | * <!-- begin-user-doc --> |
388 | * <!-- end-user-doc --> |
389 | * @generated |
390 | */ |
391 | @Override |
392 | public ResourceLocator getResourceLocator() { |
393 | // TODO |
394 | // Specialize this to return a resource locator for messages specific to this validator. |
395 | // Ensure that you remove @generated or mark it @generated NOT |
396 | return super.getResourceLocator(); |
397 | } |
398 | |
399 | } //featureconfigValidator |