net.jangaroo.jooc
Class Debug

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

public final class Debug
extends 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, String s)
           
static boolean isInArray(int[] array, int find)
          Method to use to assert that an array contains an int.
static boolean isInArray(Object[] array, Object find)
          Method to use to assert that an array contains an object.
static boolean isInArray(String[] array, 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(Object[] x)
          Print an Array.
static String printArrayToString(int[] x)
          Print an int Array to a String.
static String printArrayToString(Object[] x)
          Print an Object Array to a String.
static void println(Object x)
          Print an Object, and then finish the line.
static void println(String x)
          Print a String, and then finish the line.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

enabled

public static final boolean enabled
See Also:
Constant Field Values
Method Detail

assertTrue

public static void assertTrue(boolean b,
                              String s)

isSorted

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


isInArray

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


isInArray

public static boolean isInArray(String[] array,
                                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 void println(String x)
Print a String, and then finish the line.


println

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


printArray

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


printArrayToString

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


printArrayToString

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


printArray

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



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