| 1 | /** |
| 2 | * <copyright> |
| 3 | * </copyright> |
| 4 | * |
| 5 | * $Id$ |
| 6 | */ |
| 7 | package de.uka.ipd.sdq.dsexplore.qml.profile.QMLProfile.util; |
| 8 | |
| 9 | import de.uka.ipd.sdq.dsexplore.qml.profile.QMLProfile.*; |
| 10 | |
| 11 | import de.uka.ipd.sdq.identifier.util.IdentifierValidator; |
| 12 | |
| 13 | import java.util.Map; |
| 14 | |
| 15 | import org.eclipse.emf.common.util.DiagnosticChain; |
| 16 | import org.eclipse.emf.common.util.ResourceLocator; |
| 17 | |
| 18 | import org.eclipse.emf.ecore.EPackage; |
| 19 | |
| 20 | import org.eclipse.emf.ecore.util.EObjectValidator; |
| 21 | |
| 22 | /** |
| 23 | * <!-- begin-user-doc --> |
| 24 | * The <b>Validator</b> for the model. |
| 25 | * <!-- end-user-doc --> |
| 26 | * @see de.uka.ipd.sdq.dsexplore.qml.profile.QMLProfile.QMLProfilePackage |
| 27 | * @generated |
| 28 | */ |
| 29 | public class QMLProfileValidator extends EObjectValidator { |
| 30 | /** |
| 31 | * The cached model package |
| 32 | * <!-- begin-user-doc --> |
| 33 | * <!-- end-user-doc --> |
| 34 | * @generated |
| 35 | */ |
| 36 | public static final QMLProfileValidator INSTANCE = new QMLProfileValidator(); |
| 37 | |
| 38 | /** |
| 39 | * 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. |
| 40 | * <!-- begin-user-doc --> |
| 41 | * <!-- end-user-doc --> |
| 42 | * @see org.eclipse.emf.common.util.Diagnostic#getSource() |
| 43 | * @see org.eclipse.emf.common.util.Diagnostic#getCode() |
| 44 | * @generated |
| 45 | */ |
| 46 | public static final String DIAGNOSTIC_SOURCE = "de.uka.ipd.sdq.dsexplore.qml.profile.QMLProfile"; |
| 47 | |
| 48 | /** |
| 49 | * The {@link org.eclipse.emf.common.util.Diagnostic#getCode() code} for constraint 'Profile cannot refine itself' of 'Refined QML Profile'. |
| 50 | * <!-- begin-user-doc --> |
| 51 | * <!-- end-user-doc --> |
| 52 | * @generated |
| 53 | */ |
| 54 | public static final int REFINED_QML_PROFILE__PROFILE_CANNOT_REFINE_ITSELF = 1; |
| 55 | |
| 56 | /** |
| 57 | * A constant with a fixed name that can be used as the base value for additional hand written constants. |
| 58 | * <!-- begin-user-doc --> |
| 59 | * <!-- end-user-doc --> |
| 60 | * @generated |
| 61 | */ |
| 62 | private static final int GENERATED_DIAGNOSTIC_CODE_COUNT = 1; |
| 63 | |
| 64 | /** |
| 65 | * A constant with a fixed name that can be used as the base value for additional hand written constants in a derived class. |
| 66 | * <!-- begin-user-doc --> |
| 67 | * <!-- end-user-doc --> |
| 68 | * @generated |
| 69 | */ |
| 70 | protected static final int DIAGNOSTIC_CODE_COUNT = GENERATED_DIAGNOSTIC_CODE_COUNT; |
| 71 | |
| 72 | /** |
| 73 | * The cached base package validator. |
| 74 | * <!-- begin-user-doc --> |
| 75 | * <!-- end-user-doc --> |
| 76 | * @generated |
| 77 | */ |
| 78 | protected IdentifierValidator identifierValidator; |
| 79 | |
| 80 | /** |
| 81 | * Creates an instance of the switch. |
| 82 | * <!-- begin-user-doc --> |
| 83 | * <!-- end-user-doc --> |
| 84 | * @generated |
| 85 | */ |
| 86 | public QMLProfileValidator() { |
| 87 | super(); |
| 88 | identifierValidator = IdentifierValidator.INSTANCE; |
| 89 | } |
| 90 | |
| 91 | /** |
| 92 | * Returns the package of this validator switch. |
| 93 | * <!-- begin-user-doc --> |
| 94 | * <!-- end-user-doc --> |
| 95 | * @generated |
| 96 | */ |
| 97 | @Override |
| 98 | protected EPackage getEPackage() { |
| 99 | return QMLProfilePackage.eINSTANCE; |
| 100 | } |
| 101 | |
| 102 | /** |
| 103 | * Calls <code>validateXXX</code> for the corresponding classifier of the model. |
| 104 | * <!-- begin-user-doc --> |
| 105 | * <!-- end-user-doc --> |
| 106 | * @generated |
| 107 | */ |
| 108 | @Override |
| 109 | protected boolean validate(int classifierID, Object value, DiagnosticChain diagnostics, Map<Object, Object> context) { |
| 110 | switch (classifierID) { |
| 111 | case QMLProfilePackage.SIMPLE_QML_PROFILE: |
| 112 | return validateSimpleQMLProfile((SimpleQMLProfile)value, diagnostics, context); |
| 113 | case QMLProfilePackage.GENERIC_QML_PROFILE: |
| 114 | return validateGenericQMLProfile((GenericQMLProfile)value, diagnostics, context); |
| 115 | case QMLProfilePackage.REQUIREMENT: |
| 116 | return validateRequirement((Requirement)value, diagnostics, context); |
| 117 | case QMLProfilePackage.REFINED_QML_PROFILE: |
| 118 | return validateRefinedQMLProfile((RefinedQMLProfile)value, diagnostics, context); |
| 119 | case QMLProfilePackage.USAGE_SCENARIO_REQUIREMENT: |
| 120 | return validateUsageScenarioRequirement((UsageScenarioRequirement)value, diagnostics, context); |
| 121 | case QMLProfilePackage.ENTRY_LEVEL_SYSTEM_CALL_REQUIREMENT: |
| 122 | return validateEntryLevelSystemCallRequirement((EntryLevelSystemCallRequirement)value, diagnostics, context); |
| 123 | default: |
| 124 | return true; |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | /** |
| 129 | * <!-- begin-user-doc --> |
| 130 | * <!-- end-user-doc --> |
| 131 | * @generated |
| 132 | */ |
| 133 | public boolean validateSimpleQMLProfile(SimpleQMLProfile simpleQMLProfile, DiagnosticChain diagnostics, Map<Object, Object> context) { |
| 134 | boolean result = validate_EveryMultiplicityConforms(simpleQMLProfile, diagnostics, context); |
| 135 | if (result || diagnostics != null) result &= validate_EveryDataValueConforms(simpleQMLProfile, diagnostics, context); |
| 136 | if (result || diagnostics != null) result &= validate_EveryReferenceIsContained(simpleQMLProfile, diagnostics, context); |
| 137 | if (result || diagnostics != null) result &= validate_EveryProxyResolves(simpleQMLProfile, diagnostics, context); |
| 138 | if (result || diagnostics != null) result &= validate_UniqueID(simpleQMLProfile, diagnostics, context); |
| 139 | if (result || diagnostics != null) result &= validate_EveryKeyUnique(simpleQMLProfile, diagnostics, context); |
| 140 | if (result || diagnostics != null) result &= validate_EveryMapEntryUnique(simpleQMLProfile, diagnostics, context); |
| 141 | if (result || diagnostics != null) result &= identifierValidator.validateIdentifier_idHasToBeUnique(simpleQMLProfile, diagnostics, context); |
| 142 | return result; |
| 143 | } |
| 144 | |
| 145 | /** |
| 146 | * <!-- begin-user-doc --> |
| 147 | * <!-- end-user-doc --> |
| 148 | * @generated |
| 149 | */ |
| 150 | public boolean validateGenericQMLProfile(GenericQMLProfile genericQMLProfile, DiagnosticChain diagnostics, Map<Object, Object> context) { |
| 151 | boolean result = validate_EveryMultiplicityConforms(genericQMLProfile, diagnostics, context); |
| 152 | if (result || diagnostics != null) result &= validate_EveryDataValueConforms(genericQMLProfile, diagnostics, context); |
| 153 | if (result || diagnostics != null) result &= validate_EveryReferenceIsContained(genericQMLProfile, diagnostics, context); |
| 154 | if (result || diagnostics != null) result &= validate_EveryProxyResolves(genericQMLProfile, diagnostics, context); |
| 155 | if (result || diagnostics != null) result &= validate_UniqueID(genericQMLProfile, diagnostics, context); |
| 156 | if (result || diagnostics != null) result &= validate_EveryKeyUnique(genericQMLProfile, diagnostics, context); |
| 157 | if (result || diagnostics != null) result &= validate_EveryMapEntryUnique(genericQMLProfile, diagnostics, context); |
| 158 | if (result || diagnostics != null) result &= identifierValidator.validateIdentifier_idHasToBeUnique(genericQMLProfile, diagnostics, context); |
| 159 | return result; |
| 160 | } |
| 161 | |
| 162 | /** |
| 163 | * <!-- begin-user-doc --> |
| 164 | * <!-- end-user-doc --> |
| 165 | * @generated |
| 166 | */ |
| 167 | public boolean validateRequirement(Requirement requirement, DiagnosticChain diagnostics, Map<Object, Object> context) { |
| 168 | boolean result = validate_EveryMultiplicityConforms(requirement, diagnostics, context); |
| 169 | if (result || diagnostics != null) result &= validate_EveryDataValueConforms(requirement, diagnostics, context); |
| 170 | if (result || diagnostics != null) result &= validate_EveryReferenceIsContained(requirement, diagnostics, context); |
| 171 | if (result || diagnostics != null) result &= validate_EveryProxyResolves(requirement, diagnostics, context); |
| 172 | if (result || diagnostics != null) result &= validate_UniqueID(requirement, diagnostics, context); |
| 173 | if (result || diagnostics != null) result &= validate_EveryKeyUnique(requirement, diagnostics, context); |
| 174 | if (result || diagnostics != null) result &= validate_EveryMapEntryUnique(requirement, diagnostics, context); |
| 175 | if (result || diagnostics != null) result &= identifierValidator.validateIdentifier_idHasToBeUnique(requirement, diagnostics, context); |
| 176 | return result; |
| 177 | } |
| 178 | |
| 179 | /** |
| 180 | * <!-- begin-user-doc --> |
| 181 | * <!-- end-user-doc --> |
| 182 | * @generated |
| 183 | */ |
| 184 | public boolean validateRefinedQMLProfile(RefinedQMLProfile refinedQMLProfile, DiagnosticChain diagnostics, Map<Object, Object> context) { |
| 185 | boolean result = validate_EveryMultiplicityConforms(refinedQMLProfile, diagnostics, context); |
| 186 | if (result || diagnostics != null) result &= validate_EveryDataValueConforms(refinedQMLProfile, diagnostics, context); |
| 187 | if (result || diagnostics != null) result &= validate_EveryReferenceIsContained(refinedQMLProfile, diagnostics, context); |
| 188 | if (result || diagnostics != null) result &= validate_EveryProxyResolves(refinedQMLProfile, diagnostics, context); |
| 189 | if (result || diagnostics != null) result &= validate_UniqueID(refinedQMLProfile, diagnostics, context); |
| 190 | if (result || diagnostics != null) result &= validate_EveryKeyUnique(refinedQMLProfile, diagnostics, context); |
| 191 | if (result || diagnostics != null) result &= validate_EveryMapEntryUnique(refinedQMLProfile, diagnostics, context); |
| 192 | if (result || diagnostics != null) result &= identifierValidator.validateIdentifier_idHasToBeUnique(refinedQMLProfile, diagnostics, context); |
| 193 | if (result || diagnostics != null) result &= validateRefinedQMLProfile_profile_cannot_refine_itself(refinedQMLProfile, diagnostics, context); |
| 194 | return result; |
| 195 | } |
| 196 | |
| 197 | /** |
| 198 | * Validates the profile_cannot_refine_itself constraint of '<em>Refined QML Profile</em>'. |
| 199 | * <!-- begin-user-doc --> |
| 200 | * <!-- end-user-doc --> |
| 201 | * @generated |
| 202 | */ |
| 203 | public boolean validateRefinedQMLProfile_profile_cannot_refine_itself(RefinedQMLProfile refinedQMLProfile, DiagnosticChain diagnostics, Map<Object, Object> context) { |
| 204 | return refinedQMLProfile.profile_cannot_refine_itself(diagnostics, context); |
| 205 | } |
| 206 | |
| 207 | /** |
| 208 | * <!-- begin-user-doc --> |
| 209 | * <!-- end-user-doc --> |
| 210 | * @generated |
| 211 | */ |
| 212 | public boolean validateUsageScenarioRequirement(UsageScenarioRequirement usageScenarioRequirement, DiagnosticChain diagnostics, Map<Object, Object> context) { |
| 213 | boolean result = validate_EveryMultiplicityConforms(usageScenarioRequirement, diagnostics, context); |
| 214 | if (result || diagnostics != null) result &= validate_EveryDataValueConforms(usageScenarioRequirement, diagnostics, context); |
| 215 | if (result || diagnostics != null) result &= validate_EveryReferenceIsContained(usageScenarioRequirement, diagnostics, context); |
| 216 | if (result || diagnostics != null) result &= validate_EveryProxyResolves(usageScenarioRequirement, diagnostics, context); |
| 217 | if (result || diagnostics != null) result &= validate_UniqueID(usageScenarioRequirement, diagnostics, context); |
| 218 | if (result || diagnostics != null) result &= validate_EveryKeyUnique(usageScenarioRequirement, diagnostics, context); |
| 219 | if (result || diagnostics != null) result &= validate_EveryMapEntryUnique(usageScenarioRequirement, diagnostics, context); |
| 220 | if (result || diagnostics != null) result &= identifierValidator.validateIdentifier_idHasToBeUnique(usageScenarioRequirement, diagnostics, context); |
| 221 | return result; |
| 222 | } |
| 223 | |
| 224 | /** |
| 225 | * <!-- begin-user-doc --> |
| 226 | * <!-- end-user-doc --> |
| 227 | * @generated |
| 228 | */ |
| 229 | public boolean validateEntryLevelSystemCallRequirement(EntryLevelSystemCallRequirement entryLevelSystemCallRequirement, DiagnosticChain diagnostics, Map<Object, Object> context) { |
| 230 | boolean result = validate_EveryMultiplicityConforms(entryLevelSystemCallRequirement, diagnostics, context); |
| 231 | if (result || diagnostics != null) result &= validate_EveryDataValueConforms(entryLevelSystemCallRequirement, diagnostics, context); |
| 232 | if (result || diagnostics != null) result &= validate_EveryReferenceIsContained(entryLevelSystemCallRequirement, diagnostics, context); |
| 233 | if (result || diagnostics != null) result &= validate_EveryProxyResolves(entryLevelSystemCallRequirement, diagnostics, context); |
| 234 | if (result || diagnostics != null) result &= validate_UniqueID(entryLevelSystemCallRequirement, diagnostics, context); |
| 235 | if (result || diagnostics != null) result &= validate_EveryKeyUnique(entryLevelSystemCallRequirement, diagnostics, context); |
| 236 | if (result || diagnostics != null) result &= validate_EveryMapEntryUnique(entryLevelSystemCallRequirement, diagnostics, context); |
| 237 | if (result || diagnostics != null) result &= identifierValidator.validateIdentifier_idHasToBeUnique(entryLevelSystemCallRequirement, diagnostics, context); |
| 238 | return result; |
| 239 | } |
| 240 | |
| 241 | /** |
| 242 | * Returns the resource locator that will be used to fetch messages for this validator's diagnostics. |
| 243 | * <!-- begin-user-doc --> |
| 244 | * <!-- end-user-doc --> |
| 245 | * @generated |
| 246 | */ |
| 247 | @Override |
| 248 | public ResourceLocator getResourceLocator() { |
| 249 | // TODO |
| 250 | // Specialize this to return a resource locator for messages specific to this validator. |
| 251 | // Ensure that you remove @generated or mark it @generated NOT |
| 252 | return super.getResourceLocator(); |
| 253 | } |
| 254 | |
| 255 | } //QMLProfileValidator |