|
1 |
| package edu.rice.cs.javalanglevels.tree; |
|
2 |
| |
|
3 |
| import edu.rice.cs.javalanglevels.SourceInfo; |
|
4 |
| |
|
5 |
| |
|
6 |
| |
|
7 |
| |
|
8 |
| |
|
9 |
| |
|
10 |
| public class ExpressionStatement extends Statement { |
|
11 |
| private final Expression _expression; |
|
12 |
| |
|
13 |
| |
|
14 |
| |
|
15 |
| |
|
16 |
| |
|
17 |
159
| public ExpressionStatement(SourceInfo in_sourceInfo, Expression in_expression) {
|
|
18 |
159
| super(in_sourceInfo);
|
|
19 |
| |
|
20 |
159
| if (in_expression == null) {
|
|
21 |
0
| throw new java.lang.IllegalArgumentException("Parameter 'expression' to the ExpressionStatement constructor was null. This class may not have null field values.");
|
|
22 |
| } |
|
23 |
159
| _expression = in_expression;
|
|
24 |
| } |
|
25 |
| |
|
26 |
294
| final public Expression getExpression() { return _expression; }
|
|
27 |
| |
|
28 |
139
| public <RetType> RetType visit(JExpressionIFVisitor<RetType> visitor) { return visitor.forExpressionStatement(this); }
|
|
29 |
0
| public void visit(JExpressionIFVisitor_void visitor) { visitor.forExpressionStatement(this); }
|
|
30 |
| |
|
31 |
| |
|
32 |
| |
|
33 |
| |
|
34 |
| |
|
35 |
0
| public java.lang.String toString() {
|
|
36 |
0
| java.io.StringWriter w = new java.io.StringWriter();
|
|
37 |
0
| output(w);
|
|
38 |
0
| return w.toString();
|
|
39 |
| } |
|
40 |
| |
|
41 |
| |
|
42 |
| |
|
43 |
| |
|
44 |
0
| public void output(java.io.Writer writer) {
|
|
45 |
0
| outputHelp(new TabPrintWriter(writer, 2));
|
|
46 |
| } |
|
47 |
| |
|
48 |
132
| public void outputHelp(TabPrintWriter writer) {
|
|
49 |
132
| writer.print("ExpressionStatement" + ":");
|
|
50 |
132
| writer.indent();
|
|
51 |
| |
|
52 |
132
| writer.startLine("");
|
|
53 |
132
| writer.print("sourceInfo = ");
|
|
54 |
132
| SourceInfo temp_sourceInfo = getSourceInfo();
|
|
55 |
132
| if (temp_sourceInfo == null) {
|
|
56 |
0
| writer.print("null");
|
|
57 |
| } else { |
|
58 |
132
| writer.print(temp_sourceInfo);
|
|
59 |
| } |
|
60 |
| |
|
61 |
132
| writer.startLine("");
|
|
62 |
132
| writer.print("expression = ");
|
|
63 |
132
| Expression temp_expression = getExpression();
|
|
64 |
132
| if (temp_expression == null) {
|
|
65 |
0
| writer.print("null");
|
|
66 |
| } else { |
|
67 |
132
| temp_expression.outputHelp(writer);
|
|
68 |
| } |
|
69 |
132
| writer.unindent();
|
|
70 |
| } |
|
71 |
| |
|
72 |
| |
|
73 |
| |
|
74 |
| |
|
75 |
| |
|
76 |
| |
|
77 |
1
| public boolean equals(java.lang.Object obj) {
|
|
78 |
0
| if (obj == null) return false;
|
|
79 |
1
| if ((obj.getClass() != this.getClass()) || (obj.hashCode() != this.hashCode())) {
|
|
80 |
0
| return false;
|
|
81 |
| } else { |
|
82 |
1
| ExpressionStatement casted = (ExpressionStatement) obj;
|
|
83 |
0
| if (! (getExpression().equals(casted.getExpression()))) return false;
|
|
84 |
1
| return true;
|
|
85 |
| } |
|
86 |
| } |
|
87 |
| |
|
88 |
| |
|
89 |
| |
|
90 |
| |
|
91 |
| |
|
92 |
| |
|
93 |
| |
|
94 |
1
| protected int generateHashCode() {
|
|
95 |
1
| int code = getClass().hashCode();
|
|
96 |
1
| code ^= 0;
|
|
97 |
1
| code ^= getExpression().hashCode();
|
|
98 |
1
| return code;
|
|
99 |
| } |
|
100 |
| } |