blob: c0c21a6b0a1e2741e5ee5856d857742bca0807f2 [file] [log] [blame]
/**
* Copyright (c) 2012, 2019 INRIA and Mia-Software and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
*
* Contributors:
* Guillaume Doux (INRIA) - Initial API and implementation
* Grégoire Dupé (Mia-Software) - Bug 483292 - [Benchmark] long must be used to store memory usage
* Grégoire Dupé (Mia-Software) - Bug 483400 - [Benchmark] The input size should be computable by the discoverer
*/
package org.eclipse.modisco.infra.discovery.benchmark.metamodel.internal.benchmark.util;
import java.util.List;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.modisco.infra.discovery.benchmark.metamodel.internal.benchmark.*;
/**
* <!-- 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.modisco.infra.discovery.benchmark.metamodel.internal.benchmark.BenchmarkPackage
* @generated
*/
public class BenchmarkSwitch<T> {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static final String copyright = "Copyright (c) 2012, 2015 INRIA and Mia-Software.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v2.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v20.html\r\n\r\nContributors:\r\n Guillaume Doux (INRIA) - Initial API and implementation\r\n Grégoire Dupé (Mia-Software) - Bug 483292 - [Benchmark] long must be used to store memory usage\r\n Grégoire Dupé (Mia-Software) - Bug 483400 - [Benchmark] The input size should be computable by the discoverer\r\n";
/**
* The cached model package
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected static BenchmarkPackage modelPackage;
/**
* Creates an instance of the switch.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public BenchmarkSwitch() {
if (modelPackage == null) {
modelPackage = BenchmarkPackage.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);
}
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 BenchmarkPackage.MEMORY_MEASUREMENT: {
MemoryMeasurement memoryMeasurement = (MemoryMeasurement)theEObject;
T result = caseMemoryMeasurement(memoryMeasurement);
if (result == null) result = caseEvent(memoryMeasurement);
if (result == null) result = defaultCase(theEObject);
return result;
}
case BenchmarkPackage.EVENT: {
Event event = (Event)theEObject;
T result = caseEvent(event);
if (result == null) result = defaultCase(theEObject);
return result;
}
case BenchmarkPackage.EVENT_TYPE: {
EventType eventType = (EventType)theEObject;
T result = caseEventType(eventType);
if (result == null) result = defaultCase(theEObject);
return result;
}
case BenchmarkPackage.BEGIN_EVENT: {
BeginEvent beginEvent = (BeginEvent)theEObject;
T result = caseBeginEvent(beginEvent);
if (result == null) result = caseEvent(beginEvent);
if (result == null) result = defaultCase(theEObject);
return result;
}
case BenchmarkPackage.END_EVENT: {
EndEvent endEvent = (EndEvent)theEObject;
T result = caseEndEvent(endEvent);
if (result == null) result = caseEvent(endEvent);
if (result == null) result = defaultCase(theEObject);
return result;
}
case BenchmarkPackage.FILE: {
File file = (File)theEObject;
T result = caseFile(file);
if (result == null) result = defaultCase(theEObject);
return result;
}
case BenchmarkPackage.RESOURCE: {
Resource resource = (Resource)theEObject;
T result = caseResource(resource);
if (result == null) result = defaultCase(theEObject);
return result;
}
case BenchmarkPackage.PROJECT: {
Project project = (Project)theEObject;
T result = caseProject(project);
if (result == null) result = caseResource(project);
if (result == null) result = defaultCase(theEObject);
return result;
}
case BenchmarkPackage.BENCHMARK: {
Benchmark benchmark = (Benchmark)theEObject;
T result = caseBenchmark(benchmark);
if (result == null) result = defaultCase(theEObject);
return result;
}
case BenchmarkPackage.DISCOVERY: {
Discovery discovery = (Discovery)theEObject;
T result = caseDiscovery(discovery);
if (result == null) result = defaultCase(theEObject);
return result;
}
case BenchmarkPackage.DISCOVERY_ITERATION: {
DiscoveryIteration discoveryIteration = (DiscoveryIteration)theEObject;
T result = caseDiscoveryIteration(discoveryIteration);
if (result == null) result = defaultCase(theEObject);
return result;
}
default: return defaultCase(theEObject);
}
}
/**
* Returns the result of interpreting the object as an instance of '<em>Memory Measurement</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>Memory Measurement</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseMemoryMeasurement(MemoryMeasurement object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Event</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>Event</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseEvent(Event object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Event Type</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>Event Type</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseEventType(EventType object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Begin Event</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>Begin Event</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseBeginEvent(BeginEvent object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>End Event</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>End Event</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseEndEvent(EndEvent object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>File</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>File</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseFile(File object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Resource</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</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseResource(Resource object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Project</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>Project</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseProject(Project object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Benchmark</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>Benchmark</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseBenchmark(Benchmark object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Discovery</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>Discovery</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseDiscovery(Discovery object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Discovery Iteration</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>Discovery Iteration</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseDiscoveryIteration(DiscoveryIteration 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;
}
} //BenchmarkSwitch