summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Hickey <richhickey@gmail.com>2006-07-28 14:42:29 +0000
committerRich Hickey <richhickey@gmail.com>2006-07-28 14:42:29 +0000
commit38f212abb55f9f660210f24a2b64cf919496c8ec (patch)
treeccd60c1fd174ca20a63ae13beed80301672e1a2b
parent96bba60242bb80342b7a424496d27dfe87046844 (diff)
removed hybrid maps
-rw-r--r--src/jvm/clojure/lang/PersistentHybridIdentityMap.java47
-rw-r--r--src/jvm/clojure/lang/PersistentHybridMap.java109
2 files changed, 0 insertions, 156 deletions
diff --git a/src/jvm/clojure/lang/PersistentHybridIdentityMap.java b/src/jvm/clojure/lang/PersistentHybridIdentityMap.java
deleted file mode 100644
index 871073a3..00000000
--- a/src/jvm/clojure/lang/PersistentHybridIdentityMap.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * 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 class PersistentHybridIdentityMap extends PersistentHybridMap{
-
-public PersistentHybridIdentityMap(Object[] init) {
- super(init);
-}
-
-public PersistentHybridIdentityMap(int initialCapacity) {
- super(initialCapacity);
-}
-
-PersistentHybridIdentityMap(IPersistentMap impl) {
- super(impl);
-}
-
-public IPersistentMap create(IPersistentMap impl) {
- return new PersistentHybridIdentityMap(impl);
-}
-
-public PersistentArrayMap createArrayMap(Object[] init) {
- return new PersistentArrayIdentityMap(init);
-}
-
-IPersistentMap createArrayMap() {
- return PersistentArrayIdentityMap.EMPTY;
-}
-
-IPersistentMap createHashtableMap(Object[] init) {
- return new PersistentHashtableIdentityMap(init);
-}
-
-IPersistentMap createHashtableMap(int initialCapacity) {
- return new PersistentHashtableIdentityMap(initialCapacity);
-}
-
-}
diff --git a/src/jvm/clojure/lang/PersistentHybridMap.java b/src/jvm/clojure/lang/PersistentHybridMap.java
deleted file mode 100644
index a8b7627a..00000000
--- a/src/jvm/clojure/lang/PersistentHybridMap.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/**
- * 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;
-
-import java.util.Iterator;
-
-public class PersistentHybridMap implements IPersistentMap{
-
-IPersistentMap impl;
-static final int CAPACITY_THRESHOLD = 42;
-
-public PersistentHybridMap(Object[] init){
- if(init.length/2 < CAPACITY_THRESHOLD)
- impl = createArrayMap(init);
- impl = createHashtableMap(init);
-}
-
-public PersistentHybridMap(int initialCapacity){
- if(initialCapacity < CAPACITY_THRESHOLD)
- impl = createArrayMap();
- else
- impl = createHashtableMap(initialCapacity);
-}
-
-PersistentHybridMap(IPersistentMap impl){
- this.impl = impl;
-}
-
-public int count() {
- return impl.count();
-}
-
-public boolean contains(Object key) {
- return impl.contains(key);
-}
-
-public IMapEntry find(Object key) {
- return impl.find(key);
-}
-
-public IPersistentMap add(Object key, Object val) throws Exception {
- IPersistentMap newImpl = impl.add(key,val);
- if(newImpl.capacity() == CAPACITY_THRESHOLD)
- {
- newImpl = createHashtableMap(((PersistentArrayMap)newImpl).array);
- }
- return create(newImpl);
-}
-
-public IPersistentMap put(Object key, Object val) {
- IPersistentMap newImpl = impl.put(key,val);
- if(newImpl.capacity() == CAPACITY_THRESHOLD)
- {
- newImpl = createHashtableMap(((PersistentArrayMap)newImpl).array);
- }
- return create(newImpl);
-}
-
-public IPersistentMap remove(Object key) {
- IPersistentMap newImpl = impl.remove(key);
- if(newImpl != impl)
- return create(newImpl);
- return this;
-}
-
-public Object get(Object key) {
- return impl.get(key);
-}
-
-public int capacity() {
- return impl.capacity();
-}
-
-public Iterator iterator() {
- return ((Iterable)impl).iterator();
-}
-
-public IPersistentMap create(IPersistentMap impl) {
- return new PersistentHybridMap(impl);
-}
-
-public PersistentArrayMap createArrayMap(Object[] init) {
- return new PersistentArrayMap(init);
-}
-
-IPersistentMap createArrayMap() {
- return PersistentArrayMap.EMPTY;
-}
-
-IPersistentMap createHashtableMap(Object[] init) {
- return new PersistentHashtableMap(init);
-}
-
-IPersistentMap createHashtableMap(int initialCapacity) {
- return new PersistentHashtableMap(initialCapacity);
-}
-
-public ISeq seq() throws Exception {
- return impl.seq();
-}
-}