KickJava   Java API By Example, From Geeks To Geeks.

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


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 For extends stmtType {
8     public exprType target;
9     public exprType iter;
10     public stmtType[] body;
11     public stmtType[] orelse;
12
13     public For(exprType target, exprType iter, stmtType[] body, stmtType[]
14     orelse) {
15         this.target = target;
16         this.iter = iter;
17         this.body = body;
18         this.orelse = orelse;
19     }
20
21     public For(exprType target, exprType iter, stmtType[] body, stmtType[]
22     orelse, SimpleNode parent) {
23         this(target, iter, body, orelse);
24         this.beginLine = parent.beginLine;
25         this.beginColumn = parent.beginColumn;
26     }
27
28     public String JavaDoc toString() {
29         StringBuffer JavaDoc sb = new StringBuffer JavaDoc("For[");
30         sb.append("target=");
31         sb.append(dumpThis(this.target));
32         sb.append(", ");
33         sb.append("iter=");
34         sb.append(dumpThis(this.iter));
35         sb.append(", ");
36         sb.append("body=");
37         sb.append(dumpThis(this.body));
38         sb.append(", ");
39         sb.append("orelse=");
40         sb.append(dumpThis(this.orelse));
41         sb.append("]");
42         return sb.toString();
43     }
44
45     public void pickle(DataOutputStream JavaDoc ostream) throws IOException JavaDoc {
46         pickleThis(13, ostream);
47         pickleThis(this.target, ostream);
48         pickleThis(this.iter, ostream);
49         pickleThis(this.body, ostream);
50         pickleThis(this.orelse, ostream);
51     }
52
53     public Object JavaDoc accept(VisitorIF visitor) throws Exception JavaDoc {
54         return visitor.visitFor(this);
55     }
56
57     public void traverse(VisitorIF visitor) throws Exception JavaDoc {
58         if (target != null)
59             target.accept(visitor);
60         if (iter != null)
61             iter.accept(visitor);
62         if (body != null) {
63             for (int i = 0; i < body.length; i++) {
64                 if (body[i] != null)
65                     body[i].accept(visitor);
66             }
67         }
68         if (orelse != null) {
69             for (int i = 0; i < orelse.length; i++) {
70                 if (orelse[i] != null)
71                     orelse[i].accept(visitor);
72             }
73         }
74     }
75
76 }
77
Popular Tags