summaryrefslogtreecommitdiff
path: root/src/jvm
diff options
context:
space:
mode:
authorRich Hickey <richhickey@gmail.com>2006-08-04 23:43:39 +0000
committerRich Hickey <richhickey@gmail.com>2006-08-04 23:43:39 +0000
commita8ba1dbdec6976596e005b7ffe2d06355280a10f (patch)
tree7f654417cb973198f22df97e3821d740a01b2613 /src/jvm
parentcdd429f0d51b754ed0d2f4ab4cd9b90d320a3c0e (diff)
added AnArray
Diffstat (limited to 'src/jvm')
-rw-r--r--src/jvm/clojure/lang/AnArray.java27
-rw-r--r--src/jvm/clojure/lang/PersistentArray.java14
-rw-r--r--src/jvm/clojure/lang/Tuple.java2
3 files changed, 30 insertions, 13 deletions
diff --git a/src/jvm/clojure/lang/AnArray.java b/src/jvm/clojure/lang/AnArray.java
new file mode 100644
index 00000000..0afe7c79
--- /dev/null
+++ b/src/jvm/clojure/lang/AnArray.java
@@ -0,0 +1,27 @@
+/**
+ * Copyright (c) Rich Hickey. All rights reserved.
+ * The use and distribution terms for this software are covered by the
+ * Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
+ * which can be found in the file CPL.TXT at the root of this distribution.
+ * By using this software in any fashion, you are agreeing to be bound by
+ * the terms of this license.
+ * You must not remove this notice, or any other, from this software.
+ **/
+
+package clojure.lang;
+
+public abstract class AnArray extends Obj implements IArray, Cloneable {
+
+public Obj withMeta(IPersistentMap meta) {
+ try{
+ Obj ret = (Obj) clone();
+ ret._meta = meta;
+ return ret;
+ }
+ catch(CloneNotSupportedException ignore)
+ {
+ return null;
+ }
+}
+
+}
diff --git a/src/jvm/clojure/lang/PersistentArray.java b/src/jvm/clojure/lang/PersistentArray.java
index 0b0ce5b7..2483c6bd 100644
--- a/src/jvm/clojure/lang/PersistentArray.java
+++ b/src/jvm/clojure/lang/PersistentArray.java
@@ -46,7 +46,7 @@ import java.util.Random;
* I added hybrid most-recent-sequential-range + shared-bitset idea, multi-thread-safety
*/
-public class PersistentArray extends Obj implements Iterable, IArray, Cloneable {
+public class PersistentArray extends AnArray implements Iterable {
public Iterator iterator(){
return new ValIter(this);
@@ -58,17 +58,7 @@ public ISeq seq() {
return null;
}
-public Obj withMeta(IPersistentMap meta) {
- try{
- Obj ret = (Obj) clone();
- ret._meta = meta;
- return ret;
- }
- catch(CloneNotSupportedException ignore)
- {
- return null;
- }
-}
+
static class Master{
final Entry[] array;
diff --git a/src/jvm/clojure/lang/Tuple.java b/src/jvm/clojure/lang/Tuple.java
index da4cb152..3117227c 100644
--- a/src/jvm/clojure/lang/Tuple.java
+++ b/src/jvm/clojure/lang/Tuple.java
@@ -12,7 +12,7 @@
package clojure.lang;
-public class Tuple implements IArray{
+public class Tuple extends AnArray{
final Object[] array;