/**
* <copyright>
* </copyright>
*
* $Id$
*/
package org.eclipse.papyrus.infra.core.sashwindows.di.util;
import java.util.List;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPage;
import org.eclipse.papyrus.infra.core.sashwindows.di.AbstractPanel;
import org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage;
import org.eclipse.papyrus.infra.core.sashwindows.di.PageList;
import org.eclipse.papyrus.infra.core.sashwindows.di.PageRef;
import org.eclipse.papyrus.infra.core.sashwindows.di.PanelParent;
import org.eclipse.papyrus.infra.core.sashwindows.di.Position;
import org.eclipse.papyrus.infra.core.sashwindows.di.SashModel;
import org.eclipse.papyrus.infra.core.sashwindows.di.SashPanel;
import org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr;
import org.eclipse.papyrus.infra.core.sashwindows.di.Size;
import org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder;
import org.eclipse.papyrus.infra.core.sashwindows.di.Window;
/**
* <!-- 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.eclipse.papyrus.infra.core.sashwindows.di.DiPackage
* @generated
*/
public class DiSwitch<T> {
/**
* The cached model package
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected static DiPackage modelPackage;
/**
* Creates an instance of the switch.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DiSwitch() {
if (modelPackage == null) {
modelPackage = DiPackage.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 DiPackage.SASH_MODEL: {
SashModel sashModel = (SashModel)theEObject;
T result = caseSashModel(sashModel);
if (result == null) result = defaultCase(theEObject);
return result;
}
case DiPackage.WINDOW: {
Window window = (Window)theEObject;
T result = caseWindow(window);
if (result == null) result = casePanelParent(window);
if (result == null) result = defaultCase(theEObject);
return result;
}
case DiPackage.PANEL_PARENT: {
PanelParent panelParent = (PanelParent)theEObject;
T result = casePanelParent(panelParent);
if (result == null) result = defaultCase(theEObject);
return result;
}
case DiPackage.ABSTRACT_PANEL: {
AbstractPanel abstractPanel = (AbstractPanel)theEObject;
T result = caseAbstractPanel(abstractPanel);
if (result == null) result = defaultCase(theEObject);
return result;
}
case DiPackage.POSITION: {
Position position = (Position)theEObject;
T result = casePosition(position);
if (result == null) result = defaultCase(theEObject);
return result;
}
case DiPackage.SIZE: {
Size size = (Size)theEObject;
T result = caseSize(size);
if (result == null) result = defaultCase(theEObject);
return result;
}
case DiPackage.TAB_FOLDER: {
TabFolder tabFolder = (TabFolder)theEObject;
T result = caseTabFolder(tabFolder);
if (result == null) result = caseAbstractPanel(tabFolder);
if (result == null) result = defaultCase(theEObject);
return result;
}
case DiPackage.PAGE_REF: {
PageRef pageRef = (PageRef)theEObject;
T result = casePageRef(pageRef);
if (result == null) result = defaultCase(theEObject);
return result;
}
case DiPackage.SASH_PANEL: {
SashPanel sashPanel = (SashPanel)theEObject;
T result = caseSashPanel(sashPanel);
if (result == null) result = caseAbstractPanel(sashPanel);
if (result == null) result = casePanelParent(sashPanel);
if (result == null) result = defaultCase(theEObject);
return result;
}
case DiPackage.ABSTRACT_PAGE: {
AbstractPage abstractPage = (AbstractPage)theEObject;
T result = caseAbstractPage(abstractPage);
if (result == null) result = defaultCase(theEObject);
return result;
}
case DiPackage.PAGE_LIST: {
PageList pageList = (PageList)theEObject;
T result = casePageList(pageList);
if (result == null) result = defaultCase(theEObject);
return result;
}
case DiPackage.SASH_WINDOWS_MNGR: {
SashWindowsMngr sashWindowsMngr = (SashWindowsMngr)theEObject;
T result = caseSashWindowsMngr(sashWindowsMngr);
if (result == null) result = defaultCase(theEObject);
return result;
}
default: return defaultCase(theEObject);
}
}
/**
* Returns the result of interpreting the object as an instance of '<em>Sash Model</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>Sash Model</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseSashModel(SashModel object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Window</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>Window</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseWindow(Window object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Panel Parent</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>Panel Parent</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T casePanelParent(PanelParent object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Abstract Panel</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>Abstract Panel</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseAbstractPanel(AbstractPanel object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Position</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>Position</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T casePosition(Position object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Size</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>Size</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseSize(Size object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Tab Folder</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>Tab Folder</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseTabFolder(TabFolder object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Page Ref</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>Page Ref</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T casePageRef(PageRef object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Sash Panel</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>Sash Panel</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseSashPanel(SashPanel object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Abstract Page</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>Abstract Page</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseAbstractPage(AbstractPage object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Page List</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>Page List</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T casePageList(PageList object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Sash Windows Mngr</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>Sash Windows Mngr</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseSashWindowsMngr(SashWindowsMngr 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;
}
} //DiSwitch