-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBase.java
More file actions
54 lines (38 loc) · 1.2 KB
/
Base.java
File metadata and controls
54 lines (38 loc) · 1.2 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
import java.util.*;
class Base {
int variableOffset;
int functionOffset;
int offset;
boolean overriden;
ArrayList<ClassInfo> declarationsOffset;
Base() {
this.declarationsOffset = new ArrayList<>();
}
final String INT = "int";
final String BOOLEAN = "boolean";
final String INT_ARRAY = "int[]";
final String BOOLEAN_ARRAY = "boolean[]";
final String THIS = "this";
public ArrayList<String> TYPES = new ArrayList<String>(Arrays.asList(INT, INT_ARRAY, BOOLEAN, BOOLEAN_ARRAY));
public boolean areEqual(String str1, String str2) {
return (str1 == null ? str2 == null : str1.equals(str2));
}
public boolean isPrimitiveType(String type) {
return TYPES.contains(type);
}
public boolean isThis(String item) {
return areEqual(item, THIS);
}
public boolean isInt(String item) {
return areEqual(item, INT);
}
public boolean isBoolean(String item) {
return areEqual(item, BOOLEAN);
}
public boolean isIntArray(String item) {
return areEqual(item, INT_ARRAY);
}
public boolean isBooleanArray(String item) {
return areEqual(item, BOOLEAN_ARRAY);
}
}