All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.nasdanika.models.source.util.SourceSwitch Maven / Gradle / Ivy

The newest version!
/**
 */
package org.nasdanika.models.source.util;

import java.util.function.Function;

import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;

import org.eclipse.emf.ecore.util.Switch;

import org.nasdanika.models.source.Position;
import org.nasdanika.models.source.Range;
import org.nasdanika.models.source.Source;
import org.nasdanika.models.source.SourcePackage;

import org.nasdanika.persistence.Marked;

/**
 * 
 * The Switch for the model's inheritance hierarchy.
 * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
 * to invoke the caseXXX 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.
 * 
 * @see org.nasdanika.models.source.SourcePackage
 * @generated
 */
public class SourceSwitch extends Switch {
	/**
	 * The cached model package
	 * 
	 * 
	 * @generated
	 */
	protected static SourcePackage modelPackage;

	/**
	 * Creates an instance of the switch.
	 * 
	 * 
	 * @generated
	 */
	public SourceSwitch() {
		if (modelPackage == null) {
			modelPackage = SourcePackage.eINSTANCE;
		}
	}

	/**
	 * Checks whether this is a switch for the given package.
	 * 
	 * 
	 * @param ePackage the package in question.
	 * @return whether this is a switch for the given package.
	 * @generated
	 */
	@Override
	protected boolean isSwitchFor(EPackage ePackage) {
		return ePackage == modelPackage;
	}

	/**
	 * Calls caseXXX for each class of the model until one returns a non null result; it yields that result.
	 * 
	 * 
	 * @return the first non-null result returned by a caseXXX call.
	 * @generated
	 */
	@Override
	protected T1 doSwitch(int classifierID, EObject theEObject) {
		switch (classifierID) {
			case SourcePackage.TOKEN_SOURCE: {
				@SuppressWarnings("unchecked") Function tokenSource = (Function)theEObject;
				T1 result = caseTokenSource(tokenSource);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case SourcePackage.COMPARABLE: {
				Comparable comparable = (Comparable)theEObject;
				T1 result = caseComparable(comparable);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case SourcePackage.POSITION: {
				Position position = (Position)theEObject;
				T1 result = casePosition(position);
				if (result == null) result = caseComparable(position);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case SourcePackage.RANGE: {
				Range range = (Range)theEObject;
				T1 result = caseRange(range);
				if (result == null) result = caseMarked(range);
				if (result == null) result = caseIMarked(range);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case SourcePackage.SOURCE: {
				Source source = (Source)theEObject;
				T1 result = caseSource(source);
				if (result == null) result = caseRange(source);
				if (result == null) result = caseMarked(source);
				if (result == null) result = caseIMarked(source);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			default: return defaultCase(theEObject);
		}
	}

	/**
	 * Returns the result of interpreting the object as an instance of 'Token Source'.
	 * 
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * 
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of 'Token Source'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T1 caseTokenSource(Function object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of 'Comparable'.
	 * 
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * 
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of 'Comparable'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public  T1 caseComparable(Comparable object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of 'Position'.
	 * 
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * 
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of 'Position'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T1 casePosition(Position object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of 'Range'.
	 * 
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * 
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of 'Range'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T1 caseRange(Range object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of 'Source'.
	 * 
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * 
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of 'Source'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T1 caseSource(Source object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of 'IMarked'.
	 * 
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * 
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of 'IMarked'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T1 caseIMarked(Marked object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of 'Marked'.
	 * 
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * 
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of 'Marked'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T1 caseMarked(org.nasdanika.ncore.Marked object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of 'EObject'.
	 * 
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch, but this is the last case anyway.
	 * 
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of 'EObject'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject)
	 * @generated
	 */
	@Override
	public T1 defaultCase(EObject object) {
		return null;
	}

} //SourceSwitch




© 2015 - 2024 Weber Informatics LLC | Privacy Policy