1 | /** |
2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.pcm.qosannotations.qos_reliability.util; |
7 | |
8 | import de.uka.ipd.sdq.pcm.qosannotations.qos_reliability.*; |
9 | import java.util.Map; |
10 | |
11 | import org.eclipse.emf.common.util.DiagnosticChain; |
12 | import org.eclipse.emf.common.util.ResourceLocator; |
13 | import org.eclipse.emf.ecore.EPackage; |
14 | import org.eclipse.emf.ecore.util.EObjectValidator; |
15 | |
16 | import de.uka.ipd.sdq.pcm.qosannotations.qos_reliability.Qos_reliabilityPackage; |
17 | import de.uka.ipd.sdq.pcm.qosannotations.qos_reliability.SpecifiedReliabilityAnnotation; |
18 | |
19 | /** |
20 | * <!-- begin-user-doc --> |
21 | * The <b>Validator</b> for the model. |
22 | * <!-- end-user-doc --> |
23 | * @see de.uka.ipd.sdq.pcm.qosannotations.qos_reliability.Qos_reliabilityPackage |
24 | * @generated |
25 | */ |
26 | public class Qos_reliabilityValidator extends EObjectValidator { |
27 | /** |
28 | * <!-- begin-user-doc --> |
29 | * <!-- end-user-doc --> |
30 | * @generated |
31 | */ |
32 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
33 | |
34 | /** |
35 | * The cached model package |
36 | * <!-- begin-user-doc --> |
37 | * <!-- end-user-doc --> |
38 | * @generated |
39 | */ |
40 | public static final Qos_reliabilityValidator INSTANCE = new Qos_reliabilityValidator(); |
41 | |
42 | /** |
43 | * 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. |
44 | * <!-- begin-user-doc --> |
45 | * <!-- end-user-doc --> |
46 | * @see org.eclipse.emf.common.util.Diagnostic#getSource() |
47 | * @see org.eclipse.emf.common.util.Diagnostic#getCode() |
48 | * @generated |
49 | */ |
50 | public static final String DIAGNOSTIC_SOURCE = "de.uka.ipd.sdq.pcm.qosannotations.qos_reliability"; |
51 | |
52 | /** |
53 | * The {@link org.eclipse.emf.common.util.Diagnostic#getCode() code} for constraint 'Specified Reliability Annotation Must Reference Required Role Of ASystem' of 'Specified Reliability Annotation'. |
54 | * <!-- begin-user-doc --> |
55 | * <!-- end-user-doc --> |
56 | * @generated |
57 | */ |
58 | public static final int SPECIFIED_RELIABILITY_ANNOTATION__SPECIFIED_RELIABILITY_ANNOTATION_MUST_REFERENCE_REQUIRED_ROLE_OF_ASYSTEM = 1; |
59 | |
60 | /** |
61 | * The {@link org.eclipse.emf.common.util.Diagnostic#getCode() code} for constraint 'Sum Of Reliability Annotation Failure Probabilities Must Not Exceed1' of 'Specified Reliability Annotation'. |
62 | * <!-- begin-user-doc --> |
63 | * <!-- end-user-doc --> |
64 | * @generated |
65 | */ |
66 | public static final int SPECIFIED_RELIABILITY_ANNOTATION__SUM_OF_RELIABILITY_ANNOTATION_FAILURE_PROBABILITIES_MUST_NOT_EXCEED1 = 2; |
67 | |
68 | /** |
69 | * The {@link org.eclipse.emf.common.util.Diagnostic#getCode() code} for constraint 'Multiple External Occurrence Descriptions Per Failure Type Not Allowed' of 'Specified Reliability Annotation'. |
70 | * <!-- begin-user-doc --> |
71 | * <!-- end-user-doc --> |
72 | * @generated |
73 | */ |
74 | public static final int SPECIFIED_RELIABILITY_ANNOTATION__MULTIPLE_EXTERNAL_OCCURRENCE_DESCRIPTIONS_PER_FAILURE_TYPE_NOT_ALLOWED = 3; |
75 | |
76 | /** |
77 | * A constant with a fixed name that can be used as the base value for additional hand written constants. |
78 | * <!-- begin-user-doc --> |
79 | * <!-- end-user-doc --> |
80 | * @generated |
81 | */ |
82 | private static final int GENERATED_DIAGNOSTIC_CODE_COUNT = 3; |
83 | |
84 | /** |
85 | * A constant with a fixed name that can be used as the base value for additional hand written constants in a derived class. |
86 | * <!-- begin-user-doc --> |
87 | * <!-- end-user-doc --> |
88 | * @generated |
89 | */ |
90 | protected static final int DIAGNOSTIC_CODE_COUNT = GENERATED_DIAGNOSTIC_CODE_COUNT; |
91 | |
92 | /** |
93 | * Creates an instance of the switch. |
94 | * <!-- begin-user-doc --> |
95 | * <!-- end-user-doc --> |
96 | * @generated |
97 | */ |
98 | public Qos_reliabilityValidator() { |
99 | super(); |
100 | } |
101 | |
102 | /** |
103 | * Returns the package of this validator switch. |
104 | * <!-- begin-user-doc --> |
105 | * <!-- end-user-doc --> |
106 | * @generated |
107 | */ |
108 | @Override |
109 | protected EPackage getEPackage() { |
110 | return Qos_reliabilityPackage.eINSTANCE; |
111 | } |
112 | |
113 | /** |
114 | * Calls <code>validateXXX</code> for the corresponding classifier of the model. |
115 | * <!-- begin-user-doc --> |
116 | * <!-- end-user-doc --> |
117 | * @generated |
118 | */ |
119 | @Override |
120 | protected boolean validate(int classifierID, Object value, DiagnosticChain diagnostics, Map<Object, Object> context) { |
121 | switch (classifierID) { |
122 | case Qos_reliabilityPackage.SPECIFIED_RELIABILITY_ANNOTATION: |
123 | return validateSpecifiedReliabilityAnnotation((SpecifiedReliabilityAnnotation)value, diagnostics, context); |
124 | default: |
125 | return true; |
126 | } |
127 | } |
128 | |
129 | /** |
130 | * <!-- begin-user-doc --> |
131 | * <!-- end-user-doc --> |
132 | * @generated |
133 | */ |
134 | public boolean validateSpecifiedReliabilityAnnotation(SpecifiedReliabilityAnnotation specifiedReliabilityAnnotation, DiagnosticChain diagnostics, Map<Object, Object> context) { |
135 | boolean result = validate_EveryMultiplicityConforms(specifiedReliabilityAnnotation, diagnostics, context); |
136 | if (result || diagnostics != null) result &= validate_EveryDataValueConforms(specifiedReliabilityAnnotation, diagnostics, context); |
137 | if (result || diagnostics != null) result &= validate_EveryReferenceIsContained(specifiedReliabilityAnnotation, diagnostics, context); |
138 | if (result || diagnostics != null) result &= validate_EveryProxyResolves(specifiedReliabilityAnnotation, diagnostics, context); |
139 | if (result || diagnostics != null) result &= validate_UniqueID(specifiedReliabilityAnnotation, diagnostics, context); |
140 | if (result || diagnostics != null) result &= validate_EveryKeyUnique(specifiedReliabilityAnnotation, diagnostics, context); |
141 | if (result || diagnostics != null) result &= validate_EveryMapEntryUnique(specifiedReliabilityAnnotation, diagnostics, context); |
142 | if (result || diagnostics != null) result &= validateSpecifiedReliabilityAnnotation_SpecifiedReliabilityAnnotationMustReferenceRequiredRoleOfASystem(specifiedReliabilityAnnotation, diagnostics, context); |
143 | if (result || diagnostics != null) result &= validateSpecifiedReliabilityAnnotation_SumOfReliabilityAnnotationFailureProbabilitiesMustNotExceed1(specifiedReliabilityAnnotation, diagnostics, context); |
144 | if (result || diagnostics != null) result &= validateSpecifiedReliabilityAnnotation_MultipleExternalOccurrenceDescriptionsPerFailureTypeNotAllowed(specifiedReliabilityAnnotation, diagnostics, context); |
145 | return result; |
146 | } |
147 | |
148 | /** |
149 | * Validates the SpecifiedReliabilityAnnotationMustReferenceRequiredRoleOfASystem constraint of '<em>Specified Reliability Annotation</em>'. |
150 | * <!-- begin-user-doc --> |
151 | * <!-- end-user-doc --> |
152 | * @generated |
153 | */ |
154 | public boolean validateSpecifiedReliabilityAnnotation_SpecifiedReliabilityAnnotationMustReferenceRequiredRoleOfASystem(SpecifiedReliabilityAnnotation specifiedReliabilityAnnotation, DiagnosticChain diagnostics, Map<Object, Object> context) { |
155 | return specifiedReliabilityAnnotation.SpecifiedReliabilityAnnotationMustReferenceRequiredRoleOfASystem(diagnostics, context); |
156 | } |
157 | |
158 | /** |
159 | * Validates the SumOfReliabilityAnnotationFailureProbabilitiesMustNotExceed1 constraint of '<em>Specified Reliability Annotation</em>'. |
160 | * <!-- begin-user-doc --> |
161 | * <!-- end-user-doc --> |
162 | * @generated |
163 | */ |
164 | public boolean validateSpecifiedReliabilityAnnotation_SumOfReliabilityAnnotationFailureProbabilitiesMustNotExceed1(SpecifiedReliabilityAnnotation specifiedReliabilityAnnotation, DiagnosticChain diagnostics, Map<Object, Object> context) { |
165 | return specifiedReliabilityAnnotation.SumOfReliabilityAnnotationFailureProbabilitiesMustNotExceed1(diagnostics, context); |
166 | } |
167 | |
168 | /** |
169 | * Validates the MultipleExternalOccurrenceDescriptionsPerFailureTypeNotAllowed constraint of '<em>Specified Reliability Annotation</em>'. |
170 | * <!-- begin-user-doc --> |
171 | * <!-- end-user-doc --> |
172 | * @generated |
173 | */ |
174 | public boolean validateSpecifiedReliabilityAnnotation_MultipleExternalOccurrenceDescriptionsPerFailureTypeNotAllowed(SpecifiedReliabilityAnnotation specifiedReliabilityAnnotation, DiagnosticChain diagnostics, Map<Object, Object> context) { |
175 | return specifiedReliabilityAnnotation.MultipleExternalOccurrenceDescriptionsPerFailureTypeNotAllowed(diagnostics, context); |
176 | } |
177 | |
178 | /** |
179 | * Returns the resource locator that will be used to fetch messages for this validator's diagnostics. |
180 | * <!-- begin-user-doc --> |
181 | * <!-- end-user-doc --> |
182 | * @generated |
183 | */ |
184 | @Override |
185 | public ResourceLocator getResourceLocator() { |
186 | // TODO |
187 | // Specialize this to return a resource locator for messages specific to this validator. |
188 | // Ensure that you remove @generated or mark it @generated NOT |
189 | return super.getResourceLocator(); |
190 | } |
191 | |
192 | } //Qos_reliabilityValidator |