/*******************************************************************************
* Copyright (c) 2008 Hallvard Traetteberg.
* 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:
* Hallvard Traetteberg - initial API and implementation
******************************************************************************/
/**
* <copyright
* </copyright>
*
* $Id: LayoutsSwitch.java,v 1.3 2009/10/23 12:40:33 htraetteb Exp $
*/
package org.eclipse.e4.tm.swt.layouts.util;
import java.util.List;
import org.eclipse.e4.tm.layouts.Layout;
import org.eclipse.e4.tm.layouts.LayoutData;
import org.eclipse.e4.tm.swt.layouts.LayoutsPackage;
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 org.eclipse.e4.tm.swt.layouts.LayoutsPackage
* @generated
*/
public class LayoutsSwitch<T1> {
/**
* The cached model package
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected static LayoutsPackage modelPackage;
/**
* Creates an instance of the switch.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public LayoutsSwitch() {
if (modelPackage == null) {
modelPackage = LayoutsPackage.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 T1 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 T1 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 T1 doSwitch(int classifierID, EObject theEObject) {
switch (classifierID) {
case LayoutsPackage.ROW_LAYOUT: {
Layout<LayoutData> rowLayout = (Layout)theEObject;
T1 result = caseRowLayout(rowLayout);
if (result == null) result = caseLayout(rowLayout);
if (result == null) result = defaultCase(theEObject);
return result;
}
case LayoutsPackage.ROW_LAYOUT_DATA: {
LayoutData rowLayoutData = (LayoutData)theEObject;
T1 result = caseRowLayoutData(rowLayoutData);
if (result == null) result = caseLayoutData(rowLayoutData);
if (result == null) result = caseDimension(rowLayoutData);
if (result == null) result = defaultCase(theEObject);
return result;
}
case LayoutsPackage.GRID_LAYOUT: {
Layout<LayoutData> gridLayout = (Layout)theEObject;
T1 result = caseGridLayout(gridLayout);
if (result == null) result = caseLayout(gridLayout);
if (result == null) result = defaultCase(theEObject);
return result;
}
case LayoutsPackage.GRID_LAYOUT_DATA: {
LayoutData gridLayoutData = (LayoutData)theEObject;
T1 result = caseGridLayoutData(gridLayoutData);
if (result == null) result = caseLayoutData(gridLayoutData);
if (result == null) result = defaultCase(theEObject);
return result;
}
case LayoutsPackage.FILL_LAYOUT: {
Layout<LayoutData> fillLayout = (Layout)theEObject;
T1 result = caseFillLayout(fillLayout);
if (result == null) result = caseLayout(fillLayout);
if (result == null) result = defaultCase(theEObject);
return result;
}
case LayoutsPackage.STACK_LAYOUT: {
Layout<LayoutData> stackLayout = (Layout)theEObject;
T1 result = caseStackLayout(stackLayout);
if (result == null) result = caseLayout(stackLayout);
if (result == null) result = defaultCase(theEObject);
return result;
}
case LayoutsPackage.FORM_LAYOUT: {
Layout<LayoutData> formLayout = (Layout)theEObject;
T1 result = caseFormLayout(formLayout);
if (result == null) result = caseLayout(formLayout);
if (result == null) result = defaultCase(theEObject);
return result;
}
case LayoutsPackage.FORM_LAYOUT_DATA: {
LayoutData formLayoutData = (LayoutData)theEObject;
T1 result = caseFormLayoutData(formLayoutData);
if (result == null) result = caseLayoutData(formLayoutData);
if (result == null) result = caseDimension(formLayoutData);
if (result == null) result = defaultCase(theEObject);
return result;
}
case LayoutsPackage.FORM_ATTACHMENT: {
EObject formAttachment = (EObject)theEObject;
T1 result = caseFormAttachment(formAttachment);
if (result == null) result = defaultCase(theEObject);
return result;
}
default: return defaultCase(theEObject);
}
}
/**
* Returns the result of interpreting the object as an instance of '<em>Row Layout Data</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>Row Layout Data</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T1 caseRowLayoutData(LayoutData object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Grid Layout</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>Grid Layout</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T1 caseGridLayout(Layout object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Grid Layout Data</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>Grid Layout Data</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T1 caseGridLayoutData(LayoutData object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Fill Layout</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>Fill Layout</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T1 caseFillLayout(Layout object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Stack Layout</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>Stack Layout</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T1 caseStackLayout(Layout object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Form Layout</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>Form Layout</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T1 caseFormLayout(Layout object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Form Layout Data</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>Form Layout Data</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T1 caseFormLayoutData(LayoutData object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Form Attachment</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>Form Attachment</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T1 caseFormAttachment(EObject object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Row Layout</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>Row Layout</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T1 caseRowLayout(Layout object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Layout Data</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>Layout Data</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T1 caseLayoutData(LayoutData object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Dimension</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>Dimension</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T1 caseDimension(EObject object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Layout</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>Layout</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public <T extends LayoutData> T1 caseLayout(Layout<T> 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 T1 defaultCase(EObject object) {
return null;
}
} //LayoutsSwitch