KickJava   Java API By Example, From Geeks To Geeks.

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


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