Fixed more compilation issues.
[IRC.git] / Robust / src / Benchmarks / Scheduling / GC / NON_BAMBOO / MTree / TestRunner.java
index 746ea133da04f5add1d2d5b144317db0a077d43d..9189df39332352086a2d6c964c8ea260287ef449 100644 (file)
@@ -1,3 +1,5 @@
+package MTree;
+
 public class TestRunner extends Thread {
 
   int m_index;
@@ -32,126 +34,13 @@ public class TestRunner extends Thread {
     }
   }
   
-  class Node {
-    int m_key;
-    int m_value;
-    Node m_left;
-    Node m_right;
-    Node m_parent;
-
-    public Node() {
-      // an empty node
-      this.m_key = -1;
-      this.m_value = -1;
-      this.m_left = null;
-      this.m_right = null;
-      this.m_parent = null;
-    }
-
-    public Node(int key,
-        int value) {
-      this.m_key = key;
-      this.m_value = value;
-      this.m_left = null;
-      this.m_right = null;
-      this.m_parent = null;
-    }
-
-    public int getKey() {
-      return this.m_key;
-    }
-
-    public void setParent(Node p) {
-      this.m_parent = p;
-    }
-
-    public void setLeftChild(int key,
-        int value) {
-      Node n = new Node(key, value);
-      this.m_left = n;
-      n.setParent(this);
-    }
-
-    public void setRightChild(int key,
-        int value) {
-      Node n = new Node(key, value);
-      this.m_right = n;
-      n.setParent(this);
-    }
-
-    public boolean insert(int key,
-        int value,
-        boolean candelete) {
-      if(this.m_key == -1) {
-        // empty tree
-        this.m_key = key;
-        this.m_value = value;
-      } else {
-        if(this.m_key == key) {
-          // collision
-          replace(key, value);
-          return false;
-        } else if(this.m_key > key) {
-          if(this.m_left == null) {
-            // no left subtree
-            if(candelete) {
-              // replace this node with the new node
-              replace(key, value);
-              return false;
-            } else {
-              setLeftChild(key, value);
-            }
-          } else {
-            // insert into the left subtree
-            return this.m_left.insert(key, value, candelete);
-          }
-        } else if(this.m_key < key) {
-          if(this.m_right == null) {
-            // no right subtree
-            if(candelete) {
-              replace(key, value);
-              return false;
-            } else {
-              setRightChild(key, value);
-            }
-          } else {
-            // insert into the right subtree
-            return this.m_right.insert(key, value, candelete);
-          }
-        }
-      }
-      return true;
-    }
-
-    public void replace(int key,
-        int value) {
-      Node n = new Node(key, value);
-      n.m_left = this.m_left;
-      n.m_right = this.m_right;
-      n.m_parent = this.m_parent;
-      if(this.m_parent != null) {
-        if(this.m_parent.getKey() > key) {
-          this.m_parent.m_left = n;
-        } else {
-          this.m_parent.m_right = n;
-        }
-      }
-      if(this.m_left != null) {
-        this.m_left.m_parent = n;
-      }
-      if(this.m_right != null) {
-        this.m_right.m_parent = n;
-      }
-    }
-  }
-  
   public static void main(String[] args) {
     int threadnum = 62; // 56;
     int size = 40000;
     int nodenum = size*10;
     for(int i = 0; i < threadnum; ++i) {
       TestRunner tr = new TestRunner(i, size, nodenum);
-      tr.run();
+      tr.start();
     }
   }
 }