groovyx.gpars.extra166y
Class PAS.UniquifierTable
java.lang.Object
java.util.concurrent.atomic.AtomicLongArray
groovyx.gpars.extra166y.PAS.UniquifierTable
- All Implemented Interfaces:
- java.io.Serializable
- Enclosing class:
- PAS
static final class PAS.UniquifierTable
- extends java.util.concurrent.atomic.AtomicLongArray
Base class of fixed-size hash tables for
uniquification. Opportunistically subclasses
AtomicLongArray. The high word of each slot is the cached
massaged hash of an element, and the low word contains its
index, plus one, to ensure that a zero tab entry means
empty. The mechanics for this are just folded into the
main addElements method.
Each leaf step places source array elements into table,
Even though this table undergoes a lot of contention when
elements are concurrently inserted by parallel threads, it is
generally faster to do this than to have separate tables and
then merge them.
Method Summary |
(package private) int |
addDoubles(int lo,
int hi)
|
(package private) int |
addLongs(int lo,
int hi)
|
(package private) int |
addObjects(int lo,
int hi)
|
(package private) static int |
hash(int h)
|
(package private) static int |
tableSizeFor(int n)
Returns a good size for table |
(package private) double[] |
uniqueDoubles(int size)
|
(package private) long[] |
uniqueLongs(int size)
|
(package private) java.lang.Object[] |
uniqueObjects(int size)
Returns new array holding all elements. |
Methods inherited from class java.util.concurrent.atomic.AtomicLongArray |
addAndGet, compareAndSet, decrementAndGet, get, getAndAdd, getAndDecrement, getAndIncrement, getAndSet, incrementAndGet, lazySet, length, set, toString, weakCompareAndSet |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
pap
final AbstractParallelAnyArray pap
byIdentity
final boolean byIdentity
PAS.UniquifierTable
PAS.UniquifierTable(int size,
AbstractParallelAnyArray pap,
boolean byIdentity)
tableSizeFor
static int tableSizeFor(int n)
- Returns a good size for table
hash
static int hash(int h)
addObjects
int addObjects(int lo,
int hi)
addDoubles
int addDoubles(int lo,
int hi)
addLongs
int addLongs(int lo,
int hi)
uniqueObjects
java.lang.Object[] uniqueObjects(int size)
- Returns new array holding all elements.
uniqueDoubles
double[] uniqueDoubles(int size)
uniqueLongs
long[] uniqueLongs(int size)