uk.ac.leeds.ccg.andyt.grids.utilities
Class ErrorHandler

java.lang.Object
  extended by uk.ac.leeds.ccg.andyt.grids.utilities.ErrorHandler
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
ESRIAsciiGridExporter, ESRIAsciiGridImporter, Grid2DSquareCellAbstract, Grid2DSquareCellProcessor, GridStatisticsAbstract, ImageExporter, Run

public abstract class ErrorHandler
extends java.lang.Object
implements java.io.Serializable

A class to be extended by classes that handle runtime errors such as java.lang.OutOfMemroyError TODO: Add a constant int TYPE which can be used to switch between different types of this. Handling for NumberFormatExceptions and ArithmeticExceptions in calculations

See Also:
Serialized Form

Field Summary
static boolean handleOutOfMemoryErrorFalse
           
static boolean handleOutOfMemoryErrorTrue
           
protected  int[] memoryReserve
          Reserve memory to be cleared when dealing with java.lang.OutOfMemoryErrors.
 
Constructor Summary
ErrorHandler()
           
 
Method Summary
 void clearMemoryReserve()
          Clears memoryReserve by setting it to null and calling the garbage collector.
 void initMemoryReserve()
          Initialises memoryReserve as an array of size 2000000.
 void initMemoryReserve(int size)
          Initialises memoryReserve as an array of size.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

handleOutOfMemoryErrorFalse

public static final boolean handleOutOfMemoryErrorFalse
See Also:
Constant Field Values

handleOutOfMemoryErrorTrue

public static final boolean handleOutOfMemoryErrorTrue
See Also:
Constant Field Values

memoryReserve

protected int[] memoryReserve
Reserve memory to be cleared when dealing with java.lang.OutOfMemoryErrors.

Constructor Detail

ErrorHandler

public ErrorHandler()
Method Detail

initMemoryReserve

public final void initMemoryReserve(int size)
Initialises memoryReserve as an array of size.

Parameters:
size - The size that memoryReserve is initialised to.

initMemoryReserve

public final void initMemoryReserve()
Initialises memoryReserve as an array of size 2000000. More than 1000000 is needed for caching and clearing chunks in Grid2DSquareCellAbstract constructors.


clearMemoryReserve

public final void clearMemoryReserve()
Clears memoryReserve by setting it to null and calling the garbage collector.