/**
* <copyright>
* </copyright>
*
* $Id$
*/
package com.hundsun.ares.studio.jres.model.database.util;
import java.util.List;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import com.hundsun.ares.studio.core.model.BasicResourceInfo;
import com.hundsun.ares.studio.core.model.ExtensibleModel;
import com.hundsun.ares.studio.core.model.IJSONData;
import com.hundsun.ares.studio.core.model.IReferenceProvider;
import com.hundsun.ares.studio.core.model.JRESResourceInfo;
import com.hundsun.ares.studio.jres.model.database.*;
import com.hundsun.ares.studio.jres.model.database.DBGenContext;
import com.hundsun.ares.studio.jres.model.database.DBModuleCommonProperty;
import com.hundsun.ares.studio.jres.model.database.DatabasePackage;
import com.hundsun.ares.studio.jres.model.database.DatabaseResourceData;
import com.hundsun.ares.studio.jres.model.database.ForeignKey;
import com.hundsun.ares.studio.jres.model.database.TableColumn;
import com.hundsun.ares.studio.jres.model.database.TableIndex;
import com.hundsun.ares.studio.jres.model.database.TableIndexColumn;
import com.hundsun.ares.studio.jres.model.database.TableResourceData;
import com.hundsun.ares.studio.jres.model.database.ViewResourceData;
/**
* <!-- 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 com.hundsun.ares.studio.jres.model.database.DatabasePackage
* @generated
*/
public class DatabaseSwitch<T> {
/**
* The cached model package
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected static DatabasePackage modelPackage;
/**
* Creates an instance of the switch.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DatabaseSwitch() {
if (modelPackage == null) {
modelPackage = DatabasePackage.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 DatabasePackage.DB_MODULE_COMMON_PROPERTY: {
DBModuleCommonProperty dbModuleCommonProperty = (DBModuleCommonProperty)theEObject;
T result = caseDBModuleCommonProperty(dbModuleCommonProperty);
if (result == null) result = defaultCase(theEObject);
return result;
}
case DatabasePackage.DATABASE_RESOURCE_DATA: {
DatabaseResourceData databaseResourceData = (DatabaseResourceData)theEObject;
T result = caseDatabaseResourceData(databaseResourceData);
if (result == null) result = caseJRESResourceInfo(databaseResourceData);
if (result == null) result = caseExtensibleModel(databaseResourceData);
if (result == null) result = caseBasicResourceInfo(databaseResourceData);
if (result == null) result = caseIReferenceProvider(databaseResourceData);
if (result == null) result = caseIJSONData(databaseResourceData);
if (result == null) result = defaultCase(theEObject);
return result;
}
case DatabasePackage.TABLE_RESOURCE_DATA: {
TableResourceData tableResourceData = (TableResourceData)theEObject;
T result = caseTableResourceData(tableResourceData);
if (result == null) result = caseDatabaseResourceData(tableResourceData);
if (result == null) result = caseJRESResourceInfo(tableResourceData);
if (result == null) result = caseExtensibleModel(tableResourceData);
if (result == null) result = caseBasicResourceInfo(tableResourceData);
if (result == null) result = caseIReferenceProvider(tableResourceData);
if (result == null) result = caseIJSONData(tableResourceData);
if (result == null) result = defaultCase(theEObject);
return result;
}
case DatabasePackage.TABLE_COLUMN: {
TableColumn tableColumn = (TableColumn)theEObject;
T result = caseTableColumn(tableColumn);
if (result == null) result = caseExtensibleModel(tableColumn);
if (result == null) result = caseIJSONData(tableColumn);
if (result == null) result = defaultCase(theEObject);
return result;
}
case DatabasePackage.TABLE_INDEX_COLUMN: {
TableIndexColumn tableIndexColumn = (TableIndexColumn)theEObject;
T result = caseTableIndexColumn(tableIndexColumn);
if (result == null) result = caseExtensibleModel(tableIndexColumn);
if (result == null) result = caseIJSONData(tableIndexColumn);
if (result == null) result = defaultCase(theEObject);
return result;
}
case DatabasePackage.TABLE_INDEX: {
TableIndex tableIndex = (TableIndex)theEObject;
T result = caseTableIndex(tableIndex);
if (result == null) result = caseExtensibleModel(tableIndex);
if (result == null) result = caseIJSONData(tableIndex);
if (result == null) result = defaultCase(theEObject);
return result;
}
case DatabasePackage.VIEW_RESOURCE_DATA: {
ViewResourceData viewResourceData = (ViewResourceData)theEObject;
T result = caseViewResourceData(viewResourceData);
if (result == null) result = caseDatabaseResourceData(viewResourceData);
if (result == null) result = caseJRESResourceInfo(viewResourceData);
if (result == null) result = caseExtensibleModel(viewResourceData);
if (result == null) result = caseBasicResourceInfo(viewResourceData);
if (result == null) result = caseIReferenceProvider(viewResourceData);
if (result == null) result = caseIJSONData(viewResourceData);
if (result == null) result = defaultCase(theEObject);
return result;
}
case DatabasePackage.DB_GEN_CONTEXT: {
DBGenContext dbGenContext = (DBGenContext)theEObject;
T result = caseDBGenContext(dbGenContext);
if (result == null) result = caseExtensibleModel(dbGenContext);
if (result == null) result = caseIJSONData(dbGenContext);
if (result == null) result = defaultCase(theEObject);
return result;
}
case DatabasePackage.FOREIGN_KEY: {
ForeignKey foreignKey = (ForeignKey)theEObject;
T result = caseForeignKey(foreignKey);
if (result == null) result = defaultCase(theEObject);
return result;
}
case DatabasePackage.TABLE_KEY: {
TableKey tableKey = (TableKey)theEObject;
T result = caseTableKey(tableKey);
if (result == null) result = caseExtensibleModel(tableKey);
if (result == null) result = caseIJSONData(tableKey);
if (result == null) result = defaultCase(theEObject);
return result;
}
default: return defaultCase(theEObject);
}
}
/**
* Returns the result of interpreting the object as an instance of '<em>DB Module Common Property</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>DB Module Common Property</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseDBModuleCommonProperty(DBModuleCommonProperty object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Resource 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>Resource Data</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseDatabaseResourceData(DatabaseResourceData object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Table Resource 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>Table Resource Data</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseTableResourceData(TableResourceData object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Table 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>Table Column</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseTableColumn(TableColumn object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Table Index 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>Table Index Column</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseTableIndexColumn(TableIndexColumn object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Table Index</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>Table Index</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseTableIndex(TableIndex object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>View Resource 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>View Resource Data</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseViewResourceData(ViewResourceData object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>DB Gen 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>DB Gen Context</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseDBGenContext(DBGenContext object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Foreign Key</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>Foreign Key</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseForeignKey(ForeignKey object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Table Key</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>Table Key</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseTableKey(TableKey object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Basic Resource Info</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>Basic Resource Info</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseBasicResourceInfo(BasicResourceInfo object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Extensible 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>Extensible Model</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseExtensibleModel(ExtensibleModel object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>IReference Provider</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>IReference Provider</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseIReferenceProvider(IReferenceProvider object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>IJSON 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>IJSON Data</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseIJSONData(IJSONData object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>JRES Resource Info</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>JRES Resource Info</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseJRESResourceInfo(JRESResourceInfo 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;
}
} //DatabaseSwitch