KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > python > parser > ast > While


1 // Autogenerated AST node
2
package org.python.parser.ast;
3 import org.python.parser.SimpleNode;
4 import java.io.DataOutputStream JavaDoc;
5 import java.io.IOException JavaDoc;
6
7 public class While extends stmtType {
8     public exprType test;
9     public stmtType[] body;
10     public stmtType[] orelse;
11
12     public While(exprType test, stmtType[] body, stmtType[] orelse) {
13         this.test = test;
14         this.body = body;
15         this.orelse = orelse;
16     }
17
18     public While(exprType test, stmtType[] body, stmtType[] orelse,
19     SimpleNode parent) {
20         this(test, body, orelse);
21         this.beginLine = parent.beginLine;
22         this.beginColumn = parent.beginColumn;
23     }
24
25     public String JavaDoc toString() {
26         StringBuffer JavaDoc sb = new StringBuffer JavaDoc("While[");
27         sb.append("test=");
28         sb.append(dumpThis(this.test));
29         sb.append(", ");
30         sb.append("body=");
31         sb.append(dumpThis(this.body));
32         sb.append(", ");
33         sb.append("orelse=");
34         sb.append(dumpThis(this.orelse));
35         sb.append("]");
36         return sb.toString();
37     }
38
39     public void pickle(DataOutputStream JavaDoc ostream) throws IOException JavaDoc {
40         pickleThis(14, ostream);
41         pickleThis(this.test, ostream);
42         pickleThis(this.body, ostream);
43         pickleThis(this.orelse, ostream);
44     }
45
46     public Object JavaDoc accept(VisitorIF visitor) throws Exception JavaDoc {
47         return visitor.visitWhile(this);
48     }
49
50     public void traverse(VisitorIF visitor) throws Exception JavaDoc {
51         if (test != null)
52             test.accept(visitor);
53         if (body != null) {
54             for (int i = 0; i < body.length; i++) {
55                 if (body[i] != null)
56                     body[i].accept(visitor);
57             }
58         }
59         if (orelse != null) {
60             for (int i = 0; i < orelse.length; i++) {
61                 if (orelse[i] != null)
62                     orelse[i].accept(visitor);
63             }
64         }
65     }
66
67 }
68
Popular Tags