Clover coverage report - XJavaDoc - 1.1 Coverage timestamp: Sun Oct 3 2004 19:56:54 BST FRAMES NO FRAMES |
file stats: | LOC: | 146 |  | Methods: | 17
| NCLOC: | 111 |  | Classes: | 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
Source file | Conditionals | Statements | Methods | TOTAL
SimpleNode.java | 31.2% | 44.4% | 64.7% | 46.4% |

1 |  |
     /*
2 |  |
      * Copyright (c) 2001-2003 The XDoclet team
3 |  |
      * All rights reserved.
4 |  |
      */
5 |  |
     package xjavadoc;
6 |  |
7 |  |
     public class SimpleNode implements Node
8 |  |
     {
9 |  |
10 |  |
         public static int  instanceCount = 0;
11 |  |
         protected Node     parent;
12 |  |
         protected Node[]   children;
13 |  |
         protected int      id;
14 |  |
         protected JavaParser parser;
15 |  |
         protected Token    first, last;
16 |  |
17 | 5000 |
         public SimpleNode( int i )
18 |  |
         {
19 | 5000 |
             id = i;
20 | 5000 |
             instanceCount++;
21 |  |
         }
22 |  |
23 | 5000 |
         public SimpleNode( final JavaParser p, int i )
24 |  |
         {
25 | 5000 |
             this( i );
26 | 5000 |
             parser = p;
27 |  |
         }
28 |  |
29 |  |
         /**
30 |  |
          * Returns our position under our parent.
31 |  |
          *
32 |  |
          * @return   our position under our parent.
33 |  |
          */
34 | 0 |
         public int getPosition()
35 |  |
         {
36 | 0 |
             int i;
37 |  |
38 | 0 |
             for( i = 0; i < jjtGetParent().jjtGetNumChildren(); i++ )
39 |  |
             {
40 | 0 |
                 if( jjtGetParent().jjtGetChild( i ) == this )
41 |  |
                 {
42 | 0 |
                     break;
43 |  |
                 }
44 |  |
             }
45 | 0 |
             return i;
46 |  |
         }
47 |  |
48 | 10574 |
         public Token getFirstToken()
49 |  |
         {
50 | 10574 |
             return first;
51 |  |
         }
52 |  |
53 | 11384 |
         public Token getLastToken()
54 |  |
         {
55 | 11384 |
             return last;
56 |  |
         }
57 |  |
58 | 108 |
         public String getType()
59 |  |
         {
60 | 108 |
             return NodeParserTreeConstants.jjtNodeName[id];
61 |  |
         }
62 |  |
63 | 5000 |
         public void jjtOpen()
64 |  |
         {
65 | 5000 |
             first = parser.getToken( 1 );
66 |  |
         }
67 |  |
68 | 5000 |
         public void jjtClose()
69 |  |
         {
70 | 5000 |
             last = parser.getToken( 0 );
71 |  |
         }
72 |  |
73 | 4988 |
         public void jjtSetParent( Node n )
74 |  |
         {
75 | 4988 |
             parent = n;
76 |  |
         }
77 |  |
78 | 0 |
         public Node jjtGetParent()
79 |  |
         {
80 | 0 |
             return parent;
81 |  |
         }
82 |  |
83 | 4988 |
         public void jjtAddChild( Node n, int i )
84 |  |
         {
85 | 4988 |
             if( children == null )
86 |  |
             {
87 | 4230 |
                 children = new Node[i + 1];
88 |  |
             }
89 | 758 |
             else if( i >= children.length )
90 |  |
             {
91 | 0 |
                 Node c[] = new Node[i + 1];
92 |  |
93 | 0 |
                 System.arraycopy( children, 0, c, 0, children.length );
94 | 0 |
                 children = c;
95 |  |
             }
96 | 4988 |
             children[i] = n;
97 |  |
         }
98 |  |
99 | 4988 |
         public Node jjtGetChild( int i )
100 |  |
         {
101 | 4988 |
             return children[i];
102 |  |
         }
103 |  |
104 | 9978 |
         public int jjtGetNumChildren()
105 |  |
         {
106 | 9978 |
             return ( children == null ) ? 0 : children.length;
107 |  |
         }
108 |  |
109 | 0 |
         public String toString()
110 |  |
         {
111 | 0 |
             return getType();
112 |  |
         }
113 |  |
114 | 0 |
         public String toString( String prefix )
115 |  |
         {
116 | 0 |
             return prefix + toString();
117 |  |
         }
118 |  |
119 | 0 |
         public String dump()
120 |  |
         {
121 | 0 |
             StringBuffer sb = new StringBuffer();
122 |  |
123 | 0 |
             dump( sb, "  " );
124 | 0 |
             return sb.toString();
125 |  |
         }
126 |  |
127 | 0 |
         private void dump( StringBuffer sb, String prefix )
128 |  |
         {
129 | 0 |
             sb.append( toString( prefix ) ).append( System.getProperty( "line.separator" ) );
130 |  |
131 | 0 |
             if( children != null )
132 |  |
             {
133 | 0 |
                 for( int i = 0; i < children.length; ++i )
134 |  |
                 {
135 | 0 |
                     SimpleNode n = ( SimpleNode ) children[i];
136 |  |
137 | 0 |
                     if( n != null )
138 |  |
                     {
139 | 0 |
                         n.dump( sb, prefix + prefix );
140 |  |
                     }
141 |  |
                 }
142 |  |
             }
143 |  |
         }
144 |  |
     }
145 |  |
146 |  |