prog.utils
Class Debug

java.lang.Object
  |
  +--prog.utils.Debug

public class Debug
extends java.lang.Object


Method Summary
static java.io.PrintWriter getPrintWriter()
          Returns a PrintWriter, useful for saving exception stack trace to filename.
static boolean isOn()
          Returns whether debug has been turned on.
static void off()
          Stops Debug.println() statements from writing to file or stdout.
static void on()
          Allows Debug.println() statements to write to file or stdout.
static void print(java.lang.String s)
          Writes s to file (in style of System.out.print(s)) if debug has been turned on (Debug.setDebug(true) or Debug.on()) and to stdout if display has been turned on (Debug.setDisplay(true)).
static void println()
          Writes a newline.
static void println(boolean b)
          Writes a boolean.
static void println(byte b)
          Writes a byte.
static void println(char c)
          Writes a char.
static void println(double d)
          Writes a double.
static void println(java.lang.Exception e)
          Writes the stack trace of e to filename.
static void println(float f)
          Writes a float.
static void println(int i)
          Writes an int.
static void println(java.lang.String s)
          Writes s to file (in style of System.out.println(s)) if debug has been turned on (Debug.setDebug(true) or Debug.on()) and to stdout if display has been turned on (Debug.setDisplay(true)).
static void setDebug(boolean state)
          Sets whether Debug.println() statements can write to file or stdout.
static void setDisplay(boolean state)
          Sets whether Debug.println() statements can write to stdout.
static void setFilename(java.lang.String fname)
          Specifies the filename to use for writing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

println

public static void println(java.lang.Exception e)
Writes the stack trace of e to filename.

getPrintWriter

public static java.io.PrintWriter getPrintWriter()
Returns a PrintWriter, useful for saving exception stack trace to filename. See Exception.printStackTrace(PrintWriter). Also used by println(Exception).

on

public static void on()
Allows Debug.println() statements to write to file or stdout.

off

public static void off()
Stops Debug.println() statements from writing to file or stdout.

setDebug

public static void setDebug(boolean state)
Sets whether Debug.println() statements can write to file or stdout.

setDisplay

public static void setDisplay(boolean state)
Sets whether Debug.println() statements can write to stdout. This method only has effect if general writing via Debug.setDebug(true) has been specified.

isOn

public static boolean isOn()
Returns whether debug has been turned on. Sample use:
if (Debug.isOn()) {
// code to perform that does not use Debug.println()
}

print

public static void print(java.lang.String s)
Writes s to file (in style of System.out.print(s)) if debug has been turned on (Debug.setDebug(true) or Debug.on()) and to stdout if display has been turned on (Debug.setDisplay(true)).

println

public static void println(java.lang.String s)
Writes s to file (in style of System.out.println(s)) if debug has been turned on (Debug.setDebug(true) or Debug.on()) and to stdout if display has been turned on (Debug.setDisplay(true)).

println

public static void println()
Writes a newline. See println(String) for similar details.

println

public static void println(int i)
Writes an int. See println(String) for similar details.

println

public static void println(boolean b)
Writes a boolean. See println(String) for similar details.

println

public static void println(double d)
Writes a double. See println(String) for similar details.

println

public static void println(float f)
Writes a float. See println(String) for similar details.

println

public static void println(char c)
Writes a char. See println(String) for similar details.

println

public static void println(byte b)
Writes a byte. See println(String) for similar details.

setFilename

public static void setFilename(java.lang.String fname)
Specifies the filename to use for writing. If not used, the default filename is debug.txt.