1 |
| package edu.rice.cs.dynamicjava.symbol.type; |
2 |
| |
3 |
| import edu.rice.cs.dynamicjava.symbol.*; |
4 |
| |
5 |
| |
6 |
| |
7 |
| |
8 |
| |
9 |
| |
10 |
| @SuppressWarnings("unused") |
11 |
| public class UnionType extends BoundType { |
12 |
| |
13 |
| |
14 |
| |
15 |
| |
16 |
| |
17 |
394
| public UnionType(Iterable<? extends Type> in_ofTypes) {
|
18 |
394
| super(in_ofTypes);
|
19 |
| } |
20 |
| |
21 |
| |
22 |
491
| public <RetType> RetType apply(TypeVisitor<RetType> visitor) {
|
23 |
491
| return visitor.forUnionType(this);
|
24 |
| } |
25 |
| |
26 |
0
| public void apply(TypeVisitor_void visitor) {
|
27 |
0
| visitor.forUnionType(this);
|
28 |
| } |
29 |
| |
30 |
| |
31 |
| |
32 |
| |
33 |
| |
34 |
0
| public java.lang.String toString() {
|
35 |
0
| java.io.StringWriter w = new java.io.StringWriter();
|
36 |
0
| walk(new ToStringWalker(w, 2));
|
37 |
0
| return w.toString();
|
38 |
| } |
39 |
| |
40 |
| |
41 |
| |
42 |
| |
43 |
0
| public void output(java.io.Writer writer) {
|
44 |
0
| walk(new ToStringWalker(writer, 2));
|
45 |
| } |
46 |
| |
47 |
| |
48 |
| |
49 |
| |
50 |
| |
51 |
417
| public boolean equals(java.lang.Object obj) {
|
52 |
0
| if (obj == null) return false;
|
53 |
417
| if ((obj.getClass() != this.getClass()) || (obj.hashCode() != this.hashCode())) {
|
54 |
393
| return false;
|
55 |
| } |
56 |
| else { |
57 |
24
| UnionType casted = (UnionType) obj;
|
58 |
24
| Iterable<? extends Type> temp_ofTypes = ofTypes();
|
59 |
24
| Iterable<? extends Type> casted_ofTypes = casted.ofTypes();
|
60 |
24
| if (temp_ofTypes != casted_ofTypes) {
|
61 |
24
| java.util.Iterator<? extends Type> iter_temp_ofTypes = temp_ofTypes.iterator();
|
62 |
24
| java.util.Iterator<? extends Type> iter_casted_ofTypes = casted_ofTypes.iterator();
|
63 |
24
| while (iter_temp_ofTypes.hasNext() && iter_casted_ofTypes.hasNext()) {
|
64 |
48
| Type elt_temp_ofTypes = iter_temp_ofTypes.next();
|
65 |
48
| Type elt_casted_ofTypes = iter_casted_ofTypes.next();
|
66 |
0
| if (!(elt_temp_ofTypes == elt_casted_ofTypes || elt_temp_ofTypes != null && elt_casted_ofTypes!= null && elt_temp_ofTypes.equals(elt_casted_ofTypes))) return false;
|
67 |
| } |
68 |
0
| if (iter_temp_ofTypes.hasNext() || iter_casted_ofTypes.hasNext()) return false;
|
69 |
| } |
70 |
24
| return true;
|
71 |
| } |
72 |
| } |
73 |
| |
74 |
| |
75 |
| |
76 |
| |
77 |
| |
78 |
| |
79 |
| |
80 |
32
| public int generateHashCode() {
|
81 |
32
| int code = getClass().hashCode();
|
82 |
32
| Iterable<? extends Type> temp_ofTypes = ofTypes();
|
83 |
32
| code ^= temp_ofTypes.getClass().hashCode();
|
84 |
32
| int index_temp_ofTypes = 0;
|
85 |
32
| for (Type elt_temp_ofTypes : temp_ofTypes) {
|
86 |
64
| code ^= index_temp_ofTypes++;
|
87 |
64
| code ^= (elt_temp_ofTypes == null) ? 0 : elt_temp_ofTypes.hashCode();
|
88 |
| } |
89 |
32
| return code;
|
90 |
| } |
91 |
| |
92 |
0
| public void walk(TreeWalker w) {
|
93 |
0
| if (w.visitNode(this, "UnionType", 1)) {
|
94 |
0
| Iterable<? extends Type> temp_ofTypes = ofTypes();
|
95 |
0
| if (w.visitNodeField("ofTypes", temp_ofTypes)) {
|
96 |
0
| if (w.visitIterated(temp_ofTypes)) {
|
97 |
0
| int i_temp_ofTypes = 0;
|
98 |
0
| for (Type elt_temp_ofTypes : temp_ofTypes) {
|
99 |
0
| if (w.visitIteratedElement(i_temp_ofTypes, elt_temp_ofTypes)) {
|
100 |
0
| if (elt_temp_ofTypes == null) w.visitNull();
|
101 |
| else { |
102 |
0
| elt_temp_ofTypes.walk(w);
|
103 |
| } |
104 |
| } |
105 |
0
| i_temp_ofTypes++;
|
106 |
| } |
107 |
0
| w.endIterated(temp_ofTypes, i_temp_ofTypes);
|
108 |
| } |
109 |
0
| w.endNodeField("ofTypes", temp_ofTypes);
|
110 |
| } |
111 |
0
| w.endNode(this, "UnionType", 1);
|
112 |
| } |
113 |
| } |
114 |
| |
115 |
| } |