-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConst.java
More file actions
46 lines (35 loc) · 839 Bytes
/
Const.java
File metadata and controls
46 lines (35 loc) · 839 Bytes
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
package expression;
public class Const implements BothExpressions {
private final int CONST;
public Const(int value) {
this.CONST = value;
}
public int evaluate(int x) {
return CONST;
}
public int evaluate(int x, int y, int z) {
return CONST;
}
@Override
public String toString() {
return Integer.toString(CONST);
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (obj.getClass() == this.getClass()) {
Const other = (Const) obj;
return other.getCONST() == this.getCONST();
}
return false;
}
public int getCONST() {
return CONST;
}
@Override
public int hashCode() {
return CONST;
}
}