KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > SOFA > SOFAnode > Util > Debug


1 /* $Id: Debug.java,v 1.1.1.1 2003/02/11 16:19:41 bures Exp $ */
2
3 package SOFA.SOFAnode.Util;
4
5 /**
6  * The debug enabling class. If the {@link Debug#debug} is set to number higher
7  * than 0, all methods prints the arguments, otherwise the output is skipped.
8  * The set of methods allowing specification of a debug level to which the message
9  * is intended is also provided. Supposed use of debug level:
10  * 0 - no debug info
11  * 1 - only high level debug about progress
12  * 2 - progress of complicated methods
13  * 3 - all debug info
14  *
15  * @author Stanislav Visnovsky
16  * @version 1.0.0
17 */

18 class Debug {
19 /**
20  * Indication, if the debugging stuff should be send to the standard output
21 */

22     public static int debug = 0;
23
24 /**
25  * Print a string to the standard output and the new line.
26  *
27  * @author Stanislav Visnovsky
28  * @version 1.0.0
29  * @param a a string to print
30 */

31     public static void println( String JavaDoc a ) {
32     if( debug>0 ) System.out.println( a );
33     }
34
35     public static void println( int level, String JavaDoc a ) {
36     if( debug>=level ) System.out.println( a );
37     }
38
39 /**
40  * Print a new line to the standard output.
41  *
42  * @author Stanislav Visnovsky
43  * @version 1.0.0
44 */

45     public static void println() {
46     if( debug>0 ) System.out.println();
47     }
48
49     public static void println(int level) {
50     if( debug>=level ) System.out.println();
51     }
52
53 /**
54  * Print an integer to the standard output and the new line.
55  *
56  * @author Stanislav Visnovsky
57  * @version 1.0.0
58  * @param a an integer to print
59  * @param level debug level the message should be printed at
60 */

61     public static void println( int level, int a ) {
62     if( debug>=level ) System.out.println( a );
63     }
64
65 /**
66  * Print a string to the standard output.
67  *
68  * @author Stanislav Visnovsky
69  * @version 1.0.0
70  * @param a a string to print
71 */

72     public static void print( String JavaDoc a ) {
73     if( debug>0 ) System.out.print( a );
74     }
75
76     public static void print( int level, String JavaDoc a ) {
77     if( debug>=level ) System.out.print( a );
78     }
79
80 /**
81  * Print an integer to the standard output.
82  *
83  * @author Stanislav Visnovsky
84  * @version 1.0.0
85  * @param a an integer to print
86  * @param level debug level the message should be printed at
87 */

88     public static void print( int level, int a ) {
89     if( debug>=level ) System.out.print( a );
90     }
91 }
92
Popular Tags