/** * Copyright (c) 2010 National Aeronautics and Space Administration. All rights reserved. */ package net.certware.argument.gsz.util; import java.util.List; import net.certware.argument.arm.ArgumentElement; import net.certware.argument.arm.ArgumentLink; import net.certware.argument.arm.AssertedEvidence; import net.certware.argument.arm.AssertedRelationship; import net.certware.argument.arm.Claim; import net.certware.argument.arm.InformationElement; import net.certware.argument.arm.ModelElement; import net.certware.argument.arm.ReasoningElement; import net.certware.argument.gsz.ArgumentDiagram; import net.certware.argument.gsz.Assumption; import net.certware.argument.gsz.Context; import net.certware.argument.gsz.Evidence; import net.certware.argument.gsz.Goal; import net.certware.argument.gsz.GszPackage; import net.certware.argument.gsz.Justification; import net.certware.argument.gsz.Solution; import net.certware.argument.gsz.Strategy; 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 net.certware.argument.gsz.GszPackage * @generated */ public class GszSwitch<T> { /** * The cached model package * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected static GszPackage modelPackage; /** * Creates an instance of the switch. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public GszSwitch() { if (modelPackage == null) { modelPackage = GszPackage.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 GszPackage.ARGUMENT_DIAGRAM: { ArgumentDiagram argumentDiagram = (ArgumentDiagram)theEObject; T result = caseArgumentDiagram(argumentDiagram); if (result == null) result = defaultCase(theEObject); return result; } case GszPackage.GOAL: { Goal goal = (Goal)theEObject; T result = caseGoal(goal); if (result == null) result = caseClaim(goal); if (result == null) result = caseReasoningElement(goal); if (result == null) result = caseArgumentElement(goal); if (result == null) result = caseModelElement(goal); if (result == null) result = defaultCase(theEObject); return result; } case GszPackage.STRATEGY: { Strategy strategy = (Strategy)theEObject; T result = caseStrategy(strategy); if (result == null) result = caseReasoningElement(strategy); if (result == null) result = caseArgumentElement(strategy); if (result == null) result = caseModelElement(strategy); if (result == null) result = defaultCase(theEObject); return result; } case GszPackage.JUSTIFICATION: { Justification justification = (Justification)theEObject; T result = caseJustification(justification); if (result == null) result = caseInformationElement(justification); if (result == null) result = caseArgumentElement(justification); if (result == null) result = caseModelElement(justification); if (result == null) result = defaultCase(theEObject); return result; } case GszPackage.CONTEXT: { Context context = (Context)theEObject; T result = caseContext(context); if (result == null) result = caseInformationElement(context); if (result == null) result = caseArgumentElement(context); if (result == null) result = caseModelElement(context); if (result == null) result = defaultCase(theEObject); return result; } case GszPackage.ASSUMPTION: { Assumption assumption = (Assumption)theEObject; T result = caseAssumption(assumption); if (result == null) result = caseInformationElement(assumption); if (result == null) result = caseArgumentElement(assumption); if (result == null) result = caseModelElement(assumption); if (result == null) result = defaultCase(theEObject); return result; } case GszPackage.SOLUTION: { Solution solution = (Solution)theEObject; T result = caseSolution(solution); if (result == null) result = caseAssertedEvidence(solution); if (result == null) result = caseAssertedRelationship(solution); if (result == null) result = caseArgumentLink(solution); if (result == null) result = caseModelElement(solution); if (result == null) result = defaultCase(theEObject); return result; } case GszPackage.EVIDENCE: { Evidence evidence = (Evidence)theEObject; T result = caseEvidence(evidence); if (result == null) result = caseAssertedEvidence(evidence); if (result == null) result = caseAssertedRelationship(evidence); if (result == null) result = caseArgumentLink(evidence); if (result == null) result = caseModelElement(evidence); if (result == null) result = defaultCase(theEObject); return result; } default: return defaultCase(theEObject); } } /** * Returns the result of interpreting the object as an instance of '<em>Argument Diagram</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>Argument Diagram</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseArgumentDiagram(ArgumentDiagram object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Goal</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>Goal</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseGoal(Goal object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Strategy</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>Strategy</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseStrategy(Strategy object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Justification</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>Justification</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseJustification(Justification object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Context</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>Context</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseContext(Context object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Assumption</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>Assumption</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseAssumption(Assumption object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Solution</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>Solution</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseSolution(Solution object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Evidence</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>Evidence</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseEvidence(Evidence object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Model 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>Model Element</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseModelElement(ModelElement object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Argument 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>Argument Element</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseArgumentElement(ArgumentElement object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Reasoning 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>Reasoning Element</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseReasoningElement(ReasoningElement object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Claim</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>Claim</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseClaim(Claim object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Information 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>Information Element</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseInformationElement(InformationElement object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Argument Link</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>Argument Link</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseArgumentLink(ArgumentLink object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Asserted Relationship</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>Asserted Relationship</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseAssertedRelationship(AssertedRelationship object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Asserted Evidence</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>Asserted Evidence</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseAssertedEvidence(AssertedEvidence 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; } } //GszSwitch