joeq.Compiler.Quad
Class ExceptionHandlerList

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList
          extended by joeq.Compiler.Quad.ExceptionHandlerList
All Implemented Interfaces:
Iterable, Collection, List, List.ExceptionHandler

public class ExceptionHandlerList
extends AbstractList
implements List.ExceptionHandler

Holds a list of exception handlers that protect a basic block. It includes a reference to a parent exception handler list, to handle nesting of exception handlers. These form a tree structure where each node has a pointer to its parent.

Version:
$Id: ExceptionHandlerList.java 1931 2004-09-22 22:17:47Z joewhaley $
Author:
John Whaley
See Also:
ExceptionHandler, ExceptionHandlerIterator

Field Summary
static ExceptionHandlerList EMPTY
           
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
ExceptionHandlerList(ExceptionHandler exception_handler)
          Creates new ExceptionHandlerList containing the given exception handler and no parent set.
ExceptionHandlerList(ExceptionHandler exception_handler, ExceptionHandlerList parent)
          Creates new ExceptionHandlerList containing the given exception handler and parent set.
 
Method Summary
 ListIterator.ExceptionHandler exceptionHandlerIterator()
          Return an iteration over the handlers in this set (and the handlers in parent sets).
 Object get(int index)
           
static ExceptionHandlerList getEmptyList()
           
 ExceptionHandler getExceptionHandler(int index)
           
 ExceptionHandler getHandler()
          Return the handler in this set.
 ExceptionHandlerList getParent()
          Return the parent set of exception handlers, or null if this set doesn't have a parent.
 Iterator iterator()
           
 ListIterator listIterator()
           
 List.ExceptionHandler mayCatch(Collection exTypes)
          Returns the list of exception handlers in this list that MAY catch the given exception type.
 List.ExceptionHandler mayCatch(jq_Class exType)
          Returns the list of exception handlers in this list that MAY catch the given exception type.
 ExceptionHandler mustCatch(jq_Class exType)
          Returns the first exception handler in the list that MUST catch an exception of the given type, or null if there is no handler that must catch it.
 void setHandler(ExceptionHandler eh)
           
 void setParent(ExceptionHandlerList p)
           
 int size()
           
 
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, equals, hashCode, indexOf, lastIndexOf, listIterator, remove, removeRange, set, subList
 
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, equals, hashCode, indexOf, isEmpty, lastIndexOf, listIterator, remove, remove, removeAll, retainAll, set, subList, toArray, toArray
 

Field Detail

EMPTY

public static final ExceptionHandlerList EMPTY
Constructor Detail

ExceptionHandlerList

public ExceptionHandlerList(ExceptionHandler exception_handler)
Creates new ExceptionHandlerList containing the given exception handler and no parent set.

Parameters:
exception_handler - exception handler to include in the set.

ExceptionHandlerList

public ExceptionHandlerList(ExceptionHandler exception_handler,
                            ExceptionHandlerList parent)
Creates new ExceptionHandlerList containing the given exception handler and parent set.

Parameters:
exception_handler - exception handler to include in the set.
parent - the parent set of exception handlers.
Method Detail

getHandler

public ExceptionHandler getHandler()
Return the handler in this set. Doesn't include parent handlers.

Returns:
the handler in this set, without parent handlers.

setHandler

public void setHandler(ExceptionHandler eh)

getParent

public ExceptionHandlerList getParent()
Return the parent set of exception handlers, or null if this set doesn't have a parent.

Returns:
the parent set of exception handlers, or null if this set doesn't have a parent.

setParent

public void setParent(ExceptionHandlerList p)

mustCatch

public ExceptionHandler mustCatch(jq_Class exType)
Returns the first exception handler in the list that MUST catch an exception of the given type, or null if there is no handler that must catch it.

Returns:
the handler that must catch the exception type, or null if there is no such handler

mayCatch

public List.ExceptionHandler mayCatch(jq_Class exType)
Returns the list of exception handlers in this list that MAY catch the given exception type.

Returns:
the list of handlers that may catch the exception type

mayCatch

public List.ExceptionHandler mayCatch(Collection exTypes)
Returns the list of exception handlers in this list that MAY catch the given exception type.

Returns:
the list of handlers that may catch the exception type

exceptionHandlerIterator

public ListIterator.ExceptionHandler exceptionHandlerIterator()
Return an iteration over the handlers in this set (and the handlers in parent sets). Handlers are returned in the correct order (this set, followed by parent sets.)

Specified by:
exceptionHandlerIterator in interface List.ExceptionHandler
Returns:
an iteration over the handlers in this set (and the handlers in parent sets) in correct order.

iterator

public Iterator iterator()
Specified by:
iterator in interface Iterable
Specified by:
iterator in interface Collection
Specified by:
iterator in interface List
Overrides:
iterator in class AbstractList

listIterator

public ListIterator listIterator()
Specified by:
listIterator in interface List
Overrides:
listIterator in class AbstractList

getExceptionHandler

public ExceptionHandler getExceptionHandler(int index)
Specified by:
getExceptionHandler in interface List.ExceptionHandler

get

public Object get(int index)
Specified by:
get in interface List
Specified by:
get in class AbstractList

size

public int size()
Specified by:
size in interface Collection
Specified by:
size in interface List
Specified by:
size in class AbstractCollection

getEmptyList

public static ExceptionHandlerList getEmptyList()


Copyright © 2001-2008 John Whaley. All Rights Reserved.