Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2002-2006 IBM Corporation and others. 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: IBM - Initial API and implementation
 
 package org.eclipse.emf.java.util;
 
 
 import java.util.List;
 
The Switch for the model's inheritance hierarchy. It supports the call 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.

 
 public class JavaSwitch<T> {
  
The cached model package

Generated:
 
   protected static JavaPackage modelPackage;

  
Creates an instance of the switch.

Generated:
 
   public JavaSwitch()
   {
     if ( == null)
     {
     }
   }

  
Calls caseXXX for each class of the model until one returns a non null result; it yields that result.

Returns:
the first non-null result returned by a caseXXX call.
Generated:
 
   public T doSwitch(EObject theEObject)
   {
     return doSwitch(theEObject.eClass(), theEObject);
   }

  
Calls caseXXX for each class of the model until one returns a non null result; it yields that result.

Returns:
the first non-null result returned by a caseXXX call.
Generated:
 
   protected T doSwitch(EClass theEClassEObject theEObject)
   {
     if (theEClass.eContainer() == )
     {
       return doSwitch(theEClass.getClassifierID(), theEObject);
     }
     else
     {
       List<EClasseSuperTypes = theEClass.getESuperTypes();
       return
         eSuperTypes.isEmpty() ?
           defaultCase(theEObject) :
           doSwitch(eSuperTypes.get(0), theEObject);
     }
   }

  
Calls caseXXX for each class of the model until one returns a non null result; it yields that result.

Returns:
the first non-null result returned by a caseXXX call.
Generated:
 
   protected T doSwitch(int classifierIDEObject theEObject)
  {
    switch (classifierID)
    {
      case .:
      {
        JClass jClass = (JClass)theEObject;
        T result = caseJClass(jClass);
        if (result == nullresult = caseJMember(jClass);
        if (result == nullresult = caseJModelElement(jClass);
        if (result == nullresult = defaultCase(theEObject);
        return result;
      }
      {
        JCompilationUnit jCompilationUnit = (JCompilationUnit)theEObject;
        T result = caseJCompilationUnit(jCompilationUnit);
        if (result == nullresult = caseJModelElement(jCompilationUnit);
        if (result == nullresult = defaultCase(theEObject);
        return result;
      }
      case .:
      {
        JField jField = (JField)theEObject;
        T result = caseJField(jField);
        if (result == nullresult = caseJMember(jField);
        if (result == nullresult = caseJModelElement(jField);
        if (result == nullresult = defaultCase(theEObject);
        return result;
      }
      case .:
      {
        JInitializer jInitializer = (JInitializer)theEObject;
        T result = caseJInitializer(jInitializer);
        if (result == nullresult = caseJMember(jInitializer);
        if (result == nullresult = caseJModelElement(jInitializer);
        if (result == nullresult = defaultCase(theEObject);
        return result;
      }
      case .:
      {
        JMember jMember = (JMember)theEObject;
        T result = caseJMember(jMember);
        if (result == nullresult = caseJModelElement(jMember);
        if (result == nullresult = defaultCase(theEObject);
        return result;
      }
      case .:
      {
        JMethod jMethod = (JMethod)theEObject;
        T result = caseJMethod(jMethod);
        if (result == nullresult = caseJMember(jMethod);
        if (result == nullresult = caseJModelElement(jMethod);
        if (result == nullresult = defaultCase(theEObject);
        return result;
      }
      case .:
      {
        JModelElement jModelElement = (JModelElement)theEObject;
        T result = caseJModelElement(jModelElement);
        if (result == nullresult = defaultCase(theEObject);
        return result;
      }
      case .:
      {
        JPackage jPackage = (JPackage)theEObject;
        T result = caseJPackage(jPackage);
        if (result == nullresult = caseJModelElement(jPackage);
        if (result == nullresult = defaultCase(theEObject);
        return result;
      }
      case .:
      {
        JParameter jParameter = (JParameter)theEObject;
        T result = caseJParameter(jParameter);
        if (result == nullresult = caseJModelElement(jParameter);
        if (result == nullresult = defaultCase(theEObject);
        return result;
      }
      defaultreturn defaultCase(theEObject);
    }
  }

  
Returns the result of interpreting the object as an instance of 'JClass'. This implementation returns null; returning a non-null result will terminate the switch.

Parameters:
object the target of the switch.
Returns:
the result of interpreting the object as an instance of 'JClass'.
See also:
doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
Generated:
  public T caseJClass(JClass object)
  {
    return null;
  }

  
Returns the result of interpreting the object as an instance of 'JModel Element'. This implementation returns null; returning a non-null result will terminate the switch.

Parameters:
object the target of the switch.
Returns:
the result of interpreting the object as an instance of 'JModel Element'.
See also:
doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
Generated:
  public T caseJModelElement(JModelElement object)
  {
    return null;
  }

  
Returns the result of interpreting the object as an instance of 'JMember'. This implementation returns null; returning a non-null result will terminate the switch.

Parameters:
object the target of the switch.
Returns:
the result of interpreting the object as an instance of 'JMember'.
See also:
doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
Generated:
  public T caseJMember(JMember object)
  {
    return null;
  }

  
Returns the result of interpreting the object as an instance of 'JCompilation Unit'. This implementation returns null; returning a non-null result will terminate the switch.

Parameters:
object the target of the switch.
Returns:
the result of interpreting the object as an instance of 'JCompilation Unit'.
See also:
doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
Generated:
  {
    return null;
  }

  
Returns the result of interpreting the object as an instance of 'JField'. This implementation returns null; returning a non-null result will terminate the switch.

Parameters:
object the target of the switch.
Returns:
the result of interpreting the object as an instance of 'JField'.
See also:
doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
Generated:
  public T caseJField(JField object)
  {
    return null;
  }

  
Returns the result of interpreting the object as an instance of 'JInitializer'. This implementation returns null; returning a non-null result will terminate the switch.

Parameters:
object the target of the switch.
Returns:
the result of interpreting the object as an instance of 'JInitializer'.
See also:
doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
Generated:
  public T caseJInitializer(JInitializer object)
  {
    return null;
  }

  
Returns the result of interpreting the object as an instance of 'JMethod'. This implementation returns null; returning a non-null result will terminate the switch.

Parameters:
object the target of the switch.
Returns:
the result of interpreting the object as an instance of 'JMethod'.
See also:
doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
Generated:
  public T caseJMethod(JMethod object)
  {
    return null;
  }

  
Returns the result of interpreting the object as an instance of 'JParameter'. This implementation returns null; returning a non-null result will terminate the switch.

Parameters:
object the target of the switch.
Returns:
the result of interpreting the object as an instance of 'JParameter'.
See also:
doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
Generated:
  public T caseJParameter(JParameter object)
  {
    return null;
  }

  
Returns the result of interpreting the object as an instance of 'JPackage'. This implementation returns null; returning a non-null result will terminate the switch.

Parameters:
object the target of the switch.
Returns:
the result of interpreting the object as an instance of 'JPackage'.
See also:
doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
Generated:
  public T caseJPackage(JPackage 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.

Parameters:
object the target of the switch.
Returns:
the result of interpreting the object as an instance of 'EObject'.
See also:
doSwitch(org.eclipse.emf.ecore.EObject)
Generated:
  public T defaultCase(EObject object)
  {
    return null;
  }
//JavaSwitch
New to GrepCode? Check out our FAQ X