Fixed issues with compilation.
[IRC.git] / Robust / src / Benchmarks / Scheduling / GC / NON_BAMBOO / Fibheaps / Tree.java
1 package Fibheaps;
2
3 // the bionomial class
4 public class Tree {
5   public int root;
6   public Vector v_trees;
7
8   public Tree() {
9     this.root = 0;
10     this.v_trees = null;
11   }
12
13   public Tree(int root,
14       Vector trees) {
15     this.root = root;
16     this.v_trees = trees;
17   }
18
19   public Tree link(Tree t) {
20     int root = 0;
21     Tree tmp = null;
22     Vector tmp_v = null;
23     if(this.root <= t.root) {
24       root = this.root;
25       tmp = t;
26       tmp_v = this.v_trees;
27     } else {
28       root = t.root;
29       tmp = this;
30       tmp_v = t.v_trees;
31     }
32     Tree nt = new Tree(root, tmp_v);
33     if(nt.v_trees == null) {
34       nt.v_trees = new Vector();
35     }
36     nt.v_trees.insertElementAt(tmp, 0);
37     return nt;
38   }
39 }
40
41 public class TaggedTree {
42   public int degree;
43   public Tree tree;
44
45   public TaggedTree() {
46     this.degree = 0;
47     this.tree = null;
48   }
49
50   public TaggedTree(int degree,
51       Tree tree) {
52     this.degree = degree;
53     this.tree = tree;
54   }
55
56   public Vector getChildren() {
57     Vector rst = new Vector();
58     Vector v = tree.v_trees;
59     int d = this.degree-1;
60     if(v != null) {
61       for(int i = 0; i < v.size(); i++) {
62         rst.addElement(new TaggedTree(d, (Tree)v.elementAt(i)));
63         d--;
64       }
65     }
66     return rst;
67   }
68 }