| /** |
| * Copyright (c) 2008-2011 Chair for Applied Software Engineering, |
| * Technische Universitaet Muenchen. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| */ |
| package org.eclipse.emf.emfstore.bowling.util; |
| |
| import java.util.Map; |
| |
| import javax.xml.datatype.XMLGregorianCalendar; |
| |
| import org.eclipse.emf.common.util.DiagnosticChain; |
| import org.eclipse.emf.common.util.ResourceLocator; |
| import org.eclipse.emf.ecore.EObject; |
| 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.emfstore.bowling.Area; |
| import org.eclipse.emf.emfstore.bowling.BowlingPackage; |
| import org.eclipse.emf.emfstore.bowling.Fan; |
| import org.eclipse.emf.emfstore.bowling.Game; |
| import org.eclipse.emf.emfstore.bowling.Gender; |
| import org.eclipse.emf.emfstore.bowling.League; |
| import org.eclipse.emf.emfstore.bowling.Matchup; |
| import org.eclipse.emf.emfstore.bowling.Merchandise; |
| import org.eclipse.emf.emfstore.bowling.Player; |
| import org.eclipse.emf.emfstore.bowling.Referee; |
| import org.eclipse.emf.emfstore.bowling.Tournament; |
| import org.eclipse.emf.emfstore.bowling.TournamentType; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * The <b>Validator</b> for the model. |
| * <!-- end-user-doc --> |
| * |
| * @see org.eclipse.emf.emfstore.bowling.BowlingPackage |
| * @generated |
| */ |
| public class BowlingValidator extends EObjectValidator { |
| /** |
| * The cached model package |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public static final BowlingValidator INSTANCE = new BowlingValidator(); |
| |
| /** |
| * 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.emfstore.bowling"; //$NON-NLS-1$ |
| |
| /** |
| * The {@link org.eclipse.emf.common.util.Diagnostic#getCode() code} for constraint 'Validate' of 'Player'. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public static final int PLAYER__VALIDATE = 1; |
| |
| /** |
| * 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 = 1; |
| |
| /** |
| * 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 BowlingValidator() { |
| super(); |
| xmlTypeValidator = XMLTypeValidator.INSTANCE; |
| } |
| |
| /** |
| * Returns the package of this validator switch. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| protected EPackage getEPackage() { |
| return BowlingPackage.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 BowlingPackage.PLAYER: |
| return validatePlayer((Player) value, diagnostics, context); |
| case BowlingPackage.LEAGUE: |
| return validateLeague((League) value, diagnostics, context); |
| case BowlingPackage.TOURNAMENT: |
| return validateTournament((Tournament) value, diagnostics, context); |
| case BowlingPackage.MATCHUP: |
| return validateMatchup((Matchup) value, diagnostics, context); |
| case BowlingPackage.GAME: |
| return validateGame((Game) value, diagnostics, context); |
| case BowlingPackage.PLAYER_TO_POINTS_MAP: |
| return validatePlayerToPointsMap((Map.Entry<?, ?>) value, diagnostics, context); |
| case BowlingPackage.REFEREE: |
| return validateReferee((Referee) value, diagnostics, context); |
| case BowlingPackage.REFEREE_TO_GAMES_MAP: |
| return validateRefereeToGamesMap((Map.Entry<?, ?>) value, diagnostics, context); |
| case BowlingPackage.AREA: |
| return validateArea((Area) value, diagnostics, context); |
| case BowlingPackage.FAN: |
| return validateFan((Fan) value, diagnostics, context); |
| case BowlingPackage.MERCHANDISE: |
| return validateMerchandise((Merchandise) value, diagnostics, context); |
| case BowlingPackage.TOURNAMENT_TYPE: |
| return validateTournamentType((TournamentType) value, diagnostics, context); |
| case BowlingPackage.GENDER: |
| return validateGender((Gender) value, diagnostics, context); |
| case BowlingPackage.XML_DATE: |
| return validateXMLDate((XMLGregorianCalendar) value, diagnostics, context); |
| default: |
| return true; |
| } |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public boolean validatePlayer(Player player, DiagnosticChain diagnostics, Map<Object, Object> context) { |
| if (!validate_NoCircularContainment(player, diagnostics, context)) |
| return false; |
| boolean result = validate_EveryMultiplicityConforms(player, diagnostics, context); |
| if (result || diagnostics != null) |
| result &= validate_EveryDataValueConforms(player, diagnostics, context); |
| if (result || diagnostics != null) |
| result &= validate_EveryReferenceIsContained(player, diagnostics, context); |
| if (result || diagnostics != null) |
| result &= validate_EveryProxyResolves(player, diagnostics, context); |
| if (result || diagnostics != null) |
| result &= validate_UniqueID(player, diagnostics, context); |
| if (result || diagnostics != null) |
| result &= validate_EveryKeyUnique(player, diagnostics, context); |
| if (result || diagnostics != null) |
| result &= validate_EveryMapEntryUnique(player, diagnostics, context); |
| if (result || diagnostics != null) |
| result &= validatePlayer_validate(player, diagnostics, context); |
| return result; |
| } |
| |
| /** |
| * Validates the validate constraint of '<em>Player</em>'. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public boolean validatePlayer_validate(Player player, DiagnosticChain diagnostics, Map<Object, Object> context) { |
| return player.validate(diagnostics, context); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public boolean validateLeague(League league, DiagnosticChain diagnostics, Map<Object, Object> context) { |
| return validate_EveryDefaultConstraint(league, diagnostics, context); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public boolean validateTournament(Tournament tournament, DiagnosticChain diagnostics, Map<Object, Object> context) { |
| return validate_EveryDefaultConstraint(tournament, diagnostics, context); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public boolean validateMatchup(Matchup matchup, DiagnosticChain diagnostics, Map<Object, Object> context) { |
| return validate_EveryDefaultConstraint(matchup, diagnostics, context); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public boolean validateGame(Game game, DiagnosticChain diagnostics, Map<Object, Object> context) { |
| return validate_EveryDefaultConstraint(game, diagnostics, context); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public boolean validatePlayerToPointsMap(Map.Entry<?, ?> playerToPointsMap, DiagnosticChain diagnostics, |
| Map<Object, Object> context) { |
| return validate_EveryDefaultConstraint((EObject) playerToPointsMap, diagnostics, context); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public boolean validateReferee(Referee referee, DiagnosticChain diagnostics, Map<Object, Object> context) { |
| return validate_EveryDefaultConstraint(referee, diagnostics, context); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public boolean validateRefereeToGamesMap(Map.Entry<?, ?> refereeToGamesMap, DiagnosticChain diagnostics, |
| Map<Object, Object> context) { |
| return validate_EveryDefaultConstraint((EObject) refereeToGamesMap, diagnostics, context); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public boolean validateArea(Area area, DiagnosticChain diagnostics, Map<Object, Object> context) { |
| return validate_EveryDefaultConstraint(area, diagnostics, context); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public boolean validateFan(Fan fan, DiagnosticChain diagnostics, Map<Object, Object> context) { |
| return validate_EveryDefaultConstraint(fan, diagnostics, context); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public boolean validateMerchandise(Merchandise merchandise, DiagnosticChain diagnostics, |
| Map<Object, Object> context) { |
| return validate_EveryDefaultConstraint(merchandise, diagnostics, context); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public boolean validateTournamentType(TournamentType tournamentType, DiagnosticChain diagnostics, |
| Map<Object, Object> context) { |
| return true; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public boolean validateGender(Gender gender, DiagnosticChain diagnostics, Map<Object, Object> context) { |
| return true; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public boolean validateXMLDate(XMLGregorianCalendar xmlDate, DiagnosticChain diagnostics, |
| Map<Object, Object> context) { |
| return true; |
| } |
| |
| /** |
| * Returns the resource locator that will be used to fetch messages for this validator's diagnostics. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public ResourceLocator getResourceLocator() { |
| // TODO |
| // Specialize this to return a resource locator for messages specific to this validator. |
| // Ensure that you remove @generated or mark it @generated NOT |
| return super.getResourceLocator(); |
| } |
| |
| } // BowlingValidator |