KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > SOFA > SOFAnode > Made > CodeGen > Debug


1 /* $Id: Debug.java,v 1.2 2004/05/20 14:23:51 bures Exp $ */
2 package SOFA.SOFAnode.Made.CodeGen;
3
4 import SOFA.SOFAnode.Made.TIR.Contained;
5 import SOFA.SOFAnode.Made.TIR.Identification;
6  
7 /** Debugging messages.
8   * Switch it on by java property codegen.debug=yes
9   */

10 public class Debug {
11   /** Print message */
12   public static void println(String JavaDoc msg) {
13     if ((System.getProperty("codegen.debug", "no").compareTo("yes"))==0)
14       System.out.println("*** "+msg+" ***");
15   }
16   /** Test if debuging is set */
17   public static boolean isDebug() {
18     if ((System.getProperty("codegen.debug", "no").compareTo("yes"))==0)
19       return true;
20     return false;
21   }
22   /** Print object */
23   public static void println(Object JavaDoc obj) {
24     if ((System.getProperty("codegen.debug", "no").compareTo("yes"))==0)
25       System.out.println("*** "+obj.toString()+" ***");
26   }
27   /** Print array of objects */
28   public static void println(Object JavaDoc[] obj) {
29     if ((System.getProperty("codegen.debug", "no").compareTo("yes"))==0) {
30       System.out.println("***");
31       for (int i=0;i<obj.length;i++) {
32         System.out.println(obj[i].toString());
33       }
34       System.out.println("***");
35     }
36   }
37
38   /** Print array of TIR Contained objects */
39   public static void println(Contained[] obj) {
40     if ((System.getProperty("codegen.debug", "no").compareTo("yes"))==0) {
41       System.out.println("***");
42       for (int i=0;i<obj.length;i++) {
43         try {
44           Identification id = obj[i].get_identification();
45           System.out.println(id.absolute_name().name()+"?"+id.version());
46         } catch (java.rmi.RemoteException JavaDoc e) {
47           System.out.println(" Remote exception --> "+e.getMessage());
48         }
49       }
50       System.out.println("***");
51     }
52   }
53
54   /** Print list of TIR Contained objects */
55   public static void println(ObjectList obj) {
56     if ((System.getProperty("codegen.debug", "no").compareTo("yes"))==0) {
57       System.out.println("***");
58       for (int i=0;i<obj.size();i++) {
59         try {
60           Identification id = obj.getObject(i).get_identification();
61           System.out.println(id.absolute_name().name()+"?"+id.version());
62         } catch (java.rmi.RemoteException JavaDoc e) {
63           System.out.println(" Remote exception --> "+e.getMessage());
64         }
65       }
66       System.out.println("***");
67     }
68   }
69
70   /** Print list of Generated objects */
71   public static void println(GenObjectList obj) {
72     if ((System.getProperty("codegen.debug", "no").compareTo("yes"))==0) {
73       System.out.println("***");
74       for (int i=0;i<obj.size();i++) {
75         System.out.println(obj.getObject(i).toString());
76       }
77       System.out.println("***");
78     }
79   }
80 }
81
Popular Tags