| 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_performance.util; |
| 7 | |
| 8 | import de.uka.ipd.sdq.pcm.qosannotations.qos_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.qosannotations.qos_performance.ComponentSpecifiedExecutionTime; |
| 17 | import de.uka.ipd.sdq.pcm.qosannotations.qos_performance.Qos_performancePackage; |
| 18 | import de.uka.ipd.sdq.pcm.qosannotations.qos_performance.SpecifiedExecutionTime; |
| 19 | import de.uka.ipd.sdq.pcm.qosannotations.qos_performance.SystemSpecifiedExecutionTime; |
| 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.qosannotations.qos_performance.Qos_performancePackage |
| 26 | * @generated |
| 27 | */ |
| 28 | public class Qos_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 Qos_performanceValidator INSTANCE = new Qos_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.qosannotations.qos_performance"; |
| 53 | |
| 54 | /** |
| 55 | * The {@link org.eclipse.emf.common.util.Diagnostic#getCode() code} for constraint 'System Specified Execution Time Must Reference Required Role Of ASystem' of 'System Specified Execution Time'. |
| 56 | * <!-- begin-user-doc --> |
| 57 | * <!-- end-user-doc --> |
| 58 | * @generated |
| 59 | */ |
| 60 | public static final int SYSTEM_SPECIFIED_EXECUTION_TIME__SYSTEM_SPECIFIED_EXECUTION_TIME_MUST_REFERENCE_REQUIRED_ROLE_OF_ASYSTEM = 1; |
| 61 | |
| 62 | /** |
| 63 | * A constant with a fixed name that can be used as the base value for additional hand written constants. |
| 64 | * <!-- begin-user-doc --> |
| 65 | * <!-- end-user-doc --> |
| 66 | * @generated |
| 67 | */ |
| 68 | private static final int GENERATED_DIAGNOSTIC_CODE_COUNT = 1; |
| 69 | |
| 70 | /** |
| 71 | * A constant with a fixed name that can be used as the base value for additional hand written constants in a derived class. |
| 72 | * <!-- begin-user-doc --> |
| 73 | * <!-- end-user-doc --> |
| 74 | * @generated |
| 75 | */ |
| 76 | protected static final int DIAGNOSTIC_CODE_COUNT = GENERATED_DIAGNOSTIC_CODE_COUNT; |
| 77 | |
| 78 | /** |
| 79 | * Creates an instance of the switch. |
| 80 | * <!-- begin-user-doc --> |
| 81 | * <!-- end-user-doc --> |
| 82 | * @generated |
| 83 | */ |
| 84 | public Qos_performanceValidator() { |
| 85 | super(); |
| 86 | } |
| 87 | |
| 88 | /** |
| 89 | * Returns the package of this validator switch. |
| 90 | * <!-- begin-user-doc --> |
| 91 | * <!-- end-user-doc --> |
| 92 | * @generated |
| 93 | */ |
| 94 | @Override |
| 95 | protected EPackage getEPackage() { |
| 96 | return Qos_performancePackage.eINSTANCE; |
| 97 | } |
| 98 | |
| 99 | /** |
| 100 | * Calls <code>validateXXX</code> for the corresponding classifier of the model. |
| 101 | * <!-- begin-user-doc --> |
| 102 | * <!-- end-user-doc --> |
| 103 | * @generated |
| 104 | */ |
| 105 | @Override |
| 106 | protected boolean validate(int classifierID, Object value, DiagnosticChain diagnostics, Map<Object, Object> context) { |
| 107 | switch (classifierID) { |
| 108 | case Qos_performancePackage.SYSTEM_SPECIFIED_EXECUTION_TIME: |
| 109 | return validateSystemSpecifiedExecutionTime((SystemSpecifiedExecutionTime)value, diagnostics, context); |
| 110 | case Qos_performancePackage.SPECIFIED_EXECUTION_TIME: |
| 111 | return validateSpecifiedExecutionTime((SpecifiedExecutionTime)value, diagnostics, context); |
| 112 | case Qos_performancePackage.COMPONENT_SPECIFIED_EXECUTION_TIME: |
| 113 | return validateComponentSpecifiedExecutionTime((ComponentSpecifiedExecutionTime)value, diagnostics, context); |
| 114 | default: |
| 115 | return true; |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | /** |
| 120 | * <!-- begin-user-doc --> |
| 121 | * <!-- end-user-doc --> |
| 122 | * @generated |
| 123 | */ |
| 124 | public boolean validateSystemSpecifiedExecutionTime(SystemSpecifiedExecutionTime systemSpecifiedExecutionTime, DiagnosticChain diagnostics, Map<Object, Object> context) { |
| 125 | boolean result = validate_EveryMultiplicityConforms(systemSpecifiedExecutionTime, diagnostics, context); |
| 126 | if (result || diagnostics != null) result &= validate_EveryDataValueConforms(systemSpecifiedExecutionTime, diagnostics, context); |
| 127 | if (result || diagnostics != null) result &= validate_EveryReferenceIsContained(systemSpecifiedExecutionTime, diagnostics, context); |
| 128 | if (result || diagnostics != null) result &= validate_EveryProxyResolves(systemSpecifiedExecutionTime, diagnostics, context); |
| 129 | if (result || diagnostics != null) result &= validate_UniqueID(systemSpecifiedExecutionTime, diagnostics, context); |
| 130 | if (result || diagnostics != null) result &= validate_EveryKeyUnique(systemSpecifiedExecutionTime, diagnostics, context); |
| 131 | if (result || diagnostics != null) result &= validate_EveryMapEntryUnique(systemSpecifiedExecutionTime, diagnostics, context); |
| 132 | if (result || diagnostics != null) result &= validateSystemSpecifiedExecutionTime_SystemSpecifiedExecutionTimeMustReferenceRequiredRoleOfASystem(systemSpecifiedExecutionTime, diagnostics, context); |
| 133 | return result; |
| 134 | } |
| 135 | |
| 136 | /** |
| 137 | * Validates the SystemSpecifiedExecutionTimeMustReferenceRequiredRoleOfASystem constraint of '<em>System Specified Execution Time</em>'. |
| 138 | * <!-- begin-user-doc --> |
| 139 | * <!-- end-user-doc --> |
| 140 | * @generated |
| 141 | */ |
| 142 | public boolean validateSystemSpecifiedExecutionTime_SystemSpecifiedExecutionTimeMustReferenceRequiredRoleOfASystem(SystemSpecifiedExecutionTime systemSpecifiedExecutionTime, DiagnosticChain diagnostics, Map<Object, Object> context) { |
| 143 | return systemSpecifiedExecutionTime.SystemSpecifiedExecutionTimeMustReferenceRequiredRoleOfASystem(diagnostics, context); |
| 144 | } |
| 145 | |
| 146 | /** |
| 147 | * <!-- begin-user-doc --> |
| 148 | * <!-- end-user-doc --> |
| 149 | * @generated |
| 150 | */ |
| 151 | public boolean validateSpecifiedExecutionTime(SpecifiedExecutionTime specifiedExecutionTime, DiagnosticChain diagnostics, Map<Object, Object> context) { |
| 152 | return validate_EveryDefaultConstraint(specifiedExecutionTime, diagnostics, context); |
| 153 | } |
| 154 | |
| 155 | /** |
| 156 | * <!-- begin-user-doc --> |
| 157 | * <!-- end-user-doc --> |
| 158 | * @generated |
| 159 | */ |
| 160 | public boolean validateComponentSpecifiedExecutionTime(ComponentSpecifiedExecutionTime componentSpecifiedExecutionTime, DiagnosticChain diagnostics, Map<Object, Object> context) { |
| 161 | return validate_EveryDefaultConstraint(componentSpecifiedExecutionTime, diagnostics, context); |
| 162 | } |
| 163 | |
| 164 | /** |
| 165 | * Returns the resource locator that will be used to fetch messages for this validator's diagnostics. |
| 166 | * <!-- begin-user-doc --> |
| 167 | * <!-- end-user-doc --> |
| 168 | * @generated |
| 169 | */ |
| 170 | @Override |
| 171 | public ResourceLocator getResourceLocator() { |
| 172 | // TODO |
| 173 | // Specialize this to return a resource locator for messages specific to this validator. |
| 174 | // Ensure that you remove @generated or mark it @generated NOT |
| 175 | return super.getResourceLocator(); |
| 176 | } |
| 177 | |
| 178 | } //Qos_performanceValidator |