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 class
PersistentTrieMap.AbstractMapIterator<K,V>
Iterator skeleton that uses a fixed stack in depth.protected static class
PersistentTrieMap.AbstractMapNode<K,V>
private static class
PersistentTrieMap.BitmapIndexedMapNode<K,V>
protected static class
PersistentTrieMap.CompactMapNode<K,V>
protected static class
PersistentTrieMap.CompactMixedMapNode<K,V>
private static class
PersistentTrieMap.HashCollisionMapNode<K,V>
protected static class
PersistentTrieMap.MapEntryIterator<K,V>
protected static class
PersistentTrieMap.MapKeyIterator<K,V>
protected static class
PersistentTrieMap.MapValueIterator<K,V>
(package private) static class
PersistentTrieMap.TransientTrieMap<K,V>
private static class
PersistentTrieMap.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 int
cachedHashCode
private int
cachedSize
private static boolean
DEBUG
private static PersistentTrieMap
EMPTY_MAP
private static PersistentTrieMap.CompactMapNode
EMPTY_NODE
private PersistentTrieMap.AbstractMapNode<K,V>
rootNode
private static long
serialVersionUID
-
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 boolean
checkHashCodeAndSize(int targetHash, int targetSize)
void
clear()
boolean
containsKey(java.lang.Object o)
boolean
containsKeyEquivalent(java.lang.Object o, EqualityComparator<java.lang.Object> cmp)
boolean
containsValue(java.lang.Object o)
boolean
containsValueEquivalent(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()
boolean
equals(java.lang.Object other)
boolean
equivalent(java.lang.Object other, EqualityComparator<java.lang.Object> cmp)
V
get(java.lang.Object o)
V
getEquivalent(java.lang.Object o, EqualityComparator<java.lang.Object> cmp)
protected int
getNodeCount()
protected PersistentTrieMap.AbstractMapNode<K,V>
getRootNode()
int
hashCode()
boolean
isEmpty()
boolean
isTransientSupported()
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)
void
printStatistics()
V
put(K key, V val)
void
putAll(java.util.Map<? extends K,? extends V> m)
V
remove(java.lang.Object key)
int
size()
java.lang.String
toString()
static int
transformHashCode(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:
containsKeyEquivalent
in 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:
containsValueEquivalent
in 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:
getEquivalent
in interfaceMapEq<K,V>
-
__put
public Map.Immutable<K,V> __put(K key, V val)
- Specified by:
__put
in interfaceMap.Immutable<K,V>
-
__putEquivalent
public Map.Immutable<K,V> __putEquivalent(K key, V val, EqualityComparator<java.lang.Object> cmp)
- Specified by:
__putEquivalent
in interfaceMapEq.Immutable<K,V>
-
__putAll
public Map.Immutable<K,V> __putAll(java.util.Map<? extends K,? extends V> map)
- Specified by:
__putAll
in 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:
__putAllEquivalent
in interfaceMapEq.Immutable<K,V>
-
__remove
public Map.Immutable<K,V> __remove(K key)
- Specified by:
__remove
in interfaceMap.Immutable<K,V>
-
__removeEquivalent
public Map.Immutable<K,V> __removeEquivalent(K key, EqualityComparator<java.lang.Object> cmp)
- Specified by:
__removeEquivalent
in interfaceMapEq.Immutable<K,V>
-
size
public int size()
-
isEmpty
public boolean isEmpty()
-
keyIterator
public java.util.Iterator<K> keyIterator()
- Specified by:
keyIterator
in interfaceMap<K,V>
-
valueIterator
public java.util.Iterator<V> valueIterator()
- Specified by:
valueIterator
in interfaceMap<K,V>
-
entryIterator
public java.util.Iterator<java.util.Map.Entry<K,V>> entryIterator()
- Specified by:
entryIterator
in 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:
equivalent
in interfaceMapEq<K,V>
-
hashCode
public int hashCode()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
isTransientSupported
public boolean isTransientSupported()
- Specified by:
isTransientSupported
in interfaceMap.Immutable<K,V>
-
asTransient
public Map.Transient<K,V> asTransient()
- Specified by:
asTransient
in 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()
-
-