org.codehaus.gpars

groovyx.gpars.extra166y
[Java] Class PAS.UniquifierTable

java.lang.Object
  java.util.concurrent.atomic.AtomicLongArray
      groovyx.gpars.extra166y.PAS.UniquifierTable

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.


Field Summary
boolean byIdentity

AbstractParallelAnyArray pap

 
Constructor Summary
PAS.UniquifierTable(int size, AbstractParallelAnyArray pap, boolean byIdentity)

 
Method Summary
int addDoubles(int lo, int hi)

int addLongs(int lo, int hi)

int addObjects(int lo, int hi)

static int hash(int h)

static int tableSizeFor(int n)

Returns a good size for table

double[] uniqueDoubles(int size)

long[] uniqueLongs(int size)

java.lang.Object[] uniqueObjects(int size)

Returns new array holding all elements.

 
Methods inherited from class java.util.concurrent.atomic.AtomicLongArray
java.util.concurrent.atomic.AtomicLongArray#get(int), java.util.concurrent.atomic.AtomicLongArray#toString(), java.util.concurrent.atomic.AtomicLongArray#length(), java.util.concurrent.atomic.AtomicLongArray#set(int, long), java.util.concurrent.atomic.AtomicLongArray#getAndAdd(int, long), java.util.concurrent.atomic.AtomicLongArray#addAndGet(int, long), java.util.concurrent.atomic.AtomicLongArray#compareAndSet(int, long, long), java.util.concurrent.atomic.AtomicLongArray#decrementAndGet(int), java.util.concurrent.atomic.AtomicLongArray#getAndDecrement(int), java.util.concurrent.atomic.AtomicLongArray#getAndIncrement(int), java.util.concurrent.atomic.AtomicLongArray#getAndSet(int, long), java.util.concurrent.atomic.AtomicLongArray#incrementAndGet(int), java.util.concurrent.atomic.AtomicLongArray#lazySet(int, long), java.util.concurrent.atomic.AtomicLongArray#weakCompareAndSet(int, long, long), java.util.concurrent.atomic.AtomicLongArray#wait(long), java.util.concurrent.atomic.AtomicLongArray#wait(), java.util.concurrent.atomic.AtomicLongArray#wait(long, int), java.util.concurrent.atomic.AtomicLongArray#equals(java.lang.Object), java.util.concurrent.atomic.AtomicLongArray#hashCode(), java.util.concurrent.atomic.AtomicLongArray#getClass(), java.util.concurrent.atomic.AtomicLongArray#notify(), java.util.concurrent.atomic.AtomicLongArray#notifyAll()
 
Methods inherited from class java.lang.Object
java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Field Detail

byIdentity

final boolean byIdentity


pap

final AbstractParallelAnyArray pap


 
Constructor Detail

PAS.UniquifierTable

PAS.UniquifierTable(int size, AbstractParallelAnyArray pap, boolean byIdentity)


 
Method Detail

addDoubles

int addDoubles(int lo, int hi)


addLongs

int addLongs(int lo, int hi)


addObjects

int addObjects(int lo, int hi)


hash

static int hash(int h)


tableSizeFor

static int tableSizeFor(int n)
Returns a good size for table


uniqueDoubles

double[] uniqueDoubles(int size)


uniqueLongs

long[] uniqueLongs(int size)


uniqueObjects

java.lang.Object[] uniqueObjects(int size)
Returns new array holding all elements.


 

Copyright © 2008–2012 Václav Pech. All Rights Reserved.