|
1 |
| package edu.rice.cs.javalanglevels.tree; |
|
2 |
| |
|
3 |
| import edu.rice.cs.javalanglevels.SourceInfo; |
|
4 |
| |
|
5 |
| |
|
6 |
| |
|
7 |
| |
|
8 |
| |
|
9 |
| |
|
10 |
| public class MemberType extends ReferenceType { |
|
11 |
| private final ReferenceType _left; |
|
12 |
| private final ReferenceType _right; |
|
13 |
| |
|
14 |
| |
|
15 |
| |
|
16 |
| |
|
17 |
| |
|
18 |
14
| public MemberType(SourceInfo in_sourceInfo, String in_name, ReferenceType in_left, ReferenceType in_right) {
|
|
19 |
14
| super(in_sourceInfo, in_name);
|
|
20 |
| |
|
21 |
14
| if (in_left == null) {
|
|
22 |
0
| throw new java.lang.IllegalArgumentException("Parameter 'left' to the MemberType constructor was null. This class may not have null field values.");
|
|
23 |
| } |
|
24 |
14
| _left = in_left;
|
|
25 |
| |
|
26 |
14
| if (in_right == null) {
|
|
27 |
0
| throw new java.lang.IllegalArgumentException("Parameter 'right' to the MemberType constructor was null. This class may not have null field values.");
|
|
28 |
| } |
|
29 |
14
| _right = in_right;
|
|
30 |
| } |
|
31 |
| |
|
32 |
4
| final public ReferenceType getLeft() { return _left; }
|
|
33 |
4
| final public ReferenceType getRight() { return _right; }
|
|
34 |
| |
|
35 |
4
| public <RetType> RetType visit(JExpressionIFVisitor<RetType> visitor) { return visitor.forMemberType(this); }
|
|
36 |
0
| public void visit(JExpressionIFVisitor_void visitor) { visitor.forMemberType(this); }
|
|
37 |
| |
|
38 |
| |
|
39 |
| |
|
40 |
| |
|
41 |
| |
|
42 |
0
| public java.lang.String toString() {
|
|
43 |
0
| java.io.StringWriter w = new java.io.StringWriter();
|
|
44 |
0
| output(w);
|
|
45 |
0
| return w.toString();
|
|
46 |
| } |
|
47 |
| |
|
48 |
| |
|
49 |
| |
|
50 |
| |
|
51 |
0
| public void output(java.io.Writer writer) {
|
|
52 |
0
| outputHelp(new TabPrintWriter(writer, 2));
|
|
53 |
| } |
|
54 |
| |
|
55 |
4
| public void outputHelp(TabPrintWriter writer) {
|
|
56 |
4
| writer.print("MemberType" + ":");
|
|
57 |
4
| writer.indent();
|
|
58 |
| |
|
59 |
4
| writer.startLine("");
|
|
60 |
4
| writer.print("sourceInfo = ");
|
|
61 |
4
| SourceInfo temp_sourceInfo = getSourceInfo();
|
|
62 |
4
| if (temp_sourceInfo == null) {
|
|
63 |
0
| writer.print("null");
|
|
64 |
| } else { |
|
65 |
4
| writer.print(temp_sourceInfo);
|
|
66 |
| } |
|
67 |
| |
|
68 |
4
| writer.startLine("");
|
|
69 |
4
| writer.print("name = ");
|
|
70 |
4
| String temp_name = getName();
|
|
71 |
4
| if (temp_name == null) {
|
|
72 |
0
| writer.print("null");
|
|
73 |
| } else { |
|
74 |
4
| writer.print(temp_name);
|
|
75 |
| } |
|
76 |
| |
|
77 |
4
| writer.startLine("");
|
|
78 |
4
| writer.print("left = ");
|
|
79 |
4
| ReferenceType temp_left = getLeft();
|
|
80 |
4
| if (temp_left == null) {
|
|
81 |
0
| writer.print("null");
|
|
82 |
| } else { |
|
83 |
4
| temp_left.outputHelp(writer);
|
|
84 |
| } |
|
85 |
| |
|
86 |
4
| writer.startLine("");
|
|
87 |
4
| writer.print("right = ");
|
|
88 |
4
| ReferenceType temp_right = getRight();
|
|
89 |
4
| if (temp_right == null) {
|
|
90 |
0
| writer.print("null");
|
|
91 |
| } else { |
|
92 |
4
| temp_right.outputHelp(writer);
|
|
93 |
| } |
|
94 |
4
| writer.unindent();
|
|
95 |
| } |
|
96 |
| |
|
97 |
| |
|
98 |
| |
|
99 |
| |
|
100 |
| |
|
101 |
| |
|
102 |
0
| public boolean equals(java.lang.Object obj) {
|
|
103 |
0
| if (obj == null) return false;
|
|
104 |
0
| if ((obj.getClass() != this.getClass()) || (obj.hashCode() != this.hashCode())) {
|
|
105 |
0
| return false;
|
|
106 |
| } else { |
|
107 |
0
| MemberType casted = (MemberType) obj;
|
|
108 |
0
| if (! (getName() == casted.getName())) return false;
|
|
109 |
0
| if (! (getLeft().equals(casted.getLeft()))) return false;
|
|
110 |
0
| if (! (getRight().equals(casted.getRight()))) return false;
|
|
111 |
0
| return true;
|
|
112 |
| } |
|
113 |
| } |
|
114 |
| |
|
115 |
| |
|
116 |
| |
|
117 |
| |
|
118 |
| |
|
119 |
| |
|
120 |
| |
|
121 |
0
| protected int generateHashCode() {
|
|
122 |
0
| int code = getClass().hashCode();
|
|
123 |
0
| code ^= 0;
|
|
124 |
0
| code ^= getName().hashCode();
|
|
125 |
0
| code ^= getLeft().hashCode();
|
|
126 |
0
| code ^= getRight().hashCode();
|
|
127 |
0
| return code;
|
|
128 |
| } |
|
129 |
| } |