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