net.jangaroo.jooc
Class Debug

java.lang.Object
  extended by net.jangaroo.jooc.Debug

public final class Debug
extends java.lang.Object

A class to provide debug facilities in java.

For assertTrue, to avoid evaluation of the boolean expression with debugging turned off on sun's java interpreter and with sun's javac use the following:

     Debug.assertTrue(Debug.enabled && anExpression, "error message");
 

The short-cut semantics of '&&' will guarantee that anExpression will not be evaluated if enabled is set to false.

Debug.print also won't print its argument if Debug.enabled is false. If the generation of the argument is already costly, you have to wrap it in an if-statement.

Author:
Andreas Gawecki

Field Summary
static boolean enabled
           
 
Method Summary
static void assertTrue(boolean b, java.lang.String s)
           
static boolean isInArray(int[] array, int find)
          Method to use to assert that an array contains an int.
static boolean isInArray(java.lang.Object[] array, java.lang.Object find)
          Method to use to assert that an array contains an object.
static boolean isInArray(java.lang.String[] array, java.lang.String find)
          Method to use to assert that an array contains a String.
static boolean isSorted(int[] array)
          Method to use to assert that an array is sorted
static void printArray(int[] x)
          Print an Array.
static void printArray(java.lang.Object[] x)
          Print an Array.
static java.lang.String printArrayToString(int[] x)
          Print an int Array to a String.
static java.lang.String printArrayToString(java.lang.Object[] x)
          Print an Object Array to a String.
static void println(java.lang.Object x)
          Print an Object, and then finish the line.
static void println(java.lang.String x)
          Print a String, and then finish the line.
static void printStackTrace()
          prints stack trace where you are
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

enabled

public static boolean enabled
Method Detail

assertTrue

public static final void assertTrue(boolean b,
                                    java.lang.String s)

isSorted

public static boolean isSorted(int[] array)
Method to use to assert that an array is sorted


isInArray

public static boolean isInArray(java.lang.Object[] array,
                                java.lang.Object find)
Method to use to assert that an array contains an object. Uses ==


isInArray

public static boolean isInArray(java.lang.String[] array,
                                java.lang.String find)
Method to use to assert that an array contains a String. Uses equals.


isInArray

public static boolean isInArray(int[] array,
                                int find)
Method to use to assert that an array contains an int.


println

public static final void println(java.lang.String x)
Print a String, and then finish the line.


println

public static final void println(java.lang.Object x)
Print an Object, and then finish the line.


printArray

public static final void printArray(java.lang.Object[] x)
Print an Array.


printArrayToString

public static final java.lang.String printArrayToString(java.lang.Object[] x)
Print an Object Array to a String.


printArrayToString

public static final java.lang.String printArrayToString(int[] x)
Print an int Array to a String.


printArray

public static final void printArray(int[] x)
Print an Array.


printStackTrace

public static void printStackTrace()
prints stack trace where you are



Copyright © 2002-2010 CoreMedia AG. All Rights Reserved.