| 1 | /** |
| 2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
| 3 | * |
| 4 | * $Id$ |
| 5 | */ |
| 6 | package de.uka.ipd.sdq.pcm.core.util; |
| 7 | |
| 8 | import de.uka.ipd.sdq.pcm.core.*; |
| 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.core.CorePackage; |
| 17 | import de.uka.ipd.sdq.pcm.core.PCMRandomVariable; |
| 18 | |
| 19 | /** |
| 20 | * <!-- begin-user-doc --> |
| 21 | * The <b>Validator</b> for the model. |
| 22 | * <!-- end-user-doc --> |
| 23 | * @see de.uka.ipd.sdq.pcm.core.CorePackage |
| 24 | * @generated |
| 25 | */ |
| 26 | public class CoreValidator extends EObjectValidator { |
| 27 | /** |
| 28 | * <!-- begin-user-doc --> |
| 29 | * <!-- end-user-doc --> |
| 30 | * @generated |
| 31 | */ |
| 32 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
| 33 | |
| 34 | /** |
| 35 | * The cached model package |
| 36 | * <!-- begin-user-doc --> |
| 37 | * <!-- end-user-doc --> |
| 38 | * @generated |
| 39 | */ |
| 40 | public static final CoreValidator INSTANCE = new CoreValidator(); |
| 41 | |
| 42 | /** |
| 43 | * 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. |
| 44 | * <!-- begin-user-doc --> |
| 45 | * <!-- end-user-doc --> |
| 46 | * @see org.eclipse.emf.common.util.Diagnostic#getSource() |
| 47 | * @see org.eclipse.emf.common.util.Diagnostic#getCode() |
| 48 | * @generated |
| 49 | */ |
| 50 | public static final String DIAGNOSTIC_SOURCE = "de.uka.ipd.sdq.pcm.core"; |
| 51 | |
| 52 | /** |
| 53 | * The {@link org.eclipse.emf.common.util.Diagnostic#getCode() code} for constraint 'Specification Must Not Be NULL' of 'PCM Random Variable'. |
| 54 | * <!-- begin-user-doc --> |
| 55 | * <!-- end-user-doc --> |
| 56 | * @generated |
| 57 | */ |
| 58 | public static final int PCM_RANDOM_VARIABLE__SPECIFICATION_MUST_NOT_BE_NULL = 1; |
| 59 | |
| 60 | /** |
| 61 | * A constant with a fixed name that can be used as the base value for additional hand written constants. |
| 62 | * <!-- begin-user-doc --> |
| 63 | * <!-- end-user-doc --> |
| 64 | * @generated |
| 65 | */ |
| 66 | private static final int GENERATED_DIAGNOSTIC_CODE_COUNT = 1; |
| 67 | |
| 68 | /** |
| 69 | * A constant with a fixed name that can be used as the base value for additional hand written constants in a derived class. |
| 70 | * <!-- begin-user-doc --> |
| 71 | * <!-- end-user-doc --> |
| 72 | * @generated |
| 73 | */ |
| 74 | protected static final int DIAGNOSTIC_CODE_COUNT = GENERATED_DIAGNOSTIC_CODE_COUNT; |
| 75 | |
| 76 | /** |
| 77 | * Creates an instance of the switch. |
| 78 | * <!-- begin-user-doc --> |
| 79 | * <!-- end-user-doc --> |
| 80 | * @generated |
| 81 | */ |
| 82 | public CoreValidator() { |
| 83 | super(); |
| 84 | } |
| 85 | |
| 86 | /** |
| 87 | * Returns the package of this validator switch. |
| 88 | * <!-- begin-user-doc --> |
| 89 | * <!-- end-user-doc --> |
| 90 | * @generated |
| 91 | */ |
| 92 | @Override |
| 93 | protected EPackage getEPackage() { |
| 94 | return CorePackage.eINSTANCE; |
| 95 | } |
| 96 | |
| 97 | /** |
| 98 | * Calls <code>validateXXX</code> for the corresponding classifier of the model. |
| 99 | * <!-- begin-user-doc --> |
| 100 | * <!-- end-user-doc --> |
| 101 | * @generated |
| 102 | */ |
| 103 | @Override |
| 104 | protected boolean validate(int classifierID, Object value, DiagnosticChain diagnostics, Map<Object, Object> context) { |
| 105 | switch (classifierID) { |
| 106 | case CorePackage.PCM_RANDOM_VARIABLE: |
| 107 | return validatePCMRandomVariable((PCMRandomVariable)value, diagnostics, context); |
| 108 | default: |
| 109 | return true; |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | /** |
| 114 | * <!-- begin-user-doc --> |
| 115 | * <!-- end-user-doc --> |
| 116 | * @generated |
| 117 | */ |
| 118 | public boolean validatePCMRandomVariable(PCMRandomVariable pcmRandomVariable, DiagnosticChain diagnostics, Map<Object, Object> context) { |
| 119 | boolean result = validate_EveryMultiplicityConforms(pcmRandomVariable, diagnostics, context); |
| 120 | if (result || diagnostics != null) result &= validate_EveryDataValueConforms(pcmRandomVariable, diagnostics, context); |
| 121 | if (result || diagnostics != null) result &= validate_EveryReferenceIsContained(pcmRandomVariable, diagnostics, context); |
| 122 | if (result || diagnostics != null) result &= validate_EveryProxyResolves(pcmRandomVariable, diagnostics, context); |
| 123 | if (result || diagnostics != null) result &= validate_UniqueID(pcmRandomVariable, diagnostics, context); |
| 124 | if (result || diagnostics != null) result &= validate_EveryKeyUnique(pcmRandomVariable, diagnostics, context); |
| 125 | if (result || diagnostics != null) result &= validate_EveryMapEntryUnique(pcmRandomVariable, diagnostics, context); |
| 126 | if (result || diagnostics != null) result &= validatePCMRandomVariable_SpecificationMustNotBeNULL(pcmRandomVariable, diagnostics, context); |
| 127 | return result; |
| 128 | } |
| 129 | |
| 130 | /** |
| 131 | * Validates the SpecificationMustNotBeNULL constraint of '<em>PCM Random Variable</em>'. |
| 132 | * <!-- begin-user-doc --> |
| 133 | * <!-- end-user-doc --> |
| 134 | * @generated |
| 135 | */ |
| 136 | public boolean validatePCMRandomVariable_SpecificationMustNotBeNULL(PCMRandomVariable pcmRandomVariable, DiagnosticChain diagnostics, Map<Object, Object> context) { |
| 137 | return pcmRandomVariable.SpecificationMustNotBeNULL(diagnostics, context); |
| 138 | } |
| 139 | |
| 140 | /** |
| 141 | * Returns the resource locator that will be used to fetch messages for this validator's diagnostics. |
| 142 | * <!-- begin-user-doc --> |
| 143 | * <!-- end-user-doc --> |
| 144 | * @generated |
| 145 | */ |
| 146 | @Override |
| 147 | public ResourceLocator getResourceLocator() { |
| 148 | // TODO |
| 149 | // Specialize this to return a resource locator for messages specific to this validator. |
| 150 | // Ensure that you remove @generated or mark it @generated NOT |
| 151 | return super.getResourceLocator(); |
| 152 | } |
| 153 | |
| 154 | } //CoreValidator |