/** * Copyright (c) 2001-2011 Mad Cow Entertainment and Corporation * 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: �bel Heged�s - initial API and implementation */ package madcow.magic.database.card.util; import java.util.List; import madcow.magic.database.card.*; import madcow.magic.database.core.MagicDBElement; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; /** * <!-- begin-user-doc --> * The <b>Switch</b> for the model's inheritance hierarchy. * It supports the call {@link #doSwitch(EObject) doSwitch(object)} * to invoke the <code>caseXXX</code> method for each class of the model, * starting with the actual class of the object * and proceeding up the inheritance hierarchy * until a non-null result is returned, * which is the result of the switch. * <!-- end-user-doc --> * @see madcow.magic.database.card.CardPackage * @generated */ public class CardSwitch<T> { /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final String copyright = "Copyright (c) 2001-2011 Mad Cow Entertainment and Corporation\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0 \r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html \r\n\r\nContributors: �bel Heged�s - initial API and implementation"; /** * The cached model package * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected static CardPackage modelPackage; /** * Creates an instance of the switch. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public CardSwitch() { if (modelPackage == null) { modelPackage = CardPackage.eINSTANCE; } } /** * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the first non-null result returned by a <code>caseXXX</code> call. * @generated */ public T doSwitch(EObject theEObject) { return doSwitch(theEObject.eClass(), theEObject); } /** * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the first non-null result returned by a <code>caseXXX</code> call. * @generated */ protected T doSwitch(EClass theEClass, EObject theEObject) { if (theEClass.eContainer() == modelPackage) { return doSwitch(theEClass.getClassifierID(), theEObject); } else { List<EClass> eSuperTypes = theEClass.getESuperTypes(); return eSuperTypes.isEmpty() ? defaultCase(theEObject) : doSwitch(eSuperTypes.get(0), theEObject); } } /** * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the first non-null result returned by a <code>caseXXX</code> call. * @generated */ protected T doSwitch(int classifierID, EObject theEObject) { switch (classifierID) { case CardPackage.CARD: { Card card = (Card)theEObject; T result = caseCard(card); if (result == null) result = caseMagicDBElement(card); if (result == null) result = defaultCase(theEObject); return result; } case CardPackage.ARTIFACT: { Artifact artifact = (Artifact)theEObject; T result = caseArtifact(artifact); if (result == null) result = caseCard(artifact); if (result == null) result = caseMagicDBElement(artifact); if (result == null) result = defaultCase(theEObject); return result; } case CardPackage.CREATURE: { Creature creature = (Creature)theEObject; T result = caseCreature(creature); if (result == null) result = caseCard(creature); if (result == null) result = caseMagicDBElement(creature); if (result == null) result = defaultCase(theEObject); return result; } case CardPackage.ENCHANCEMENT: { Enchancement enchancement = (Enchancement)theEObject; T result = caseEnchancement(enchancement); if (result == null) result = caseCard(enchancement); if (result == null) result = caseMagicDBElement(enchancement); if (result == null) result = defaultCase(theEObject); return result; } case CardPackage.INSTANT: { Instant instant = (Instant)theEObject; T result = caseInstant(instant); if (result == null) result = caseCard(instant); if (result == null) result = caseMagicDBElement(instant); if (result == null) result = defaultCase(theEObject); return result; } case CardPackage.LAND: { Land land = (Land)theEObject; T result = caseLand(land); if (result == null) result = caseCard(land); if (result == null) result = caseMagicDBElement(land); if (result == null) result = defaultCase(theEObject); return result; } case CardPackage.SORCERY: { Sorcery sorcery = (Sorcery)theEObject; T result = caseSorcery(sorcery); if (result == null) result = caseCard(sorcery); if (result == null) result = caseMagicDBElement(sorcery); if (result == null) result = defaultCase(theEObject); return result; } case CardPackage.ARTIFACT_CREATURE: { ArtifactCreature artifactCreature = (ArtifactCreature)theEObject; T result = caseArtifactCreature(artifactCreature); if (result == null) result = caseCreature(artifactCreature); if (result == null) result = caseArtifact(artifactCreature); if (result == null) result = caseCard(artifactCreature); if (result == null) result = caseMagicDBElement(artifactCreature); if (result == null) result = defaultCase(theEObject); return result; } case CardPackage.INTERRUPT: { Interrupt interrupt = (Interrupt)theEObject; T result = caseInterrupt(interrupt); if (result == null) result = caseInstant(interrupt); if (result == null) result = caseCard(interrupt); if (result == null) result = caseMagicDBElement(interrupt); if (result == null) result = defaultCase(theEObject); return result; } case CardPackage.PLANESWALKER: { Planeswalker planeswalker = (Planeswalker)theEObject; T result = casePlaneswalker(planeswalker); if (result == null) result = caseCard(planeswalker); if (result == null) result = caseMagicDBElement(planeswalker); if (result == null) result = defaultCase(theEObject); return result; } default: return defaultCase(theEObject); } } /** * Returns the result of interpreting the object as an instance of '<em>Card</em>'. * <!-- begin-user-doc --> * This implementation returns null; * returning a non-null result will terminate the switch. * <!-- end-user-doc --> * @param object the target of the switch. * @return the result of interpreting the object as an instance of '<em>Card</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseCard(Card object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Artifact</em>'. * <!-- begin-user-doc --> * This implementation returns null; * returning a non-null result will terminate the switch. * <!-- end-user-doc --> * @param object the target of the switch. * @return the result of interpreting the object as an instance of '<em>Artifact</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseArtifact(Artifact object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Creature</em>'. * <!-- begin-user-doc --> * This implementation returns null; * returning a non-null result will terminate the switch. * <!-- end-user-doc --> * @param object the target of the switch. * @return the result of interpreting the object as an instance of '<em>Creature</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseCreature(Creature object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Enchancement</em>'. * <!-- begin-user-doc --> * This implementation returns null; * returning a non-null result will terminate the switch. * <!-- end-user-doc --> * @param object the target of the switch. * @return the result of interpreting the object as an instance of '<em>Enchancement</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseEnchancement(Enchancement object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Instant</em>'. * <!-- begin-user-doc --> * This implementation returns null; * returning a non-null result will terminate the switch. * <!-- end-user-doc --> * @param object the target of the switch. * @return the result of interpreting the object as an instance of '<em>Instant</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseInstant(Instant object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Land</em>'. * <!-- begin-user-doc --> * This implementation returns null; * returning a non-null result will terminate the switch. * <!-- end-user-doc --> * @param object the target of the switch. * @return the result of interpreting the object as an instance of '<em>Land</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseLand(Land object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Sorcery</em>'. * <!-- begin-user-doc --> * This implementation returns null; * returning a non-null result will terminate the switch. * <!-- end-user-doc --> * @param object the target of the switch. * @return the result of interpreting the object as an instance of '<em>Sorcery</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseSorcery(Sorcery object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Artifact Creature</em>'. * <!-- begin-user-doc --> * This implementation returns null; * returning a non-null result will terminate the switch. * <!-- end-user-doc --> * @param object the target of the switch. * @return the result of interpreting the object as an instance of '<em>Artifact Creature</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseArtifactCreature(ArtifactCreature object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Interrupt</em>'. * <!-- begin-user-doc --> * This implementation returns null; * returning a non-null result will terminate the switch. * <!-- end-user-doc --> * @param object the target of the switch. * @return the result of interpreting the object as an instance of '<em>Interrupt</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseInterrupt(Interrupt object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Planeswalker</em>'. * <!-- begin-user-doc --> * This implementation returns null; * returning a non-null result will terminate the switch. * <!-- end-user-doc --> * @param object the target of the switch. * @return the result of interpreting the object as an instance of '<em>Planeswalker</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T casePlaneswalker(Planeswalker object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Magic DB Element</em>'. * <!-- begin-user-doc --> * This implementation returns null; * returning a non-null result will terminate the switch. * <!-- end-user-doc --> * @param object the target of the switch. * @return the result of interpreting the object as an instance of '<em>Magic DB Element</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseMagicDBElement(MagicDBElement object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. * <!-- begin-user-doc --> * This implementation returns null; * returning a non-null result will terminate the switch, but this is the last case anyway. * <!-- end-user-doc --> * @param object the target of the switch. * @return the result of interpreting the object as an instance of '<em>EObject</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) * @generated */ public T defaultCase(EObject object) { return null; } } //CardSwitch