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