org.jjoost.collections.base
Class SerialHashStore<N extends SerialHashStore.SerialHashNode<N>>

java.lang.Object
  extended by org.jjoost.collections.base.SerialHashStore<N>
All Implemented Interfaces:
java.io.Serializable, HashStore<N>
Direct Known Subclasses:
SerialLinkedHashStore

public class SerialHashStore<N extends SerialHashStore.SerialHashNode<N>>
extends java.lang.Object
implements HashStore<N>

See Also:
Serialized Form

Nested Class Summary
static class SerialHashStore.SerialHashNode<N extends SerialHashStore.SerialHashNode<N>>
           
 
Constructor Summary
SerialHashStore(int size, float loadFactor)
           
 
Method Summary
<NCmp,V> java.util.Iterator<V>
all(Function<? super N,? extends NCmp> nodePrefixEqProj, HashNodeEquality<? super NCmp,? super N> nodePrefixEq, Function<? super N,? extends V> retProj)
           
 int capacity()
           
 int clear()
           
<V> java.util.Iterator<V>
clearAndReturn(Function<? super N,? extends V> f)
           
<NCmp> boolean
contains(int hash, NCmp c, HashNodeEquality<? super NCmp,? super N> eq)
           
<NCmp> HashStore<N>
copy(Function<? super N,? extends NCmp> nodeEqualityProj, HashNodeEquality<? super NCmp,? super N> nodeEquality)
           
<NCmp> int
count(int hash, NCmp c, HashNodeEquality<? super NCmp,? super N> eq)
           
static Rehasher defaultRehasher()
           
<NCmp,V> V
ensureAndGet(int hash, NCmp put, HashNodeEquality<? super NCmp,? super N> eq, HashNodeFactory<? super NCmp,N> factory, Function<? super N,? extends V> ret)
           
<NCmp,NCmp2,V>
java.util.Iterator<V>
find(int hash, NCmp find, HashNodeEquality<? super NCmp,? super N> findEq, Function<? super N,? extends NCmp2> nodeEqualityProj, HashNodeEquality<? super NCmp2,? super N> nodeEq, Function<? super N,? extends V> ret)
           
<NCmp,V> java.util.List<V>
findNow(int hash, NCmp find, HashNodeEquality<? super NCmp,? super N> findEq, Function<? super N,? extends V> ret)
           
<NCmp,V> V
first(int hash, NCmp c, HashNodeEquality<? super NCmp,? super N> eq, Function<? super N,? extends V> ret)
           
 boolean isEmpty()
           
<NCmp,V> V
put(NCmp find, N put, HashNodeEquality<? super NCmp,? super N> eq, Function<? super N,? extends V> ret)
           
<NCmp,V> V
putIfAbsent(int hash, NCmp put, HashNodeEquality<? super NCmp,? super N> eq, HashNodeFactory<? super NCmp,N> factory, Function<? super N,? extends V> ret)
           
<NCmp,V> V
putIfAbsent(NCmp find, N put, HashNodeEquality<? super NCmp,? super N> eq, Function<? super N,? extends V> ret)
           
<NCmp> int
remove(int hash, int removeAtMost, NCmp find, HashNodeEquality<? super NCmp,? super N> eq)
           
<NCmp,V> java.lang.Iterable<V>
removeAndReturn(int hash, int removeAtMost, NCmp c, HashNodeEquality<? super NCmp,? super N> eq, Function<? super N,? extends V> ret)
           
<NCmp,V> V
removeAndReturnFirst(int hash, int removeAtMost, NCmp c, HashNodeEquality<? super NCmp,? super N> eq, Function<? super N,? extends V> ret)
           
<NCmp> boolean
removeNode(Function<? super N,? extends NCmp> nodePrefixEqFunc, HashNodeEquality<? super NCmp,? super N> nodePrefixEq, N n)
           
 void resize(int size)
           
 void shrink()
           
 java.lang.String toString()
           
 int totalCount()
           
<NCmp,NCmp2,V>
java.util.Iterator<V>
unique(Function<? super N,? extends NCmp> uniquenessEqualityProj, Equality<? super NCmp> uniquenessEquality, Function<? super N,? extends NCmp2> nodeEqualityProj, HashNodeEquality<? super NCmp2,? super N> nodeEquality, Function<? super N,? extends V> ret)
           
 int uniquePrefixCount()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SerialHashStore

public SerialHashStore(int size,
                       float loadFactor)
Method Detail

capacity

public int capacity()
Specified by:
capacity in interface HashStore<N extends SerialHashStore.SerialHashNode<N>>

totalCount

public int totalCount()
Specified by:
totalCount in interface HashStore<N extends SerialHashStore.SerialHashNode<N>>

uniquePrefixCount

public int uniquePrefixCount()
Specified by:
uniquePrefixCount in interface HashStore<N extends SerialHashStore.SerialHashNode<N>>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface HashStore<N extends SerialHashStore.SerialHashNode<N>>

clear

public int clear()
Specified by:
clear in interface HashStore<N extends SerialHashStore.SerialHashNode<N>>

clearAndReturn

public <V> java.util.Iterator<V> clearAndReturn(Function<? super N,? extends V> f)
Specified by:
clearAndReturn in interface HashStore<N extends SerialHashStore.SerialHashNode<N>>

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

put

public <NCmp,V> V put(NCmp find,
                      N put,
                      HashNodeEquality<? super NCmp,? super N> eq,
                      Function<? super N,? extends V> ret)
Specified by:
put in interface HashStore<N extends SerialHashStore.SerialHashNode<N>>

