|
1 |
| package edu.rice.cs.javalanglevels.tree; |
|
2 |
| |
|
3 |
| import edu.rice.cs.javalanglevels.SourceInfo; |
|
4 |
| |
|
5 |
| |
|
6 |
| |
|
7 |
| |
|
8 |
| |
|
9 |
| |
|
10 |
| public class ComplexNameReference extends NameReference { |
|
11 |
| private final Expression _enclosing; |
|
12 |
| |
|
13 |
| |
|
14 |
| |
|
15 |
| |
|
16 |
| |
|
17 |
86
| public ComplexNameReference(SourceInfo in_sourceInfo, Expression in_enclosing, Word in_name) {
|
|
18 |
86
| super(in_sourceInfo, in_name);
|
|
19 |
| |
|
20 |
86
| if (in_enclosing == null) {
|
|
21 |
0
| throw new java.lang.IllegalArgumentException("Parameter 'enclosing' to the ComplexNameReference constructor was null. This class may not have null field values.");
|
|
22 |
| } |
|
23 |
86
| _enclosing = in_enclosing;
|
|
24 |
| } |
|
25 |
| |
|
26 |
215
| final public Expression getEnclosing() { return _enclosing; }
|
|
27 |
| |
|
28 |
226
| public <RetType> RetType visit(JExpressionIFVisitor<RetType> visitor) { return visitor.forComplexNameReference(this); }
|
|
29 |
0
| public void visit(JExpressionIFVisitor_void visitor) { visitor.forComplexNameReference(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 |
50
| public void outputHelp(TabPrintWriter writer) {
|
|
49 |
50
| writer.print("ComplexNameReference" + ":");
|
|
50 |
50
| writer.indent();
|
|
51 |
| |
|
52 |
50
| writer.startLine("");
|
|
53 |
50
| writer.print("sourceInfo = ");
|
|
54 |
50
| SourceInfo temp_sourceInfo = getSourceInfo();
|
|
55 |
50
| if (temp_sourceInfo == null) {
|
|
56 |
0
| writer.print("null");
|
|
57 |
| } else { |
|
58 |
50
| writer.print(temp_sourceInfo);
|
|
59 |
| } |
|
60 |
| |
|
61 |
50
| writer.startLine("");
|
|
62 |
50
| writer.print("enclosing = ");
|
|
63 |
50
| Expression temp_enclosing = getEnclosing();
|
|
64 |
50
| if (temp_enclosing == null) {
|
|
65 |
0
| writer.print("null");
|
|
66 |
| } else { |
|
67 |
50
| temp_enclosing.outputHelp(writer);
|
|
68 |
| } |
|
69 |
| |
|
70 |
50
| writer.startLine("");
|
|
71 |
50
| writer.print("name = ");
|
|
72 |
50
| Word temp_name = getName();
|
|
73 |
50
| if (temp_name == null) {
|
|
74 |
0
| writer.print("null");
|
|
75 |
| } else { |
|
76 |
50
| temp_name.outputHelp(writer);
|
|
77 |
| } |
|
78 |
50
| writer.unindent();
|
|
79 |
| } |
|
80 |
| |
|
81 |
| |
|
82 |
| |
|
83 |
| |
|
84 |
| |
|
85 |
| |
|
86 |
3
| public boolean equals(java.lang.Object obj) {
|
|
87 |
0
| if (obj == null) return false;
|
|
88 |
3
| if ((obj.getClass() != this.getClass()) || (obj.hashCode() != this.hashCode())) {
|
|
89 |
3
| return false;
|
|
90 |
| } else { |
|
91 |
0
| ComplexNameReference casted = (ComplexNameReference) obj;
|
|
92 |
0
| if (! (getEnclosing().equals(casted.getEnclosing()))) return false;
|
|
93 |
0
| if (! (getName().equals(casted.getName()))) return false;
|
|
94 |
0
| return true;
|
|
95 |
| } |
|
96 |
| } |
|
97 |
| |
|
98 |
| |
|
99 |
| |
|
100 |
| |
|
101 |
| |
|
102 |
| |
|
103 |
| |
|
104 |
12
| protected int generateHashCode() {
|
|
105 |
12
| int code = getClass().hashCode();
|
|
106 |
12
| code ^= 0;
|
|
107 |
12
| code ^= getEnclosing().hashCode();
|
|
108 |
12
| code ^= getName().hashCode();
|
|
109 |
12
| return code;
|
|
110 |
| } |
|
111 |
| } |