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