putIfAbsent

public <NCmp,V> V putIfAbsent(NCmp find,
                              N put,
                              HashNodeEquality<? super NCmp,? super N> eq,
                              Function<? super N,? extends V> ret)
Specified by:
putIfAbsent in interface HashStore<N extends SerialHashStore.SerialHashNode<N>>

putIfAbsent

public <NCmp,V> V putIfAbsent(int hash,
                              NCmp put,
                              HashNodeEquality<? super NCmp,? super N> eq,
                              HashNodeFactory<? super NCmp,N> factory,
                              Function<? super N,? extends V> ret)
Specified by:
putIfAbsent in interface HashStore<N extends SerialHashStore.SerialHashNode<N>>

ensureAndGet

public <NCmp,V> V ensureAndGet(int hash,
                               NCmp put,
                               HashNodeEquality<? super NCmp,? super N> eq,
                               HashNodeFactory<? super NCmp,N> factory,
                               Function<? super N,? extends V> ret)
Specified by:
ensureAndGet in interface HashStore<N extends SerialHashStore.SerialHashNode<N>>

remove

public <NCmp> int remove(int hash,
                         int removeAtMost,
                         NCmp find,
                         HashNodeEquality<? super NCmp,? super N> eq)
Specified by:
remove in interface HashStore<N extends SerialHashStore.SerialHashNode<N>>

removeNode

public <NCmp> boolean removeNode(Function<? super N,? extends NCmp> nodePrefixEqFunc,
                                 HashNodeEquality<? super NCmp,? super N> nodePrefixEq,
                                 N n)
Specified by:
removeNode in interface HashStore<N extends SerialHashStore.SerialHashNode<N>>

removeAndReturn

public <NCmp,V> java.lang.Iterable<V> removeAndReturn(int hash,
                                                      int removeAtMost,
                                                      NCmp c,
                                                      HashNodeEquality<? super NCmp,? super N> eq,
                                                      Function<? super N,? extends V> ret)
Specified by:
removeAndReturn in interface HashStore<N extends SerialHashStore.SerialHashNode<N>>

removeAndReturnFirst

public <NCmp,V> V removeAndReturnFirst(int hash,
                                       int removeAtMost,
                                       NCmp c,
                                       HashNodeEquality<? super NCmp,? super N> eq,
                                       Function<? super N,? extends V> ret)
Specified by:
removeAndReturnFirst in interface HashStore<N extends SerialHashStore.SerialHashNode<N>>

contains

public <NCmp> boolean contains(int hash,
                               NCmp c,
                               HashNodeEquality<? super NCmp,? super N> eq)
Specified by:
contains in interface HashStore<N extends SerialHashStore.SerialHashNode<N>>

count

public <NCmp> int count(int hash,
                        NCmp c,
                        HashNodeEquality<? super NCmp,? super N> eq)
Specified by:
count in interface HashStore<N extends SerialHashStore.SerialHashNode<N>>

first

public <NCmp,V> V first(int hash,
                        NCmp c,
                        HashNodeEquality<? super NCmp,? super N> eq,
                        Function<? super N,? extends V> ret)
Specified by:
first in interface HashStore<N extends SerialHashStore.SerialHashNode<N>>

findNow

public <NCmp,V> java.util.List<V> findNow(int hash,
                                          NCmp find,
                                          HashNodeEquality<? super NCmp,? super N> findEq,
                                          Function<? super N,? extends V> ret)
Specified by:
findNow in interface HashStore<N extends SerialHashStore.SerialHashNode<N>>

find

public <NCmp,NCmp2,V> java.util.Iterator<V> find(int hash,
                                                 NCmp find,
                                                 HashNodeEquality<? super NCmp,? super N> findEq,
                                                 Function<? super N,? extends NCmp2> nodeEqualityProj,
                                                 HashNodeEquality<? super NCmp2,? super N> nodeEq,
                                                 Function<? super N,? extends V> ret)
Specified by:
find in interface HashStore<N extends SerialHashStore.SerialHashNode<N>>

all

public <NCmp,V> java.util.Iterator<V> all(Function<? super N,? extends NCmp> nodePrefixEqProj,
                                          HashNodeEquality<? super NCmp,? super N> nodePrefixEq,
                                          Function<? super N,? extends V> retProj)
Specified by:
all in interface HashStore<N extends SerialHashStore.SerialHashNode<N>>

unique

public <NCmp,NCmp2,V> java.util.Iterator<V> unique(Function<? super N,? extends NCmp> uniquenessEqualityProj,
                                                   Equality<? super NCmp> uniquenessEquality,
                                                   Function<? super N,? extends NCmp2> nodeEqualityProj,
                                                   HashNodeEquality<? super NCmp2,? super N> nodeEquality,
                                                   Function<? super N,? extends V> ret)
Specified by:
unique in interface HashStore<N extends SerialHashStore.SerialHashNode<N>>

shrink

public void shrink()
Specified by:
shrink in interface HashStore<N extends SerialHashStore.SerialHashNode<N>>

resize

public void resize(int size)
Specified by:
resize in interface HashStore<N extends SerialHashStore.SerialHashNode<N>>

copy

public <NCmp> HashStore<N> copy(Function<? super N,? extends NCmp> nodeEqualityProj,
                                HashNodeEquality<? super NCmp,? super N> nodeEquality)
Specified by:
copy in interface HashStore<N extends SerialHashStore.SerialHashNode<N>>

defaultRehasher

public static Rehasher defaultRehasher()