diff options
Diffstat (limited to 'examples/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/emf/schemaconstructs/substitutionzvon/util/SubstitutionzvonValidator.java')
-rw-r--r-- | examples/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/emf/schemaconstructs/substitutionzvon/util/SubstitutionzvonValidator.java | 299 |
1 files changed, 299 insertions, 0 deletions
diff --git a/examples/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/emf/schemaconstructs/substitutionzvon/util/SubstitutionzvonValidator.java b/examples/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/emf/schemaconstructs/substitutionzvon/util/SubstitutionzvonValidator.java new file mode 100644 index 000000000..d77057604 --- /dev/null +++ b/examples/org.eclipse.emf.teneo.samples/src/org/eclipse/emf/teneo/samples/emf/schemaconstructs/substitutionzvon/util/SubstitutionzvonValidator.java @@ -0,0 +1,299 @@ +/** + * <copyright> + * </copyright> + * + * $Id: SubstitutionzvonValidator.java,v 1.1 2006/07/11 16:57:01 mtaal Exp $ + */ +package org.eclipse.emf.teneo.samples.emf.schemaconstructs.substitutionzvon.util; + +import java.math.BigInteger; + +import java.util.Collection; +import java.util.Map; + +import org.eclipse.emf.common.util.DiagnosticChain; + +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.util.EObjectValidator; + +import org.eclipse.emf.ecore.xml.type.util.XMLTypeValidator; + +import org.eclipse.emf.teneo.samples.emf.schemaconstructs.substitutionzvon.*; + +/** + * <!-- begin-user-doc --> + * The <b>Validator</b> for the model. + * <!-- end-user-doc --> + * @see org.eclipse.emf.teneo.samples.emf.schemaconstructs.substitutionzvon.SubstitutionzvonPackage + * @generated + */ +public class SubstitutionzvonValidator extends EObjectValidator { + /** + * The cached model package + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public static final SubstitutionzvonValidator INSTANCE = new SubstitutionzvonValidator(); + + /** + * 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. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.emf.common.util.Diagnostic#getSource() + * @see org.eclipse.emf.common.util.Diagnostic#getCode() + * @generated + */ + public static final String DIAGNOSTIC_SOURCE = "org.eclipse.emf.teneo.samples.emf.schemaconstructs.substitutionzvon"; + + /** + * A constant with a fixed name that can be used as the base value for additional hand written constants. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private static final int GENERATED_DIAGNOSTIC_CODE_COUNT = 0; + + /** + * A constant with a fixed name that can be used as the base value for additional hand written constants in a derived class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected static final int DIAGNOSTIC_CODE_COUNT = GENERATED_DIAGNOSTIC_CODE_COUNT; + + /** + * The cached base package validator. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected XMLTypeValidator xmlTypeValidator; + + /** + * Creates an instance of the switch. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public SubstitutionzvonValidator() { + super(); + xmlTypeValidator = XMLTypeValidator.INSTANCE; + } + + /** + * Returns the package of this validator switch. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected EPackage getEPackage() { + return SubstitutionzvonPackage.eINSTANCE; + } + + /** + * Calls <code>validateXXX</code> for the corresonding classifier of the model. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected boolean validate(int classifierID, Object value, DiagnosticChain diagnostics, Map context) { + switch (classifierID) { + case SubstitutionzvonPackage.COMPLEX_AAA: + return validateComplexAAA((ComplexAAA)value, diagnostics, context); + case SubstitutionzvonPackage.COMPLEX_EVEN_TYPE: + return validateComplexEvenType((ComplexEvenType)value, diagnostics, context); + case SubstitutionzvonPackage.COMPLEX_ODD_TYPE: + return validateComplexOddType((ComplexOddType)value, diagnostics, context); + case SubstitutionzvonPackage.DOCUMENT_ROOT: + return validateDocumentRoot((DocumentRoot)value, diagnostics, context); + case SubstitutionzvonPackage.ROOT_TYPE: + return validateRootType((RootType)value, diagnostics, context); + case SubstitutionzvonPackage.AAA: + return validateAAA((BigInteger)value, diagnostics, context); + case SubstitutionzvonPackage.EVEN_TYPE: + return validateEvenType((BigInteger)value, diagnostics, context); + case SubstitutionzvonPackage.ODD_TYPE: + return validateOddType((BigInteger)value, diagnostics, context); + default: + return true; + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public boolean validateComplexAAA(ComplexAAA complexAAA, DiagnosticChain diagnostics, Map context) { + return validate_EveryDefaultConstraint(complexAAA, diagnostics, context); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public boolean validateComplexEvenType(ComplexEvenType complexEvenType, DiagnosticChain diagnostics, Map context) { + return validate_EveryDefaultConstraint(complexEvenType, diagnostics, context); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public boolean validateComplexOddType(ComplexOddType complexOddType, DiagnosticChain diagnostics, Map context) { + return validate_EveryDefaultConstraint(complexOddType, diagnostics, context); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public boolean validateDocumentRoot(DocumentRoot documentRoot, DiagnosticChain diagnostics, Map context) { + return validate_EveryDefaultConstraint(documentRoot, diagnostics, context); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public boolean validateRootType(RootType rootType, DiagnosticChain diagnostics, Map context) { + return validate_EveryDefaultConstraint(rootType, diagnostics, context); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public boolean validateAAA(BigInteger aaa, DiagnosticChain diagnostics, Map context) { + boolean result = validateAAA_Min(aaa, diagnostics, context); + if (result || diagnostics != null) result &= validateAAA_Max(aaa, diagnostics, context); + return result; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @see #validateAAA_Min + */ + public static final BigInteger AAA__MIN__VALUE = new BigInteger("1"); + + /** + * Validates the Min constraint of '<em>AAA</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public boolean validateAAA_Min(BigInteger aaa, DiagnosticChain diagnostics, Map context) { + boolean result = aaa.compareTo(AAA__MIN__VALUE) >= 0; + if (!result && diagnostics != null) + reportMinViolation(SubstitutionzvonPackage.eINSTANCE.getAAA(), aaa, AAA__MIN__VALUE, true, diagnostics, context); + return result; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @see #validateAAA_Max + */ + public static final BigInteger AAA__MAX__VALUE = new BigInteger("9"); + + /** + * Validates the Max constraint of '<em>AAA</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public boolean validateAAA_Max(BigInteger aaa, DiagnosticChain diagnostics, Map context) { + boolean result = aaa.compareTo(AAA__MAX__VALUE) <= 0; + if (!result && diagnostics != null) + reportMaxViolation(SubstitutionzvonPackage.eINSTANCE.getAAA(), aaa, AAA__MAX__VALUE, true, diagnostics, context); + return result; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public boolean validateEvenType(BigInteger evenType, DiagnosticChain diagnostics, Map context) { + boolean result = validateEvenType_Enumeration(evenType, diagnostics, context); + return result; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @see #validateEvenType_Enumeration + */ + public static final Collection EVEN_TYPE__ENUMERATION__VALUES = + wrapEnumerationValues + (new Object[] { + new BigInteger("2"), + new BigInteger("4"), + new BigInteger("6"), + new BigInteger("8") + }); + + /** + * Validates the Enumeration constraint of '<em>Even Type</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public boolean validateEvenType_Enumeration(BigInteger evenType, DiagnosticChain diagnostics, Map context) { + boolean result = EVEN_TYPE__ENUMERATION__VALUES.contains(evenType); + if (!result && diagnostics != null) + reportEnumerationViolation(SubstitutionzvonPackage.eINSTANCE.getEvenType(), evenType, EVEN_TYPE__ENUMERATION__VALUES, diagnostics, context); + return result; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public boolean validateOddType(BigInteger oddType, DiagnosticChain diagnostics, Map context) { + boolean result = validateOddType_Enumeration(oddType, diagnostics, context); + return result; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @see #validateOddType_Enumeration + */ + public static final Collection ODD_TYPE__ENUMERATION__VALUES = + wrapEnumerationValues + (new Object[] { + new BigInteger("1"), + new BigInteger("3"), + new BigInteger("5"), + new BigInteger("7"), + new BigInteger("9") + }); + + /** + * Validates the Enumeration constraint of '<em>Odd Type</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public boolean validateOddType_Enumeration(BigInteger oddType, DiagnosticChain diagnostics, Map context) { + boolean result = ODD_TYPE__ENUMERATION__VALUES.contains(oddType); + if (!result && diagnostics != null) + reportEnumerationViolation(SubstitutionzvonPackage.eINSTANCE.getOddType(), oddType, ODD_TYPE__ENUMERATION__VALUES, diagnostics, context); + return result; + } + +} //SubstitutionzvonValidator |