Package io.usethesource.capsule.core
Class PersistentTrieMap<K,V>
- java.lang.Object
-
- io.usethesource.capsule.core.PersistentTrieMap<K,V>
-
- All Implemented Interfaces:
Map<K,V>,Map.Immutable<K,V>,MapEq<K,V>,MapEq.Immutable<K,V>,java.io.Serializable,java.util.Map<K,V>
public class PersistentTrieMap<K,V> extends java.lang.Object implements Map.Immutable<K,V>, java.io.Serializable
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classPersistentTrieMap.AbstractMapIterator<K,V>Iterator skeleton that uses a fixed stack in depth.protected static classPersistentTrieMap.AbstractMapNode<K,V>private static classPersistentTrieMap.BitmapIndexedMapNode<K,V>protected static classPersistentTrieMap.CompactMapNode<K,V>protected static classPersistentTrieMap.CompactMixedMapNode<K,V>private static classPersistentTrieMap.HashCollisionMapNode<K,V>protected static classPersistentTrieMap.MapEntryIterator<K,V>protected static classPersistentTrieMap.MapKeyIterator<K,V>protected static classPersistentTrieMap.MapValueIterator<K,V>(package private) static classPersistentTrieMap.TransientTrieMap<K,V>private static classPersistentTrieMap.TrieMapNodeIterator<K,V>Iterator that first iterates over inlined-values and then continues depth first recursively.-
Nested classes/interfaces inherited from interface io.usethesource.capsule.Map
Map.Immutable<K,V>, Map.Transient<K,V>
-
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K extends java.lang.Object,V extends java.lang.Object>
-
Nested classes/interfaces inherited from interface io.usethesource.capsule.MapEq
MapEq.Immutable<K,V>, MapEq.Transient<K,V>
-
-
Field Summary
Fields Modifier and Type Field Description private intcachedHashCodeprivate intcachedSizeprivate static booleanDEBUGprivate static PersistentTrieMapEMPTY_MAPprivate static PersistentTrieMap.CompactMapNodeEMPTY_NODEprivate PersistentTrieMap.AbstractMapNode<K,V>rootNodeprivate static longserialVersionUID
-
Constructor Summary
Constructors Constructor Description PersistentTrieMap(PersistentTrieMap.AbstractMapNode<K,V> rootNode, int cachedHashCode, int cachedSize)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Map.Immutable<K,V>__put(K key, V val)Map.Immutable<K,V>__putAll(java.util.Map<? extends K,? extends V> map)Map.Immutable<K,V>__putAllEquivalent(java.util.Map<? extends K,? extends V> map, EqualityComparator<java.lang.Object> cmp)Map.Immutable<K,V>__putEquivalent(K key, V val, EqualityComparator<java.lang.Object> cmp)Map.Immutable<K,V>__remove(K key)Map.Immutable<K,V>__removeEquivalent(K key, EqualityComparator<java.lang.Object> cmp)protected int[][]arityCombinationsHistogram()protected int[]arityHistogram()Map.Transient<K,V>asTransient()private booleancheckHashCodeAndSize(int targetHash, int targetSize)voidclear()booleancontainsKey(java.lang.Object o)booleancontainsKeyEquivalent(java.lang.Object o, EqualityComparator<java.lang.Object> cmp)booleancontainsValue(java.lang.Object o)booleancontainsValueEquivalent(java.lang.Object o, EqualityComparator<java.lang.Object> cmp)java.util.Iterator<java.util.Map.Entry<K,V>>entryIterator()java.util.Set<java.util.Map.Entry<K,V>>entrySet()booleanequals(java.lang.Object other)booleanequivalent(java.lang.Object other, EqualityComparator<java.lang.Object> cmp)Vget(java.lang.Object o)VgetEquivalent(java.lang.Object o, EqualityComparator<java.lang.Object> cmp)protected intgetNodeCount()protected PersistentTrieMap.AbstractMapNode<K,V>getRootNode()inthashCode()booleanisEmpty()booleanisTransientSupported()java.util.Iterator<K>keyIterator()java.util.Set<K>keySet()protected java.util.Iterator<PersistentTrieMap.AbstractMapNode<K,V>>nodeIterator()static <K,V>
Map.Immutable<K,V>of()static <K,V>
Map.Immutable<K,V>of(java.lang.Object... keyValuePairs)voidprintStatistics()Vput(K key, V val)voidputAll(java.util.Map<? extends K,? extends V> m)Vremove(java.lang.Object key)intsize()java.lang.StringtoString()static inttransformHashCode(int hash)static <K,V>
Map.Transient<K,V>transientOf()static <K,V>
Map.Transient<K,V>transientOf(java.lang.Object... keyValuePairs)java.util.Iterator<V>valueIterator()java.util.Collection<V>values()
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
EMPTY_NODE
private static final PersistentTrieMap.CompactMapNode EMPTY_NODE
-
EMPTY_MAP
private static final PersistentTrieMap EMPTY_MAP
-
DEBUG
private static final boolean DEBUG
- See Also:
- Constant Field Values
-
rootNode
private final PersistentTrieMap.AbstractMapNode<K,V> rootNode
-
cachedHashCode
private final int cachedHashCode
-
cachedSize
private final int cachedSize
-
-
Constructor Detail
-
PersistentTrieMap
PersistentTrieMap(PersistentTrieMap.AbstractMapNode<K,V> rootNode, int cachedHashCode, int cachedSize)
-
-
Method Detail
-
of
public static final <K,V> Map.Immutable<K,V> of()
-
of
public static final <K,V> Map.Immutable<K,V> of(java.lang.Object... keyValuePairs)
-
transientOf
public static final <K,V> Map.Transient<K,V> transientOf()
-
transientOf
public static final <K,V> Map.Transient<K,V> transientOf(java.lang.Object... keyValuePairs)
-
checkHashCodeAndSize
private boolean checkHashCodeAndSize(int targetHash, int targetSize)
-
transformHashCode
public static final int transformHashCode(int hash)
-
containsKey
public boolean containsKey(java.lang.Object o)
-
containsKeyEquivalent
public boolean containsKeyEquivalent(java.lang.Object o, EqualityComparator<java.lang.Object> cmp)- Specified by:
containsKeyEquivalentin interfaceMapEq<K,V>
-
containsValue
public boolean containsValue(java.lang.Object o)
-
containsValueEquivalent
public boolean containsValueEquivalent(java.lang.Object o, EqualityComparator<java.lang.Object> cmp)- Specified by:
containsValueEquivalentin interfaceMapEq<K,V>
-
get
public V get(java.lang.Object o)
-
getEquivalent
public V getEquivalent(java.lang.Object o, EqualityComparator<java.lang.Object> cmp)
- Specified by:
getEquivalentin interfaceMapEq<K,V>
-
__put
public Map.Immutable<K,V> __put(K key, V val)
- Specified by:
__putin interfaceMap.Immutable<K,V>
-
__putEquivalent
public Map.Immutable<K,V> __putEquivalent(K key, V val, EqualityComparator<java.lang.Object> cmp)
- Specified by:
__putEquivalentin interfaceMapEq.Immutable<K,V>
-
__putAll
public Map.Immutable<K,V> __putAll(java.util.Map<? extends K,? extends V> map)
- Specified by:
__putAllin interfaceMap.Immutable<K,V>
-
__putAllEquivalent
public Map.Immutable<K,V> __putAllEquivalent(java.util.Map<? extends K,? extends V> map, EqualityComparator<java.lang.Object> cmp)
- Specified by:
__putAllEquivalentin interfaceMapEq.Immutable<K,V>
-
__remove
public Map.Immutable<K,V> __remove(K key)
- Specified by:
__removein interfaceMap.Immutable<K,V>
-
__removeEquivalent
public Map.Immutable<K,V> __removeEquivalent(K key, EqualityComparator<java.lang.Object> cmp)
- Specified by:
__removeEquivalentin interfaceMapEq.Immutable<K,V>
-
size
public int size()
-
isEmpty
public boolean isEmpty()
-
keyIterator
public java.util.Iterator<K> keyIterator()
- Specified by:
keyIteratorin interfaceMap<K,V>
-
valueIterator
public java.util.Iterator<V> valueIterator()
- Specified by:
valueIteratorin interfaceMap<K,V>
-
entryIterator
public java.util.Iterator<java.util.Map.Entry<K,V>> entryIterator()
- Specified by:
entryIteratorin interfaceMap<K,V>
-
values
public java.util.Collection<V> values()
-
equals
public boolean equals(java.lang.Object other)
-
equivalent
public boolean equivalent(java.lang.Object other, EqualityComparator<java.lang.Object> cmp)- Specified by:
equivalentin interfaceMapEq<K,V>
-
hashCode
public int hashCode()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
isTransientSupported
public boolean isTransientSupported()
- Specified by:
isTransientSupportedin interfaceMap.Immutable<K,V>
-
asTransient
public Map.Transient<K,V> asTransient()
- Specified by:
asTransientin interfaceMap.Immutable<K,V>
-
getRootNode
protected PersistentTrieMap.AbstractMapNode<K,V> getRootNode()
-
nodeIterator
protected java.util.Iterator<PersistentTrieMap.AbstractMapNode<K,V>> nodeIterator()
-
getNodeCount
protected int getNodeCount()
-
arityCombinationsHistogram
protected int[][] arityCombinationsHistogram()
-
arityHistogram
protected int[] arityHistogram()
-
printStatistics
public void printStatistics()
-
-