/* * Copyright 2015 Red Hat, Inc. and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** */ package org.omg.spec.bpmn.non.normative.color.util; 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.XMLTypeUtil; import org.eclipse.emf.ecore.xml.type.util.XMLTypeValidator; import org.omg.spec.bpmn.non.normative.color.*; /** * <!-- begin-user-doc --> * The <b>Validator</b> for the model. * <!-- end-user-doc --> * @see org.omg.spec.bpmn.non.normative.color.ColorPackage * @generated */ public class ColorValidator extends EObjectValidator { /** * The cached model package * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final ColorValidator INSTANCE = new ColorValidator(); /** * 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.omg.spec.bpmn.non.normative.color"; /** * 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 ColorValidator() { super(); xmlTypeValidator = XMLTypeValidator.INSTANCE; } /** * Returns the package of this validator switch. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EPackage getEPackage() { return ColorPackage.eINSTANCE; } /** * Calls <code>validateXXX</code> for the corresponding classifier of the model. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected boolean validate(int classifierID, Object value, DiagnosticChain diagnostics, Map<Object, Object> context) { switch (classifierID) { case ColorPackage.DOCUMENT_ROOT: return validateDocumentRoot((DocumentRoot)value, diagnostics, context); case ColorPackage.HEX_COLOR: return validateHexColor((String)value, diagnostics, context); default: return true; } } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean validateDocumentRoot(DocumentRoot documentRoot, DiagnosticChain diagnostics, Map<Object, Object> context) { return validate_EveryDefaultConstraint(documentRoot, diagnostics, context); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean validateHexColor(String hexColor, DiagnosticChain diagnostics, Map<Object, Object> context) { boolean result = validateHexColor_Pattern(hexColor, diagnostics, context); return result; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @see #validateHexColor_Pattern */ public static final PatternMatcher [][] HEX_COLOR__PATTERN__VALUES = new PatternMatcher [][] { new PatternMatcher [] { XMLTypeUtil.createPatternMatcher("#[0-9a-fA-F]{6}") } }; /** * Validates the Pattern constraint of '<em>Hex Color</em>'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean validateHexColor_Pattern(String hexColor, DiagnosticChain diagnostics, Map<Object, Object> context) { return validatePattern(ColorPackage.Literals.HEX_COLOR, hexColor, HEX_COLOR__PATTERN__VALUES, diagnostics, context); } } //ColorValidator