summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRich Hickey <richhickey@gmail.com>2006-06-07 18:54:53 +0000
committerRich Hickey <richhickey@gmail.com>2006-06-07 18:54:53 +0000
commit59d0ff1ec90c4b325e161cdbbe304a159180d53b (patch)
tree40250b99f4fe47e0bbbf49ae462ee8792729b79c /src
parent66038cc7c71c09785e18fa0f4a5b2af675bd7803 (diff)
renamed to PersistentTree
Diffstat (limited to 'src')
-rw-r--r--src/cli/runtime/PersistentTree.cs (renamed from src/cli/runtime/RBTree.cs)16
-rw-r--r--src/cli/runtime/TObj.cs10
2 files changed, 13 insertions, 13 deletions
diff --git a/src/cli/runtime/RBTree.cs b/src/cli/runtime/PersistentTree.cs
index d1dea774..3ed31f41 100644
--- a/src/cli/runtime/RBTree.cs
+++ b/src/cli/runtime/PersistentTree.cs
@@ -25,16 +25,16 @@ namespace org.clojure.runtime
* See Okasaki, Kahrs, Larsen et al
*/
-public class RBTree : IPersistentMap{
+public class PersistentTree : IPersistentMap{
public readonly IComparer comp;
public readonly Node tree;
public readonly int _count;
-public RBTree():this(null){
+public PersistentTree():this(null){
}
-public RBTree(IComparer comp){
+public PersistentTree(IComparer comp){
this.comp = comp;
tree = null;
_count = 0;
@@ -65,9 +65,9 @@ public IPersistentMap put(Object key, Object val){
Node foundNode = (Node) found.val;
if(foundNode.val() == val) //note only get same collection on identity of val, not equals()
return this;
- return new RBTree(comp, replace(tree, key, val), _count);
+ return new PersistentTree(comp, replace(tree, key, val), _count);
}
- return new RBTree(comp, t.blacken(), _count + 1);
+ return new PersistentTree(comp, t.blacken(), _count + 1);
}
@@ -79,9 +79,9 @@ public IPersistentMap remove(Object key){
if(found.val == null)//null == doesn't contain key
return this;
//empty
- return new RBTree(comp);
+ return new PersistentTree(comp);
}
- return new RBTree(comp, t.blacken(), _count - 1);
+ return new PersistentTree(comp, t.blacken(), _count - 1);
}
@@ -313,7 +313,7 @@ Node replace(Node t, Object key, Object val){
c > 0 ? replace(t.right(), key, val) : t.right());
}
-RBTree(IComparer comp, Node tree, int count){
+PersistentTree(IComparer comp, Node tree, int count){
this.comp = comp;
this.tree = tree;
this._count = count;
diff --git a/src/cli/runtime/TObj.cs b/src/cli/runtime/TObj.cs
index cb2e7850..66de8084 100644
--- a/src/cli/runtime/TObj.cs
+++ b/src/cli/runtime/TObj.cs
@@ -17,23 +17,23 @@ public class TObj : IObj{
TRef attrs;
public TObj(ThreadLocalData tld) {
- this.attrs = Transaction.tref(tld,new RBTree());
+ this.attrs = Transaction.tref(tld,new PersistentTree());
}
public Object put(ThreadLocalData tld, IComparable key, Object val) {
- RBTree t = (RBTree) Transaction.get(tld, attrs);
- t = (RBTree) t.put(key, val);
+ PersistentTree t = (PersistentTree) Transaction.get(tld, attrs);
+ t = (PersistentTree) t.put(key, val);
Transaction.set(tld,attrs,t);
return val;
}
public Object get(ThreadLocalData tld, IComparable key) {
- RBTree t = (RBTree) Transaction.get(tld, attrs);
+ PersistentTree t = (PersistentTree) Transaction.get(tld, attrs);
return t.get(key);
}
public bool has(ThreadLocalData tld, IComparable key) {
- RBTree t = (RBTree) Transaction.get(tld, attrs);
+ PersistentTree t = (PersistentTree) Transaction.get(tld, attrs);
return t.contains(key);
}
}