Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2005-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.examples.extlibrary.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 EXTLibrarySwitch<T> {
  
The cached model package

Generated:
 
   protected static EXTLibraryPackage modelPackage;

  
Creates an instance of the switch.

Generated:
 
   public EXTLibrarySwitch()
   {
     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 .:
      {
        Book book = (Book)theEObject;
        T result = caseBook(book);
        if (result == nullresult = caseCirculatingItem(book);
        if (result == nullresult = caseItem(book);
        if (result == nullresult = caseLendable(book);
        if (result == nullresult = defaultCase(theEObject);
        return result;
      }
      case .:
      {
        Library library = (Library)theEObject;
        T result = caseLibrary(library);
        if (result == nullresult = caseAddressable(library);
        if (result == nullresult = defaultCase(theEObject);
        return result;
      }
      case .:
      {
        Writer writer = (Writer)theEObject;
        T result = caseWriter(writer);
        if (result == nullresult = casePerson(writer);
        if (result == nullresult = caseAddressable(writer);
        if (result == nullresult = defaultCase(theEObject);
        return result;
      }
      case .:
      {
        Item item = (Item)theEObject;
        T result = caseItem(item);
        if (result == nullresult = defaultCase(theEObject);
        return result;
      }
      case .:
      {
        Lendable lendable = (Lendable)theEObject;
        T result = caseLendable(lendable);
        if (result == nullresult = defaultCase(theEObject);
        return result;
      }
      {
        CirculatingItem circulatingItem = (CirculatingItem)theEObject;
        T result = caseCirculatingItem(circulatingItem);
        if (result == nullresult = caseItem(circulatingItem);
        if (result == nullresult = caseLendable(circulatingItem);
        if (result == nullresult = defaultCase(theEObject);
        return result;
      }
      case .:
      {
        Periodical periodical = (Periodical)theEObject;
        T result = casePeriodical(periodical);
        if (result == nullresult = caseItem(periodical);
        if (result == nullresult = defaultCase(theEObject);
        return result;
      }
      {
        AudioVisualItem audioVisualItem = (AudioVisualItem)theEObject;
        T result = caseAudioVisualItem(audioVisualItem);
        if (result == nullresult = caseCirculatingItem(audioVisualItem);
        if (result == nullresult = caseItem(audioVisualItem);
        if (result == nullresult = caseLendable(audioVisualItem);
        if (result == nullresult = defaultCase(theEObject);
        return result;
      }
      {
        BookOnTape bookOnTape = (BookOnTape)theEObject;
        T result = caseBookOnTape(bookOnTape);
        if (result == nullresult = caseAudioVisualItem(bookOnTape);
        if (result == nullresult = caseCirculatingItem(bookOnTape);
        if (result == nullresult = caseItem(bookOnTape);
        if (result == nullresult = caseLendable(bookOnTape);
        if (result == nullresult = defaultCase(theEObject);
        return result;
      }
      {
        VideoCassette videoCassette = (VideoCassette)theEObject;
        T result = caseVideoCassette(videoCassette);
        if (result == nullresult = caseAudioVisualItem(videoCassette);
        if (result == nullresult = caseCirculatingItem(videoCassette);
        if (result == nullresult = caseItem(videoCassette);
        if (result == nullresult = caseLendable(videoCassette);
        if (result == nullresult = defaultCase(theEObject);
        return result;
      }
      case .:
      {
        Borrower borrower = (Borrower)theEObject;
        T result = caseBorrower(borrower);
        if (result == nullresult = casePerson(borrower);
        if (result == nullresult = caseAddressable(borrower);
        if (result == nullresult = defaultCase(theEObject);
        return result;
      }
      case .:
      {
        Person person = (Person)theEObject;
        T result = casePerson(person);
        if (result == nullresult = caseAddressable(person);
        if (result == nullresult = defaultCase(theEObject);
        return result;
      }
      case .:
      {
        Employee employee = (Employee)theEObject;
        T result = caseEmployee(employee);
        if (result == nullresult = casePerson(employee);
        if (result == nullresult = caseAddressable(employee);
        if (result == nullresult = defaultCase(theEObject);
        return result;
      }
      {
        Addressable addressable = (Addressable)theEObject;
        T result = caseAddressable(addressable);
        if (result == nullresult = defaultCase(theEObject);
        return result;
      }
      defaultreturn defaultCase(theEObject);
    }
  }

  
Returns the result of interpreting the object as an instance of 'Book'. 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 'Book'.
See also:
doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
Generated:
  public T caseBook(Book object)
  {
    return null;
  }

  
Returns the result of interpreting the object as an instance of 'Library'. 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 'Library'.
See also:
doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
Generated:
  public T caseLibrary(Library object)
  {
    return null;
  }

  
Returns the result of interpreting the object as an instance of 'Writer'. 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 'Writer'.
See also:
doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
Generated:
  public T caseWriter(Writer object)
  {
    return null;
  }

  
Returns the result of interpreting the object as an instance of 'Item'. 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 'Item'.
See also:
doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
Generated:
  public T caseItem(Item object)
  {
    return null;
  }

  
Returns the result of interpreting the object as an instance of 'Lendable'. 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 'Lendable'.
See also:
doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
Generated:
  public T caseLendable(Lendable object)
  {
    return null;
  }

  
Returns the result of interpreting the object as an instance of 'Circulating Item'. 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 'Circulating Item'.
See also:
doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
Generated:
  public T caseCirculatingItem(CirculatingItem object)
  {
    return null;
  }

  
Returns the result of interpreting the object as an instance of 'Periodical'. 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 'Periodical'.
See also:
doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
Generated:
  public T casePeriodical(Periodical object)
  {
    return null;
  }

  
Returns the result of interpreting the object as an instance of 'Audio Visual Item'. 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 'Audio Visual Item'.
See also:
doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
Generated:
  public T caseAudioVisualItem(AudioVisualItem object)
  {
    return null;
  }

  
Returns the result of interpreting the object as an instance of 'Book On Tape'. 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 'Book On Tape'.
See also:
doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
Generated:
  public T caseBookOnTape(BookOnTape object)
  {
    return null;
  }

  
Returns the result of interpreting the object as an instance of 'Video Cassette'. 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 'Video Cassette'.
See also:
doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
Generated:
  public T caseVideoCassette(VideoCassette object)
  {
    return null;
  }

  
Returns the result of interpreting the object as an instance of 'Borrower'. 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 'Borrower'.
See also:
doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
Generated:
  public T caseBorrower(Borrower object)
  {
    return null;
  }

  
Returns the result of interpreting the object as an instance of 'Person'. 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 'Person'.
See also:
doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
Generated:
  public T casePerson(Person object)
  {
    return null;
  }

  
Returns the result of interpreting the object as an instance of 'Employee'. 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 'Employee'.
See also:
doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
Generated:
  public T caseEmployee(Employee object)
  {
    return null;
  }

  
Returns the result of interpreting the object as an instance of 'Addressable'. 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 'Addressable'.
See also:
doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
Generated:
  public T caseAddressable(Addressable 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;
  }
//EXTLibrarySwitch
New to GrepCode? Check out our FAQ X