/**
* <copyright>
* </copyright>
*
* $Id$
*/
package org.jnario.util;
import java.util.List;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.xtend.core.xtend.XtendAnnotationTarget;
import org.eclipse.xtend.core.xtend.XtendClass;
import org.eclipse.xtend.core.xtend.XtendFunction;
import org.eclipse.xtend.core.xtend.XtendField;
import org.eclipse.xtend.core.xtend.XtendMember;
import org.eclipse.xtend.core.xtend.XtendTypeDeclaration;
import org.eclipse.xtext.xbase.XAbstractFeatureCall;
import org.eclipse.xtext.xbase.XBinaryOperation;
import org.eclipse.xtext.xbase.XExpression;
import org.eclipse.xtext.xbase.XTypeLiteral;
import org.jnario.*;
import org.jnario.Assertion;
import org.jnario.ExampleColumn;
import org.jnario.ExampleRow;
import org.jnario.ExampleTable;
import org.jnario.Executable;
import org.jnario.JnarioPackage;
import org.jnario.MockLiteral;
import org.jnario.Should;
import org.jnario.ShouldThrow;
import org.jnario.Specification;
/**
* <!-- 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 org.jnario.JnarioPackage
* @generated
*/
public class JnarioSwitch<T> {
/**
* The cached model package
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected static JnarioPackage modelPackage;
/**
* Creates an instance of the switch.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public JnarioSwitch() {
if (modelPackage == null) {
modelPackage = JnarioPackage.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 JnarioPackage.EXAMPLE_TABLE: {
ExampleTable exampleTable = (ExampleTable)theEObject;
T result = caseExampleTable(exampleTable);
if (result == null) result = caseXtendMember(exampleTable);
if (result == null) result = caseXExpression(exampleTable);
if (result == null) result = caseXtendAnnotationTarget(exampleTable);
if (result == null) result = defaultCase(theEObject);
return result;
}
case JnarioPackage.EXAMPLE_ROW: {
ExampleRow exampleRow = (ExampleRow)theEObject;
T result = caseExampleRow(exampleRow);
if (result == null) result = defaultCase(theEObject);
return result;
}
case JnarioPackage.ASSERTION: {
Assertion assertion = (Assertion)theEObject;
T result = caseAssertion(assertion);
if (result == null) result = caseXExpression(assertion);
if (result == null) result = defaultCase(theEObject);
return result;
}
case JnarioPackage.EXAMPLE_COLUMN: {
ExampleColumn exampleColumn = (ExampleColumn)theEObject;
T result = caseExampleColumn(exampleColumn);
if (result == null) result = defaultCase(theEObject);
return result;
}
case JnarioPackage.SHOULD: {
Should should = (Should)theEObject;
T result = caseShould(should);
if (result == null) result = caseXBinaryOperation(should);
if (result == null) result = caseXAbstractFeatureCall(should);
if (result == null) result = caseXExpression(should);
if (result == null) result = defaultCase(theEObject);
return result;
}
case JnarioPackage.SHOULD_THROW: {
ShouldThrow shouldThrow = (ShouldThrow)theEObject;
T result = caseShouldThrow(shouldThrow);
if (result == null) result = caseXExpression(shouldThrow);
if (result == null) result = defaultCase(theEObject);
return result;
}
case JnarioPackage.SPECIFICATION: {
Specification specification = (Specification)theEObject;
T result = caseSpecification(specification);
if (result == null) result = caseXtendClass(specification);
if (result == null) result = caseExecutable(specification);
if (result == null) result = caseXtendTypeDeclaration(specification);
if (result == null) result = caseXtendMember(specification);
if (result == null) result = caseXtendAnnotationTarget(specification);
if (result == null) result = defaultCase(theEObject);
return result;
}
case JnarioPackage.EXECUTABLE: {
Executable executable = (Executable)theEObject;
T result = caseExecutable(executable);
if (result == null) result = defaultCase(theEObject);
return result;
}
case JnarioPackage.MOCK_LITERAL: {
MockLiteral mockLiteral = (MockLiteral)theEObject;
T result = caseMockLiteral(mockLiteral);
if (result == null) result = caseXTypeLiteral(mockLiteral);
if (result == null) result = caseXExpression(mockLiteral);
if (result == null) result = defaultCase(theEObject);
return result;
}
case JnarioPackage.EXAMPLE_CELL: {
ExampleCell exampleCell = (ExampleCell)theEObject;
T result = caseExampleCell(exampleCell);
if (result == null) result = caseXtendFunction(exampleCell);
if (result == null) result = caseXtendMember(exampleCell);
if (result == null) result = caseXtendAnnotationTarget(exampleCell);
if (result == null) result = defaultCase(theEObject);
return result;
}
default: return defaultCase(theEObject);
}
}
/**
* Returns the result of interpreting the object as an instance of '<em>Example Table</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>Example Table</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseExampleTable(ExampleTable object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Example Row</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>Example Row</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseExampleRow(ExampleRow object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Assertion</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>Assertion</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseAssertion(Assertion object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Example Column</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>Example Column</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseExampleColumn(ExampleColumn object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Should</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>Should</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseShould(Should object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Should Throw</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>Should Throw</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseShouldThrow(ShouldThrow object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Specification</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>Specification</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseSpecification(Specification object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Executable</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>Executable</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseExecutable(Executable object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Mock Literal</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>Mock Literal</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseMockLiteral(MockLiteral object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Example Cell</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>Example Cell</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseExampleCell(ExampleCell object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Annotation Target</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>Annotation Target</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseXtendAnnotationTarget(XtendAnnotationTarget object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Member</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>Member</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseXtendMember(XtendMember object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>XExpression</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>XExpression</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseXExpression(XExpression object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>XAbstract Feature Call</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>XAbstract Feature Call</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseXAbstractFeatureCall(XAbstractFeatureCall object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>XBinary Operation</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>XBinary Operation</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseXBinaryOperation(XBinaryOperation object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Type Declaration</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>Type Declaration</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseXtendTypeDeclaration(XtendTypeDeclaration object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Class</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>Class</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseXtendClass(XtendClass object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>XType Literal</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>XType Literal</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseXTypeLiteral(XTypeLiteral object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Function</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>Function</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseXtendFunction(XtendFunction 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;
}
} //JnarioSwitch