-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathNodeInt.java
More file actions
45 lines (33 loc) · 796 Bytes
/
Copy pathNodeInt.java
File metadata and controls
45 lines (33 loc) · 796 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
package regalloc.graph;
import java.util.LinkedList;
import java.util.List;
import symboltable.Variable;
public class NodeInt {
Variable var;
List<NodeInt> edge;
public NodeInt(Variable v){
var = v;
edge = new LinkedList<NodeInt>();
}
public void addEdge(NodeInt e){
//if the edge doesn't exist yet we add it
if(!containsEdge(e)){
edge.add(e);
}
}
public void rmEdge(NodeInt e){
edge.remove(e);
}
public boolean containsEdge(NodeInt e){
if(!edge.contains(e)){
return false;
}
return true;
}
public List<NodeInt> getEdge(){
return edge;
}
public Variable getVar(){
return var;
}
}