summaryrefslogtreecommitdiff
path: root/src/jvm
diff options
context:
space:
mode:
authorRich Hickey <richhickey@gmail.com>2009-07-17 17:34:34 -0400
committerRich Hickey <richhickey@gmail.com>2009-07-17 17:34:34 -0400
commitecff9342b455dda737cd585863a695a27a94c19e (patch)
tree5ce84463b3aa7f0d1063cdaa7e6b0882bcc5f1bb /src/jvm
parent53cc7a6c2ed1d3d0bfc4447ecb27d05c4ebd537e (diff)
Clojure interface to editable vectors - mutable,immutable,conj!,pop!,assoc!,get!,nth!
Diffstat (limited to 'src/jvm')
-rw-r--r--src/jvm/clojure/lang/PersistentVector.java20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/jvm/clojure/lang/PersistentVector.java b/src/jvm/clojure/lang/PersistentVector.java
index 1af75428..c64ad6e6 100644
--- a/src/jvm/clojure/lang/PersistentVector.java
+++ b/src/jvm/clojure/lang/PersistentVector.java
@@ -82,8 +82,8 @@ PersistentVector(IPersistentMap meta, int cnt, int shift, Node root, Object[] ta
this.tail = tail;
}
-public Mutable mutable(){
- return new Mutable(this);
+public MutableVector mutable(){
+ return new MutableVector(this);
}
final int tailoff(){
@@ -371,20 +371,20 @@ private Node popTail(int level, Node node){
}
}
-static class Mutable implements IMutableVector, Counted{
+static class MutableVector implements IMutableVector, Counted{
int cnt;
int shift;
Node root;
Object[] tail;
- Mutable(int cnt, int shift, Node root, Object[] tail){
+ MutableVector(int cnt, int shift, Node root, Object[] tail){
this.cnt = cnt;
this.shift = shift;
this.root = root;
this.tail = tail;
}
- Mutable(PersistentVector v){
+ MutableVector(PersistentVector v){
this(v.cnt, v.shift, editable(v.root), editableTail(v.tail));
}
@@ -420,7 +420,7 @@ static class Mutable implements IMutableVector, Counted{
return ret;
}
- public Mutable conj(Object val){
+ public MutableVector conj(Object val){
ensureEditable();
int i = cnt;
//room in tail?
@@ -510,7 +510,7 @@ static class Mutable implements IMutableVector, Counted{
return node[i & 0x01f];
}
- public Mutable assocN(int i, Object val){
+ public MutableVector assocN(int i, Object val){
ensureEditable();
if(i >= 0 && i < cnt)
{
@@ -528,7 +528,7 @@ static class Mutable implements IMutableVector, Counted{
throw new IndexOutOfBoundsException();
}
- public Mutable assoc(Object key, Object val){
+ public MutableVector assoc(Object key, Object val){
if(Util.isInteger(key))
{
int i = ((Number) key).intValue();
@@ -552,7 +552,7 @@ static class Mutable implements IMutableVector, Counted{
return ret;
}
- public Mutable pop(){
+ public MutableVector pop(){
ensureEditable();
if(cnt == 0)
throw new IllegalStateException("Can't pop empty vector");
@@ -629,7 +629,7 @@ static public void main(String[] args){
//v.setSize(size);
//PersistentArray p = new PersistentArray(size);
PersistentVector p = PersistentVector.EMPTY;
- Mutable mp = p.mutable();
+ MutableVector mp = p.mutable();
for(int i = 0; i < size; i++)
{