org.drools.core.util
Class ConcurrentHashTable

java.lang.Object
  extended by org.drools.core.util.ConcurrentHashTable

public class ConcurrentHashTable
extends Object


Constructor Summary
ConcurrentHashTable(AbstractHashTable.FieldIndex[] index)
          Creates a new, empty map with a default initial capacity (16), load factor (0.75) and concurrencyLevel (16).
ConcurrentHashTable(AbstractHashTable.FieldIndex[] index, int initialCapacity)
          Creates a new, empty map with the specified initial capacity, and with default load factor (0.75) and concurrencyLevel (16).
ConcurrentHashTable(AbstractHashTable.FieldIndex[] index, int initialCapacity, float loadFactor)
          Creates a new, empty map with the specified initial capacity and load factor and with the default concurrencyLevel (16).
ConcurrentHashTable(AbstractHashTable.FieldIndex[] index, int initialCapacity, float loadFactor, int concurrencyLevel)
          Creates a new, empty map with the specified initial capacity, load factor and concurrency level.
 
Method Summary
 void add(RightTuple rightTuple)
           
 void clear()
          Removes all of the mappings from this map.
 RightTupleList get(LeftTuple tuple, InternalFactHandle factHandle)
           
 boolean isEmpty()
          Returns true if this map contains no key-value mappings.
 void remove(RightTuple rightTuple)
          Removes the key (and its corresponding value) from this map.
 int size()
          Returns the number of key-value mappings in this map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConcurrentHashTable

public ConcurrentHashTable(AbstractHashTable.FieldIndex[] index,
                           int initialCapacity,
                           float loadFactor,
                           int concurrencyLevel)
Creates a new, empty map with the specified initial capacity, load factor and concurrency level.

Parameters:
initialCapacity - the initial capacity. The implementation performs internal sizing to accommodate this many elements.
loadFactor - the load factor threshold, used to control resizing. Resizing may be performed when the average number of elements per bin exceeds this threshold.
concurrencyLevel - the estimated number of concurrently updating threads. The implementation performs internal sizing to try to accommodate this many threads.
Throws:
IllegalArgumentException - if the initial capacity is negative or the load factor or concurrencyLevel are nonpositive.

ConcurrentHashTable

public ConcurrentHashTable(AbstractHashTable.FieldIndex[] index,
                           int initialCapacity,
                           float loadFactor)
Creates a new, empty map with the specified initial capacity and load factor and with the default concurrencyLevel (16).

Parameters:
initialCapacity - The implementation performs internal sizing to accommodate this many elements.
loadFactor - the load factor threshold, used to control resizing. Resizing may be performed when the average number of elements per bin exceeds this threshold.
Throws:
IllegalArgumentException - if the initial capacity of elements is negative or the load factor is nonpositive
Since:
1.6

ConcurrentHashTable

public ConcurrentHashTable(AbstractHashTable.FieldIndex[] index,
                           int initialCapacity)
Creates a new, empty map with the specified initial capacity, and with default load factor (0.75) and concurrencyLevel (16).

Parameters:
initialCapacity - the initial capacity. The implementation performs internal sizing to accommodate this many elements.
Throws:
IllegalArgumentException - if the initial capacity of elements is negative.

ConcurrentHashTable

public ConcurrentHashTable(AbstractHashTable.FieldIndex[] index)
Creates a new, empty map with a default initial capacity (16), load factor (0.75) and concurrencyLevel (16).

Method Detail

isEmpty

public boolean isEmpty()
Returns true if this map contains no key-value mappings.

Returns:
true if this map contains no key-value mappings

size

public int size()
Returns the number of key-value mappings in this map. If the map contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.

Returns:
the number of key-value mappings in this map

add

public void add(RightTuple rightTuple)

remove

public void remove(RightTuple rightTuple)
Removes the key (and its corresponding value) from this map. This method does nothing if the key is not in the map.

Parameters:
key - the key that needs to be removed
Throws:
NullPointerException - if the specified key is null

get

public RightTupleList get(LeftTuple tuple,
                          InternalFactHandle factHandle)

clear

public void clear()
Removes all of the mappings from this map.



Copyright © 2001-2013 JBoss Inc.. All Rights Reserved.