start of new file
[IRC.git] / Robust / src / IR / Flat / FlatNode.java
1 package IR.Flat;
2 import java.util.Vector;
3
4 public class FlatNode {
5     protected Vector next;
6     protected Vector prev;
7
8     public FlatNode() {
9         next=new Vector();
10         prev=new Vector();
11     }
12
13     public String toString() {
14         throw new Error(this.getClass().getName() + "does not implement toString!");
15     }
16     public int numNext() {
17         return next.size();
18     }
19     public FlatNode getNext(int i) {
20         return (FlatNode) next.get(i);
21     }
22
23     public int numPrev() {
24         return prev.size();
25     }
26     public FlatNode getPrev(int i) {
27         return (FlatNode) prev.get(i);
28     }
29     
30     public void addNext(FlatNode n) {
31         next.add(n);
32         n.addPrev(this);
33     }
34
35     /** This function modifies the graph */
36     public void setNext(int i, FlatNode n) {
37         FlatNode old=getNext(i);
38         next.set(i, n);
39         old.prev.remove(this);
40         n.addPrev(this);
41     }
42
43     protected void addPrev(FlatNode p) {
44         prev.add(p);
45     }
46     public int kind() {
47         throw new Error();
48     }
49
50     public TempDescriptor [] readsTemps() {
51         return new TempDescriptor[0];
52     }
53
54     public TempDescriptor [] writesTemps() {
55         return new TempDescriptor[0];
56     }
57 }