-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEx.java
More file actions
75 lines (62 loc) · 1.6 KB
/
Copy pathEx.java
File metadata and controls
75 lines (62 loc) · 1.6 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
package data;
import syntaxtree.Node;
import syntaxtree.Statement;
import syntaxtree.Identifier;
public class Ex implements Value {
Identifier var;
Env env;
Statement stmt1;
Contour fp;
Statement stmt2;
public Ex(Identifier v, Env e, Statement s1, Contour c, Statement s2){
var = v;
env = e;
stmt1 = s1;
fp = c;
stmt2 = s2;
}
public Identifier getVar(){
return var;
}
public Env getEnv(){
return env;
}
public Node getStmt1(){
return stmt1;
}
public Node getStmt2(){
return stmt2;
}
public Contour getContour(){
return fp;
}
public int hashCode(){
final int PRIME = 31;
int result = 1;
result = PRIME * result + ( (var == null) ? 0 : var.hashCode());
result = PRIME * result + ( (env == null) ? 0 : env.hashCode());
result = PRIME * result + ( (stmt1 == null) ? 0 : stmt1.hashCode());
result = PRIME * result + ( (stmt2 == null) ? 0 : stmt2.hashCode());
result = PRIME * result + ( (fp == null) ? 0 : fp.hashCode());
return result;
}
public int compareTo(Value v){
int classCompare = getClass().getName().compareTo(v.getClass().getName());
if (classCompare != 0){
return classCompare;
}
Ex ex = (Ex) v;
return var.compareTo(ex.getVar());
}
public boolean equals(Object o){
if (this == o ) return true;
if (o == null) return false;
if (getClass() != o.getClass()) return false;
Ex ret = (Ex) o;
if(!var.equals(ret.getVar())) return false;
if(!env.equals(ret.getEnv())) return false;
if(!stmt1.equals(ret.getStmt1())) return false;
if(!stmt2.equals(ret.getStmt2())) return false;
return fp.equals(getContour());
}
}