public final class Debug extends Object
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.
| Modifier and Type | Field and Description |
|---|---|
static boolean |
enabled |
| Modifier and Type | Method and Description |
|---|---|
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.
|
public static final boolean enabled
public static void assertTrue(boolean b,
String s)
public static boolean isSorted(int[] array)
array - the arraypublic static boolean isInArray(Object[] array, Object find)
array - the arrayfind - the Object to findpublic static boolean isInArray(String[] array, String find)
array - the arrayfind - the string to findpublic static boolean isInArray(int[] array,
int find)
array - the arrayfind - the int to find in the arraypublic static void println(String x)
x - the stringpublic static void println(Object x)
x - the objectpublic static void printArray(Object[] x)
x - the arraypublic static String printArrayToString(Object[] x)
x - the arraypublic static String printArrayToString(int[] x)
x - the arraypublic static void printArray(int[] x)
x - the arrayCopyright © 2002–2017 CoreMedia AG. All rights reserved.