-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathUnionType.java
More file actions
115 lines (102 loc) · 3.8 KB
/
UnionType.java
File metadata and controls
115 lines (102 loc) · 3.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
package edu.rice.cs.drjava.model.repl.types;
import edu.rice.cs.drjava.model.repl.newjvm.*;
/**
* Class UnionType, a component of the ASTGen-generated composite hierarchy.
* Note: null is not allowed as a value for any field.
* @version Generated automatically by ASTGen at Thu Oct 16 08:57:12 CDT 2014
*/
//@SuppressWarnings("unused")
public class UnionType extends BoundType {
/**
* Constructs a UnionType.
* @throws java.lang.IllegalArgumentException If any parameter to the constructor is null.
*/
public UnionType(Iterable<? extends Type> in_ofTypes) {
super(in_ofTypes);
}
public <RetType> RetType apply(TypeVisitor<RetType> visitor) {
return visitor.forUnionType(this);
}
public void apply(TypeVisitor_void visitor) {
visitor.forUnionType(this);
}
/**
* Implementation of toString that uses
* {@link #output} to generate a nicely tabbed tree.
*/
public java.lang.String toString() {
java.io.StringWriter w = new java.io.StringWriter();
walk(new ToStringWalker(w, 2));
return w.toString();
}
/**
* Prints this object out as a nicely tabbed tree.
*/
public void output(java.io.Writer writer) {
walk(new ToStringWalker(writer, 2));
}
/**
* Implementation of equals that is based on the values of the fields of the
* object. Thus, two objects created with identical parameters will be equal.
*/
public boolean equals(java.lang.Object obj) {
if (obj == null) return false;
if ((obj.getClass() != this.getClass()) || (obj.hashCode() != this.hashCode())) {
return false;
}
else {
UnionType casted = (UnionType) obj;
Iterable<? extends Type> temp_ofTypes = ofTypes();
Iterable<? extends Type> casted_ofTypes = casted.ofTypes();
if (temp_ofTypes != casted_ofTypes) {
java.util.Iterator<? extends Type> iter_temp_ofTypes = temp_ofTypes.iterator();
java.util.Iterator<? extends Type> iter_casted_ofTypes = casted_ofTypes.iterator();
while (iter_temp_ofTypes.hasNext() && iter_casted_ofTypes.hasNext()) {
Type elt_temp_ofTypes = iter_temp_ofTypes.next();
Type elt_casted_ofTypes = iter_casted_ofTypes.next();
if (!(elt_temp_ofTypes == elt_casted_ofTypes || elt_temp_ofTypes != null && elt_casted_ofTypes!= null && elt_temp_ofTypes.equals(elt_casted_ofTypes))) return false;
}
if (iter_temp_ofTypes.hasNext() || iter_casted_ofTypes.hasNext()) return false;
}
return true;
}
}
/**
* Implementation of hashCode that is consistent with equals. The value of
* the hashCode is formed by XORing the hashcode of the class object with
* the hashcodes of all the fields of the object.
*/
public int generateHashCode() {
int code = getClass().hashCode();
Iterable<? extends Type> temp_ofTypes = ofTypes();
code ^= temp_ofTypes.getClass().hashCode();
int index_temp_ofTypes = 0;
for (Type elt_temp_ofTypes : temp_ofTypes) {
code ^= index_temp_ofTypes++;
code ^= (elt_temp_ofTypes == null) ? 0 : elt_temp_ofTypes.hashCode();
}
return code;
}
public void walk(TreeWalker w) {
if (w.visitNode(this, "UnionType", 1)) {
Iterable<? extends Type> temp_ofTypes = ofTypes();
if (w.visitNodeField("ofTypes", temp_ofTypes)) {
if (w.visitIterated(temp_ofTypes)) {
int i_temp_ofTypes = 0;
for (Type elt_temp_ofTypes : temp_ofTypes) {
if (w.visitIteratedElement(i_temp_ofTypes, elt_temp_ofTypes)) {
if (elt_temp_ofTypes == null) w.visitNull();
else {
elt_temp_ofTypes.walk(w);
}
}
i_temp_ofTypes++;
}
w.endIterated(temp_ofTypes, i_temp_ofTypes);
}
w.endNodeField("ofTypes", temp_ofTypes);
}
w.endNode(this, "UnionType", 1);
}
}
}