edu.princeton.toy.lang
public class TDefaultExceptionHandler extends java.lang.Object implements TExceptionHandler
PROMISCUOUS_EXCEPTION_HANDLER, PRUDISH_EXCEPTION_HANDLER| Constructor and Description |
|---|
TDefaultExceptionHandler()
Instantiates a new TDefaultExceptionHandler in an exceptionless state.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
getWillThrow(int index)
Gets wheter or not the handler should throw a raised exception of the specified type.
|
boolean |
getWillThrow(TExceptionType type)
Gets wheter or not the handler should throw a raised exception of the specified type.
|
void |
raise(TExceptionType type)
Throws a TException with the specified type iff the specified exception was not set to be
ignored.
|
void |
setWillThrow(int index,
boolean willThrow)
Sets wheter or not the handler should throw a raised exception of the specified type.
|
void |
setWillThrow(TExceptionType type,
boolean willThrow)
Sets wheter or not the handler should throw a raised exception of the specified type.
|
public TDefaultExceptionHandler()
public void raise(TExceptionType type) throws TException
raise in interface TExceptionHandlertype - The type of exceptional condition that was raised in the Virtual Machine.TExceptionpublic boolean getWillThrow(int index)
getWillThrow in interface TExceptionHandlerindex - The index of type (in the TExceptionType.TYPES array) in question. An invalid
value will result in an ArrayIndexOutOfBoundsException.TExceptionType.TYPESpublic boolean getWillThrow(TExceptionType type)
getWillThrow in interface TExceptionHandlertype - The type in question. A null value will result in a NullPointerException.TExceptionType.TYPESpublic void setWillThrow(TExceptionType type, boolean willThrow)
type - The type in question. A null value will result in a NullPointerException.willThrow - Wheter or not the handler should throw exceptions of this type.TExceptionType.TYPESpublic void setWillThrow(int index,
boolean willThrow)
index - The index of type (in the TExceptionType.TYPES array) in question. An invalid
value will result in an ArrayIndexOutOfBoundsException.willThrow - Wheter or not the handler should throw exceptions of this type.TExceptionType.TYPES