-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathValueBase.java
48 lines (41 loc) · 1.2 KB
/
ValueBase.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
41
42
43
44
45
46
47
48
import java.math.BigDecimal;
public class ValueBase implements java.io.Serializable {
private Object data;
private Data configData = SyntaxTree.getData();
@Override
public boolean equals(Object obj) {
if (!(obj instanceof SyntaxTree.Number || obj instanceof SyntaxTree.Text || obj instanceof SyntaxTree.Boolean || obj instanceof SyntaxTree.Null || obj instanceof SyntaxTree.List || obj instanceof SyntaxTree.CreateInstance)) {
obj = ((ValueBase) obj).getData();
}
while (obj instanceof ValueBase) {
obj = ((ValueBase) obj).getData();
}
Object value = getData();
while (value instanceof ValueBase) {
value = ((ValueBase) value).getData();
}
if (value == null && obj == null) {
return true;
} else if (value == null || obj == null) {
return false;
}
return value.equals(obj);
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
public Data getConfigData() {
return configData;
}
public ValueBase setConfigData(Data configData) {
this.configData = configData;
return this;
}
@Override
public String toString() {
return this.getData() + "";
}
}