-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathArrayType.java
40 lines (34 loc) · 922 Bytes
/
ArrayType.java
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
public class ArrayType extends Type {
Type type;
IntegerLiteral size;
public ArrayType(Type type, IntegerLiteral size) {
this.type = type;
this.size = size;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ArrayType objType = (ArrayType)o;
if (!objType.type.equals(this.type) || !objType.size.equals(this.size)) {
return false;
}
return true;
}
public Object accept(Visitor visitor) {
return visitor.visit(this);
}
public String toString() {
return "A" + type.toString();
}
public String toSignString() {
return String.format("[%s", type.toSignString());
}
public String toStringInArrayCreation() {
return "n/a";
}
}