org.jjoost.collections.base
Class LockFreeHashStore<N extends LockFreeHashStore.LockFreeHashNode<N>>

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

public class LockFreeHashStore<N extends LockFreeHashStore.LockFreeHashNode<N>>
extends java.lang.Object
implements HashStore<N>

See Also:
Serialized Form

Nested Class Summary
static class LockFreeHashStore.Counting
           
static class LockFreeHashStore.LockFreeHashNode<N extends LockFreeHashStore.LockFreeHashNode<N>>
           
 
Constructor Summary
LockFreeHashStore(int initialCapacity, float loadFactor, LockFreeHashStore.Counting totalCounting, LockFreeHashStore.Counting uniquePrefixCounting)
           
 
Method Summary
<NCmp,V> java.util.Iterator<V>
all(Function<? super N,? extends NCmp> nodeEqualityProj, HashNodeEquality<? super NCmp,? super N> nodeEquality, Function<? super N,? extends V> ret)
           
 int capacity()
           
 int clear()
           
<V> java.util.Iterator<V>
clearAndReturn(Function<? super N,? extends V> ret)
           
<NCmp> boolean
contains(int hash, NCmp find, 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 find, HashNodeEquality<? super NCmp,? super N> eq)
           
<NCmp,V> V
ensureAndGet(int hash, NCmp find, 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> eq, Function<? super N,? extends V> ret)
           
<NCmp,V> V
first(int hash, NCmp find, 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 find, 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 find, HashNodeEquality<? super NCmp,? super N> eq, Function<? super N,? extends V> ret)
           
<NCmp,V> V
removeAndReturnFirst(int hash, int removeAtMost, NCmp find, 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

LockFreeHashStore

public LockFreeHashStore(int initialCapacity,
                         float loadFactor,
                         LockFreeHashStore.Counting totalCounting,
                         LockFreeHashStore.Counting uniquePrefixCounting)
Method Detail

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 LockFreeHashStore.LockFreeHashNode<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 LockFreeHashStore.LockFreeHashNode<N>>

putIfAbsent

public <NCmp,V> V putIfAbsent(int hash,
                              NCmp find,
                              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 LockFreeHashStore.LockFreeHashNode<N>>

ensureAndGet

public <NCmp,V> V ensureAndGet(int hash,
                               NCmp find,
                               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 LockFreeHashStore.LockFreeHashNode<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 LockFreeHashStore.LockFreeHashNode<N>>

removeAndReturnFirst

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

removeAndReturn

public <NCmp,V> java.lang.Iterable<V> removeAndReturn(int hash,
                                                      int removeAtMost,
                                                      NCmp find,
                                                      HashNodeEquality<? super NCmp,? super N> eq,
                                                      Function<? super N,? extends V> ret)
Specified by:
removeAndReturn in interface HashStore<N extends LockFreeHashStore.LockFreeHashNode<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 LockFreeHashStore.LockFreeHashNode<N>>

contains

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

count

public <NCmp> int count(int hash,
                        NCmp find,
                        HashNodeEquality<? super NCmp,? super N> eq)
Specified by:
count in interface HashStore<N extends LockFreeHashStore.LockFreeHashNode<N>>

first

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

findNow

public <NCmp,V> java.util.List<V> findNow(int hash,
                                          NCmp find,
                                          HashNodeEquality<? super NCmp,? super N> eq,
                                          Function<? super N,? extends V> ret)
Specified by:
findNow in interface HashStore<N extends LockFreeHashStore.LockFreeHashNode<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 LockFreeHashStore.LockFreeHashNode<N>>

all

public <NCmp,V> java.util.Iterator<V> all(Function<? super N,? extends NCmp> nodeEqualityProj,
                                          HashNodeEquality<? super NCmp,? super N> nodeEquality,
                                          Function<? super N,? extends V> ret)
Specified by:
all in interface HashStore<N extends LockFreeHashStore.LockFreeHashNode<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 LockFreeHashStore.LockFreeHashNode<N>>

clearAndReturn

public <V> java.util.Iterator<V> clearAndReturn(Function<? super N,? extends V> ret)
Specified by:
clearAndReturn in interface HashStore<N extends LockFreeHashStore.LockFreeHashNode<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 LockFreeHashStore.LockFreeHashNode<N>>

toString

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

clear

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

isEmpty

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

capacity

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

totalCount

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

uniquePrefixCount

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

resize

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

shrink

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