| 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_performance.util; |
| 7 | |
| 8 | import de.uka.ipd.sdq.pcm.seff.seff_performance.*; |
| 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.seff.seff_performance.InfrastructureCall; |
| 17 | import de.uka.ipd.sdq.pcm.seff.seff_performance.ParametricResourceDemand; |
| 18 | import de.uka.ipd.sdq.pcm.seff.seff_performance.ResourceCall; |
| 19 | import de.uka.ipd.sdq.pcm.seff.seff_performance.Seff_performancePackage; |
| 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_performance.Seff_performancePackage |
| 26 | * @generated |
| 27 | */ |
| 28 | public class Seff_performanceValidator 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_performanceValidator INSTANCE = new Seff_performanceValidator(); |
| 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_performance"; |
| 53 | |
| 54 | /** |
| 55 | * The {@link org.eclipse.emf.common.util.Diagnostic#getCode() code} for constraint 'Signature Must Belong To Used Required Role' of 'Infrastructure Call'. |
| 56 | * <!-- begin-user-doc --> |
| 57 | * <!-- end-user-doc --> |
| 58 | * @generated |
| 59 | */ |
| 60 | public static final int INFRASTRUCTURE_CALL__SIGNATURE_MUST_BELONG_TO_USED_REQUIRED_ROLE = 1; |
| 61 | |
| 62 | /** |
| 63 | * The {@link org.eclipse.emf.common.util.Diagnostic#getCode() code} for constraint 'Resource Signature Belongs To Resource Required Role' of 'Resource Call'. |
| 64 | * <!-- begin-user-doc --> |
| 65 | * <!-- end-user-doc --> |
| 66 | * @generated |
| 67 | */ |
| 68 | public static final int RESOURCE_CALL__RESOURCE_SIGNATURE_BELONGS_TO_RESOURCE_REQUIRED_ROLE = 2; |
| 69 | |
| 70 | /** |
| 71 | * A constant with a fixed name that can be used as the base value for additional hand written constants. |
| 72 | * <!-- begin-user-doc --> |
| 73 | * <!-- end-user-doc --> |
| 74 | * @generated |
| 75 | */ |
| 76 | private static final int GENERATED_DIAGNOSTIC_CODE_COUNT = 2; |
| 77 | |
| 78 | /** |
| 79 | * A constant with a fixed name that can be used as the base value for additional hand written constants in a derived class. |
| 80 | * <!-- begin-user-doc --> |
| 81 | * <!-- end-user-doc --> |
| 82 | * @generated |
| 83 | */ |
| 84 | protected static final int DIAGNOSTIC_CODE_COUNT = GENERATED_DIAGNOSTIC_CODE_COUNT; |
| 85 | |
| 86 | /** |
| 87 | * Creates an instance of the switch. |
| 88 | * <!-- begin-user-doc --> |
| 89 | * <!-- end-user-doc --> |
| 90 | * @generated |
| 91 | */ |
| 92 | public Seff_performanceValidator() { |
| 93 | super(); |
| 94 | } |
| 95 | |
| 96 | /** |
| 97 | * Returns the package of this validator switch. |
| 98 | * <!-- begin-user-doc --> |
| 99 | * <!-- end-user-doc --> |
| 100 | * @generated |
| 101 | */ |
| 102 | @Override |
| 103 | protected EPackage getEPackage() { |
| 104 | return Seff_performancePackage.eINSTANCE; |
| 105 | } |
| 106 | |
| 107 | /** |
| 108 | * Calls <code>validateXXX</code> for the corresponding classifier of the model. |
| 109 | * <!-- begin-user-doc --> |
| 110 | * <!-- end-user-doc --> |
| 111 | * @generated |
| 112 | */ |
| 113 | @Override |
| 114 | protected boolean validate(int classifierID, Object value, DiagnosticChain diagnostics, Map<Object, Object> context) { |
| 115 | switch (classifierID) { |
| 116 | case Seff_performancePackage.INFRASTRUCTURE_CALL: |
| 117 | return validateInfrastructureCall((InfrastructureCall)value, diagnostics, context); |
| 118 | case Seff_performancePackage.RESOURCE_CALL: |
| 119 | return validateResourceCall((ResourceCall)value, diagnostics, context); |
| 120 | case Seff_performancePackage.PARAMETRIC_RESOURCE_DEMAND: |
| 121 | return validateParametricResourceDemand((ParametricResourceDemand)value, diagnostics, context); |
| 122 | default: |
| 123 | return true; |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | /** |
| 128 | * <!-- begin-user-doc --> |
| 129 | * <!-- end-user-doc --> |
| 130 | * @generated |
| 131 | */ |
| 132 | public boolean validateInfrastructureCall(InfrastructureCall infrastructureCall, DiagnosticChain diagnostics, Map<Object, Object> context) { |
| 133 | boolean result = validate_EveryMultiplicityConforms(infrastructureCall, diagnostics, context); |
| 134 | if (result || diagnostics != null) result &= validate_EveryDataValueConforms(infrastructureCall, diagnostics, context); |
| 135 | if (result || diagnostics != null) result &= validate_EveryReferenceIsContained(infrastructureCall, diagnostics, context); |
| 136 | if (result || diagnostics != null) result &= validate_EveryProxyResolves(infrastructureCall, diagnostics, context); |
| 137 | if (result || diagnostics != null) result &= validate_UniqueID(infrastructureCall, diagnostics, context); |
| 138 | if (result || diagnostics != null) result &= validate_EveryKeyUnique(infrastructureCall, diagnostics, context); |
| 139 | if (result || diagnostics != null) result &= validate_EveryMapEntryUnique(infrastructureCall, diagnostics, context); |
| 140 | if (result || diagnostics != null) result &= validateInfrastructureCall_SignatureMustBelongToUsedRequiredRole(infrastructureCall, diagnostics, context); |
| 141 | return result; |
| 142 | } |
| 143 | |
| 144 | /** |
| 145 | * Validates the SignatureMustBelongToUsedRequiredRole constraint of '<em>Infrastructure Call</em>'. |
| 146 | * <!-- begin-user-doc --> |
| 147 | * <!-- end-user-doc --> |
| 148 | * @generated |
| 149 | */ |
| 150 | public boolean validateInfrastructureCall_SignatureMustBelongToUsedRequiredRole(InfrastructureCall infrastructureCall, DiagnosticChain diagnostics, Map<Object, Object> context) { |
| 151 | return infrastructureCall.SignatureMustBelongToUsedRequiredRole(diagnostics, context); |
| 152 | } |
| 153 | |
| 154 | /** |
| 155 | * <!-- begin-user-doc --> |
| 156 | * <!-- end-user-doc --> |
| 157 | * @generated |
| 158 | */ |
| 159 | public boolean validateResourceCall(ResourceCall resourceCall, DiagnosticChain diagnostics, Map<Object, Object> context) { |
| 160 | boolean result = validate_EveryMultiplicityConforms(resourceCall, diagnostics, context); |
| 161 | if (result || diagnostics != null) result &= validate_EveryDataValueConforms(resourceCall, diagnostics, context); |
| 162 | if (result || diagnostics != null) result &= validate_EveryReferenceIsContained(resourceCall, diagnostics, context); |
| 163 | if (result || diagnostics != null) result &= validate_EveryProxyResolves(resourceCall, diagnostics, context); |
| 164 | if (result || diagnostics != null) result &= validate_UniqueID(resourceCall, diagnostics, context); |
| 165 | if (result || diagnostics != null) result &= validate_EveryKeyUnique(resourceCall, diagnostics, context); |
| 166 | if (result || diagnostics != null) result &= validate_EveryMapEntryUnique(resourceCall, diagnostics, context); |
| 167 | if (result || diagnostics != null) result &= validateResourceCall_ResourceSignatureBelongsToResourceRequiredRole(resourceCall, diagnostics, context); |
| 168 | return result; |
| 169 | } |
| 170 | |
| 171 | /** |
| 172 | * Validates the ResourceSignatureBelongsToResourceRequiredRole constraint of '<em>Resource Call</em>'. |
| 173 | * <!-- begin-user-doc --> |
| 174 | * <!-- end-user-doc --> |
| 175 | * @generated |
| 176 | */ |
| 177 | public boolean validateResourceCall_ResourceSignatureBelongsToResourceRequiredRole(ResourceCall resourceCall, DiagnosticChain diagnostics, Map<Object, Object> context) { |
| 178 | return resourceCall.ResourceSignatureBelongsToResourceRequiredRole(diagnostics, context); |
| 179 | } |
| 180 | |
| 181 | /** |
| 182 | * <!-- begin-user-doc --> |
| 183 | * <!-- end-user-doc --> |
| 184 | * @generated |
| 185 | */ |
| 186 | public boolean validateParametricResourceDemand(ParametricResourceDemand parametricResourceDemand, DiagnosticChain diagnostics, Map<Object, Object> context) { |
| 187 | return validate_EveryDefaultConstraint(parametricResourceDemand, diagnostics, context); |
| 188 | } |
| 189 | |
| 190 | /** |
| 191 | * Returns the resource locator that will be used to fetch messages for this validator's diagnostics. |
| 192 | * <!-- begin-user-doc --> |
| 193 | * <!-- end-user-doc --> |
| 194 | * @generated |
| 195 | */ |
| 196 | @Override |
| 197 | public ResourceLocator getResourceLocator() { |
| 198 | // TODO |
| 199 | // Specialize this to return a resource locator for messages specific to this validator. |
| 200 | // Ensure that you remove @generated or mark it @generated NOT |
| 201 | return super.getResourceLocator(); |
| 202 | } |
| 203 | |
| 204 | } //Seff_performanceValidator |