org.ow2.asmdex.structureWriter
Class TryCatch

java.lang.Object
  extended by org.ow2.asmdex.structureWriter.TryCatch

public class TryCatch
extends java.lang.Object

Contains the data of a Try/Catch structure for the Writer. Two structures are considered equals if the Start Label is the same. A structure can't hold more than one CatchAll (ExceptionHandler with a Null Type), and raises an Exception if one try to add more than one.

Author:
Julien Névo

Constructor Summary
TryCatch(Label start, Label end, ExceptionHandler exceptionHandler)
          Constructor of a Try/Catch structure.
 
Method Summary
 void addExceptionHandler(ExceptionHandler exceptionHandler)
          Adds an ExceptionHandler to the list.
 void addExceptionHandlers(java.util.ArrayList<ExceptionHandler> exceptionHandlers)
          Adds Exception Handlers to the list of the current structure.
 Label getCatchAllHandler()
          Returns the CatchAll Handler, or Null if no Exception Handler uses one.
 Label getEnd()
          Returns the End Label (exclusive).
 java.util.ArrayList<ExceptionHandler> getExceptionHandlers()
          Returns the List of ExceptionHandlers.
 int getNbExceptionHandler()
          Returns the count of Exception Handler, CatchAll included.
 Label getStart()
          Returns the Start Label.
 boolean hasCatchAll()
          True if one of the Exception Handler has a Catch All.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TryCatch

public TryCatch(Label start,
                Label end,
                ExceptionHandler exceptionHandler)
Constructor of a Try/Catch structure.

Parameters:
start - Label pointing on the Instruction starting the try/catch block.
end - Label pointing on the Instruction following the end of the try/catch block.
exceptionHandler - Label pointing on the Handler of the exception.
Method Detail

addExceptionHandler

public void addExceptionHandler(ExceptionHandler exceptionHandler)
Adds an ExceptionHandler to the list.

Parameters:
exceptionHandler - the ExceptionHandler to add to the list.

addExceptionHandlers

public void addExceptionHandlers(java.util.ArrayList<ExceptionHandler> exceptionHandlers)
Adds Exception Handlers to the list of the current structure.

Parameters:
exceptionHandlers -

getStart

public Label getStart()
Returns the Start Label.

Returns:
the Start Label.

getEnd

public Label getEnd()
Returns the End Label (exclusive).

Returns:
the End Label (exclusive).

getExceptionHandlers

public java.util.ArrayList<ExceptionHandler> getExceptionHandlers()
Returns the List of ExceptionHandlers.

Returns:
the List of ExceptionHandlers.

getNbExceptionHandler

public int getNbExceptionHandler()
Returns the count of Exception Handler, CatchAll included.

Returns:
the count of Exception Handler, CatchAll included.

hasCatchAll

public boolean hasCatchAll()
True if one of the Exception Handler has a Catch All.

Returns:
true if one of the Exception Handler has a Catch All.

getCatchAllHandler

public Label getCatchAllHandler()
Returns the CatchAll Handler, or Null if no Exception Handler uses one.

Returns:
the CatchAll Handler, or Null if no Exception Handler uses one.