summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRich Hickey <richhickey@gmail.com>2006-07-28 14:42:07 +0000
committerRich Hickey <richhickey@gmail.com>2006-07-28 14:42:07 +0000
commit96bba60242bb80342b7a424496d27dfe87046844 (patch)
treebd83a384219412673e06f25a403d9df0fd3918ff /src
parentf0ebcbc30c8f2ae9144259caed61495ef753ab72 (diff)
removed hybrid maps
Diffstat (limited to 'src')
-rw-r--r--src/cli/runtime/PersistentHybridIdentityMap.cs50
-rw-r--r--src/cli/runtime/PersistentHybridMap.cs119
2 files changed, 0 insertions, 169 deletions
diff --git a/src/cli/runtime/PersistentHybridIdentityMap.cs b/src/cli/runtime/PersistentHybridIdentityMap.cs
deleted file mode 100644
index 2d2acdca..00000000
--- a/src/cli/runtime/PersistentHybridIdentityMap.cs
+++ /dev/null
@@ -1,50 +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.
- **/
-
-using System;
-using System.Collections;
-
-namespace clojure.lang
-{
-
-public class PersistentHybridIdentityMap : PersistentHybridMap{
-
-public PersistentHybridIdentityMap(Object[] init) :base(init) {
-}
-
-public PersistentHybridIdentityMap(int initialCapacity) :base(initialCapacity) {
-}
-
-PersistentHybridIdentityMap(IPersistentMap impl) :base(impl) {
-}
-
-override public IPersistentMap create(IPersistentMap impl) {
- return new PersistentHybridIdentityMap(impl);
-}
-
-override public PersistentArrayMap createArrayMap(Object[] init) {
- return new PersistentArrayIdentityMap(init);
-}
-
-override internal IPersistentMap createArrayMap() {
- return PersistentArrayIdentityMap.EMPTY;
-}
-
-override internal IPersistentMap createHashtableMap(Object[] init) {
- return new PersistentHashtableIdentityMap(init);
-}
-
-override internal IPersistentMap createHashtableMap(int initialCapacity) {
- return new PersistentHashtableIdentityMap(initialCapacity);
-}
-
-}
-
-}
diff --git a/src/cli/runtime/PersistentHybridMap.cs b/src/cli/runtime/PersistentHybridMap.cs
deleted file mode 100644
index 211ca7a3..00000000
--- a/src/cli/runtime/PersistentHybridMap.cs
+++ /dev/null
@@ -1,119 +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.
- **/
-
-using System;
-using System.Collections;
-
-namespace clojure.lang
-{
-
-public class PersistentHybridMap : IPersistentMap{
-
-IPersistentMap impl;
-static readonly 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);
-}
-
-internal PersistentHybridMap(IPersistentMap impl){
- this.impl = impl;
-}
-
-public int count() {
- return impl.count();
-}
-
-public bool contains(Object key) {
- return impl.contains(key);
-}
-
-public IMapEntry find(Object key) {
- return impl.find(key);
-}
-
-public IPersistentMap add(Object key,Object val) {
- 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 IEnumerator GetEnumerator() {
- return impl.GetEnumerator();
-}
-
-virtual public IPersistentMap create(IPersistentMap impl) {
- return new PersistentHybridMap(impl);
-}
-
-virtual public PersistentArrayMap createArrayMap(Object[] init) {
- return new PersistentArrayMap(init);
-}
-
-virtual internal IPersistentMap createArrayMap() {
- return PersistentArrayMap.EMPTY;
-}
-
-virtual internal IPersistentMap createHashtableMap(Object[] init) {
- return new PersistentHashtableMap(init);
-}
-
-virtual internal IPersistentMap createHashtableMap(int initialCapacity) {
- return new PersistentHashtableMap(initialCapacity);
-}
-
-
-#region ISequential Members
-
-public ISeq seq()
- {
- return impl.seq();
- }
-
-#endregion
- }
-
-}