| 1 | /** |
| 2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
| 3 | * |
| 4 | * $Id$ |
| 5 | */ |
| 6 | package de.uka.ipd.sdq.pcm.seff.seff_reliability.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.seff.seff_reliability.*; |
| 17 | import de.uka.ipd.sdq.pcm.seff.seff_reliability.FailureHandlingEntity; |
| 18 | import de.uka.ipd.sdq.pcm.seff.seff_reliability.Seff_reliabilityPackage; |
| 19 | import de.uka.ipd.sdq.pcm.seff.util.SeffValidator; |
| 20 | |
| 21 | /** |
| 22 | * <!-- begin-user-doc --> |
| 23 | * The <b>Validator</b> for the model. |
| 24 | * <!-- end-user-doc --> |
| 25 | * @see de.uka.ipd.sdq.pcm.seff.seff_reliability.Seff_reliabilityPackage |
| 26 | * @generated |
| 27 | */ |
| 28 | public class Seff_reliabilityValidator extends EObjectValidator { |
| 29 | /** |
| 30 | * <!-- begin-user-doc --> |
| 31 | * <!-- end-user-doc --> |
| 32 | * @generated |
| 33 | */ |
| 34 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
| 35 | |
| 36 | /** |
| 37 | * The cached model package |
| 38 | * <!-- begin-user-doc --> |
| 39 | * <!-- end-user-doc --> |
| 40 | * @generated |
| 41 | */ |
| 42 | public static final Seff_reliabilityValidator INSTANCE = new Seff_reliabilityValidator(); |
| 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.pcm.seff.seff_reliability"; |
| 53 | |
| 54 | /** |
| 55 | * The {@link org.eclipse.emf.common.util.Diagnostic#getCode() code} for constraint 'Recovery Action Behaviour Has Only One Predecessor' of 'Recovery Action Behaviour'. |
| 56 | * <!-- begin-user-doc --> |
| 57 | * <!-- end-user-doc --> |
| 58 | * @generated |
| 59 | */ |
| 60 | public static final int RECOVERY_ACTION_BEHAVIOUR__RECOVERY_ACTION_BEHAVIOUR_HAS_ONLY_ONE_PREDECESSOR = 1; |
| 61 | |
| 62 | /** |
| 63 | * The {@link org.eclipse.emf.common.util.Diagnostic#getCode() code} for constraint 'Recovery Action Behaviour Is Not Successor Of Itself' of 'Recovery Action Behaviour'. |
| 64 | * <!-- begin-user-doc --> |
| 65 | * <!-- end-user-doc --> |
| 66 | * @generated |
| 67 | */ |
| 68 | public static final int RECOVERY_ACTION_BEHAVIOUR__RECOVERY_ACTION_BEHAVIOUR_IS_NOT_SUCCESSOR_OF_ITSELF = 2; |
| 69 | |
| 70 | /** |
| 71 | * The {@link org.eclipse.emf.common.util.Diagnostic#getCode() code} for constraint 'Successors Of Recovery Action Behaviour Handle Disjoint Failure Types' of 'Recovery Action Behaviour'. |
| 72 | * <!-- begin-user-doc --> |
| 73 | * <!-- end-user-doc --> |
| 74 | * @generated |
| 75 | */ |
| 76 | public static final int RECOVERY_ACTION_BEHAVIOUR__SUCCESSORS_OF_RECOVERY_ACTION_BEHAVIOUR_HANDLE_DISJOINT_FAILURE_TYPES = 3; |
| 77 | |
| 78 | /** |
| 79 | * The {@link org.eclipse.emf.common.util.Diagnostic#getCode() code} for constraint 'Primary Behaviour Of Recovery Action Must Be Set' of 'Recovery Action'. |
| 80 | * <!-- begin-user-doc --> |
| 81 | * <!-- end-user-doc --> |
| 82 | * @generated |
| 83 | */ |
| 84 | public static final int RECOVERY_ACTION__PRIMARY_BEHAVIOUR_OF_RECOVERY_ACTION_MUST_BE_SET = 4; |
| 85 | |
| 86 | /** |
| 87 | * A constant with a fixed name that can be used as the base value for additional hand written constants. |
| 88 | * <!-- begin-user-doc --> |
| 89 | * <!-- end-user-doc --> |
| 90 | * @generated |
| 91 | */ |
| 92 | private static final int GENERATED_DIAGNOSTIC_CODE_COUNT = 4; |
| 93 | |
| 94 | /** |
| 95 | * A constant with a fixed name that can be used as the base value for additional hand written constants in a derived class. |
| 96 | * <!-- begin-user-doc --> |
| 97 | * <!-- end-user-doc --> |
| 98 | * @generated |
| 99 | */ |
| 100 | protected static final int DIAGNOSTIC_CODE_COUNT = GENERATED_DIAGNOSTIC_CODE_COUNT; |
| 101 | |
| 102 | /** |
| 103 | * The cached base package validator. |
| 104 | * <!-- begin-user-doc --> |
| 105 | * <!-- end-user-doc --> |
| 106 | * @generated |
| 107 | */ |
| 108 | protected IdentifierValidator identifierValidator; |
| 109 | |
| 110 | /** |
| 111 | * The cached base package validator. |
| 112 | * <!-- begin-user-doc --> |
| 113 | * <!-- end-user-doc --> |
| 114 | * @generated |
| 115 | */ |
| 116 | protected SeffValidator seffValidator; |
| 117 | |
| 118 | /** |
| 119 | * Creates an instance of the switch. |
| 120 | * <!-- begin-user-doc --> |
| 121 | * <!-- end-user-doc --> |
| 122 | * @generated |
| 123 | */ |
| 124 | public Seff_reliabilityValidator() { |
| 125 | super(); |
| 126 | identifierValidator = IdentifierValidator.INSTANCE; |
| 127 | seffValidator = SeffValidator.INSTANCE; |
| 128 | } |
| 129 | |
| 130 | /** |
| 131 | * Returns the package of this validator switch. |
| 132 | * <!-- begin-user-doc --> |
| 133 | * <!-- end-user-doc --> |
| 134 | * @generated |
| 135 | */ |
| 136 | @Override |
| 137 | protected EPackage getEPackage() { |
| 138 | return Seff_reliabilityPackage.eINSTANCE; |
| 139 | } |
| 140 | |
| 141 | /** |
| 142 | * Calls <code>validateXXX</code> for the corresponding classifier of the model. |
| 143 | * <!-- begin-user-doc --> |
| 144 | * <!-- end-user-doc --> |
| 145 | * @generated |
| 146 | */ |
| 147 | @Override |
| 148 | protected boolean validate(int classifierID, Object value, DiagnosticChain diagnostics, Map<Object, Object> context) { |
| 149 | switch (classifierID) { |
| 150 | case Seff_reliabilityPackage.RECOVERY_ACTION_BEHAVIOUR: |
| 151 | return validateRecoveryActionBehaviour((RecoveryActionBehaviour)value, diagnostics, context); |
| 152 | case Seff_reliabilityPackage.RECOVERY_ACTION: |
| 153 | return validateRecoveryAction((RecoveryAction)value, diagnostics, context); |
| 154 | case Seff_reliabilityPackage.FAILURE_HANDLING_ENTITY: |
| 155 | return validateFailureHandlingEntity((FailureHandlingEntity)value, diagnostics, context); |
| 156 | default: |
| 157 | return true; |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | /** |
| 162 | * <!-- begin-user-doc --> |
| 163 | * <!-- end-user-doc --> |
| 164 | * @generated |
| 165 | */ |
| 166 | public boolean validateRecoveryActionBehaviour(RecoveryActionBehaviour recoveryActionBehaviour, DiagnosticChain diagnostics, Map<Object, Object> context) { |
| 167 | boolean result = validate_EveryMultiplicityConforms(recoveryActionBehaviour, diagnostics, context); |
| 168 | if (result || diagnostics != null) result &= validate_EveryDataValueConforms(recoveryActionBehaviour, diagnostics, context); |
| 169 | if (result || diagnostics != null) result &= validate_EveryReferenceIsContained(recoveryActionBehaviour, diagnostics, context); |
| 170 | if (result || diagnostics != null) result &= validate_EveryProxyResolves(recoveryActionBehaviour, diagnostics, context); |
| 171 | if (result || diagnostics != null) result &= validate_UniqueID(recoveryActionBehaviour, diagnostics, context); |
| 172 | if (result || diagnostics != null) result &= validate_EveryKeyUnique(recoveryActionBehaviour, diagnostics, context); |
| 173 | if (result || diagnostics != null) result &= validate_EveryMapEntryUnique(recoveryActionBehaviour, diagnostics, context); |
| 174 | if (result || diagnostics != null) result &= identifierValidator.validateIdentifier_idHasToBeUnique(recoveryActionBehaviour, diagnostics, context); |
| 175 | if (result || diagnostics != null) result &= seffValidator.validateResourceDemandingBehaviour_ExactlyOneStopAction(recoveryActionBehaviour, diagnostics, context); |
| 176 | if (result || diagnostics != null) result &= seffValidator.validateResourceDemandingBehaviour_ExactlyOneStartAction(recoveryActionBehaviour, diagnostics, context); |
| 177 | if (result || diagnostics != null) result &= seffValidator.validateResourceDemandingBehaviour_EachActionExceptStartActionandStopActionMustHhaveAPredecessorAndSuccessor(recoveryActionBehaviour, diagnostics, context); |
| 178 | if (result || diagnostics != null) result &= validateRecoveryActionBehaviour_RecoveryActionBehaviourHasOnlyOnePredecessor(recoveryActionBehaviour, diagnostics, context); |
| 179 | if (result || diagnostics != null) result &= validateRecoveryActionBehaviour_RecoveryActionBehaviourIsNotSuccessorOfItself(recoveryActionBehaviour, diagnostics, context); |
| 180 | if (result || diagnostics != null) result &= validateRecoveryActionBehaviour_SuccessorsOfRecoveryActionBehaviourHandleDisjointFailureTypes(recoveryActionBehaviour, diagnostics, context); |
| 181 | return result; |
| 182 | } |
| 183 | |
| 184 | /** |
| 185 | * Validates the RecoveryActionBehaviourHasOnlyOnePredecessor constraint of '<em>Recovery Action Behaviour</em>'. |
| 186 | * <!-- begin-user-doc --> |
| 187 | * <!-- end-user-doc --> |
| 188 | * @generated |
| 189 | */ |
| 190 | public boolean validateRecoveryActionBehaviour_RecoveryActionBehaviourHasOnlyOnePredecessor(RecoveryActionBehaviour recoveryActionBehaviour, DiagnosticChain diagnostics, Map<Object, Object> context) { |
| 191 | return recoveryActionBehaviour.RecoveryActionBehaviourHasOnlyOnePredecessor(diagnostics, context); |
| 192 | } |
| 193 | |
| 194 | /** |
| 195 | * Validates the RecoveryActionBehaviourIsNotSuccessorOfItself constraint of '<em>Recovery Action Behaviour</em>'. |
| 196 | * <!-- begin-user-doc --> |
| 197 | * <!-- end-user-doc --> |
| 198 | * @generated |
| 199 | */ |
| 200 | public boolean validateRecoveryActionBehaviour_RecoveryActionBehaviourIsNotSuccessorOfItself(RecoveryActionBehaviour recoveryActionBehaviour, DiagnosticChain diagnostics, Map<Object, Object> context) { |
| 201 | return recoveryActionBehaviour.RecoveryActionBehaviourIsNotSuccessorOfItself(diagnostics, context); |
| 202 | } |
| 203 | |
| 204 | /** |
| 205 | * Validates the SuccessorsOfRecoveryActionBehaviourHandleDisjointFailureTypes constraint of '<em>Recovery Action Behaviour</em>'. |
| 206 | * <!-- begin-user-doc --> |
| 207 | * <!-- end-user-doc --> |
| 208 | * @generated |
| 209 | */ |
| 210 | public boolean validateRecoveryActionBehaviour_SuccessorsOfRecoveryActionBehaviourHandleDisjointFailureTypes(RecoveryActionBehaviour recoveryActionBehaviour, DiagnosticChain diagnostics, Map<Object, Object> context) { |
| 211 | return recoveryActionBehaviour.SuccessorsOfRecoveryActionBehaviourHandleDisjointFailureTypes(diagnostics, context); |
| 212 | } |
| 213 | |
| 214 | /** |
| 215 | * <!-- begin-user-doc --> |
| 216 | * <!-- end-user-doc --> |
| 217 | * @generated |
| 218 | */ |
| 219 | public boolean validateRecoveryAction(RecoveryAction recoveryAction, DiagnosticChain diagnostics, Map<Object, Object> context) { |
| 220 | boolean result = validate_EveryMultiplicityConforms(recoveryAction, diagnostics, context); |
| 221 | if (result || diagnostics != null) result &= validate_EveryDataValueConforms(recoveryAction, diagnostics, context); |
| 222 | if (result || diagnostics != null) result &= validate_EveryReferenceIsContained(recoveryAction, diagnostics, context); |
| 223 | if (result || diagnostics != null) result &= validate_EveryProxyResolves(recoveryAction, diagnostics, context); |
| 224 | if (result || diagnostics != null) result &= validate_UniqueID(recoveryAction, diagnostics, context); |
| 225 | if (result || diagnostics != null) result &= validate_EveryKeyUnique(recoveryAction, diagnostics, context); |
| 226 | if (result || diagnostics != null) result &= validate_EveryMapEntryUnique(recoveryAction, diagnostics, context); |
| 227 | if (result || diagnostics != null) result &= identifierValidator.validateIdentifier_idHasToBeUnique(recoveryAction, diagnostics, context); |
| 228 | if (result || diagnostics != null) result &= validateRecoveryAction_PrimaryBehaviourOfRecoveryActionMustBeSet(recoveryAction, diagnostics, context); |
| 229 | return result; |
| 230 | } |
| 231 | |
| 232 | /** |
| 233 | * Validates the PrimaryBehaviourOfRecoveryActionMustBeSet constraint of '<em>Recovery Action</em>'. |
| 234 | * <!-- begin-user-doc --> |
| 235 | * <!-- end-user-doc --> |
| 236 | * @generated |
| 237 | */ |
| 238 | public boolean validateRecoveryAction_PrimaryBehaviourOfRecoveryActionMustBeSet(RecoveryAction recoveryAction, DiagnosticChain diagnostics, Map<Object, Object> context) { |
| 239 | return recoveryAction.PrimaryBehaviourOfRecoveryActionMustBeSet(diagnostics, context); |
| 240 | } |
| 241 | |
| 242 | /** |
| 243 | * <!-- begin-user-doc --> |
| 244 | * <!-- end-user-doc --> |
| 245 | * @generated |
| 246 | */ |
| 247 | public boolean validateFailureHandlingEntity(FailureHandlingEntity failureHandlingEntity, DiagnosticChain diagnostics, Map<Object, Object> context) { |
| 248 | boolean result = validate_EveryMultiplicityConforms(failureHandlingEntity, diagnostics, context); |
| 249 | if (result || diagnostics != null) result &= validate_EveryDataValueConforms(failureHandlingEntity, diagnostics, context); |
| 250 | if (result || diagnostics != null) result &= validate_EveryReferenceIsContained(failureHandlingEntity, diagnostics, context); |
| 251 | if (result || diagnostics != null) result &= validate_EveryProxyResolves(failureHandlingEntity, diagnostics, context); |
| 252 | if (result || diagnostics != null) result &= validate_UniqueID(failureHandlingEntity, diagnostics, context); |
| 253 | if (result || diagnostics != null) result &= validate_EveryKeyUnique(failureHandlingEntity, diagnostics, context); |
| 254 | if (result || diagnostics != null) result &= validate_EveryMapEntryUnique(failureHandlingEntity, diagnostics, context); |
| 255 | if (result || diagnostics != null) result &= identifierValidator.validateIdentifier_idHasToBeUnique(failureHandlingEntity, diagnostics, context); |
| 256 | return result; |
| 257 | } |
| 258 | |
| 259 | /** |
| 260 | * Returns the resource locator that will be used to fetch messages for this validator's diagnostics. |
| 261 | * <!-- begin-user-doc --> |
| 262 | * <!-- end-user-doc --> |
| 263 | * @generated |
| 264 | */ |
| 265 | @Override |
| 266 | public ResourceLocator getResourceLocator() { |
| 267 | // TODO |
| 268 | // Specialize this to return a resource locator for messages specific to this validator. |
| 269 | // Ensure that you remove @generated or mark it @generated NOT |
| 270 | return super.getResourceLocator(); |
| 271 | } |
| 272 | |
| 273 | } //Seff_reliabilityValidator |