Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

HashMap::Segment Class Reference

List of all members.

Public Member Functions

 this (int initialCapacity, float lf)
V get (K key, uint hash)
bool containsKey (K key, uint hash)
synchronized V replace (K key, uint hash, V newValue)
synchronized V put (K key, uint hash, V value, bool onlyIfAbsent)

Public Attributes

int count
int threshold
HashEntry[] table
float loadFactor

Private Member Functions

final void setTable (HashEntry[] newTable)
final HashEntry getFirst (uint hash)
final void rehash ()
synchronized V remove (K key, uint hash, V value)
synchronized void clear ()

Static Private Member Functions

bool matchKey (K a, K b)

Detailed Description

Segments are specialized versions of hash tables. This subclasses from ReentrantLock opportunistically, just to simplify some locking and avoid separate construction.

Definition at line 352 of file HashMap.d.


Member Function Documentation

this int  initialCapacity,
float  lf
[inline]
 

Definition at line 417 of file HashMap.d.

References loadFactor, and setTable().

final void setTable HashEntry[]  newTable  )  [inline, private]
 

Set table to new HashEntry array. Call only while holding lock or in constructor.

Definition at line 427 of file HashMap.d.

References loadFactor, table, and threshold.

Referenced by this().

final HashEntry getFirst uint  hash  )  [inline, private]
 

Return properly casted first entry of bin for given hash

Definition at line 436 of file HashMap.d.

References HashMap::hash, and table.

Referenced by containsKey(), get(), and replace().

bool matchKey K  a,
K  b
[inline, static, private]
 

Return true if the two keys match

Definition at line 447 of file HashMap.d.

References HashMap::K.

Referenced by containsKey(), get(), put(), remove(), and replace().

V get K  key,
uint  hash
[inline]
 

Definition at line 456 of file HashMap.d.

References count, getFirst(), HashMap::HashEntry::hash, HashMap::hash, HashMap::K, HashMap::HashEntry::key, matchKey(), HashMap::HashEntry::next, HashMap::V, and HashMap::HashEntry::value.

Referenced by HashMap::get().

bool containsKey K  key,
uint  hash
[inline]
 

Definition at line 484 of file HashMap.d.

References count, getFirst(), HashMap::HashEntry::hash, HashMap::hash, HashMap::K, HashMap::HashEntry::key, matchKey(), and HashMap::HashEntry::next.

Referenced by HashMap::containsKey().

synchronized V replace K  key,
uint  hash,
V  newValue
[inline]
 

Definition at line 505 of file HashMap.d.

References getFirst(), HashMap::HashEntry::hash, HashMap::hash, HashMap::K, HashMap::HashEntry::key, matchKey(), HashMap::HashEntry::next, HashMap::V, and HashMap::HashEntry::value.

Referenced by HashMap::replace().

synchronized V put K  key,
uint  hash,
V  value,
bool  onlyIfAbsent
[inline]
 

Definition at line 522 of file HashMap.d.

References count, HashMap::HashEntry::hash, HashMap::hash, HashMap::K, HashMap::HashEntry::key, matchKey(), HashMap::HashEntry::next, rehash(), table, threshold, HashMap::V, and HashMap::HashEntry::value.

Referenced by HashMap::put(), and HashMap::putIfAbsent().

final void rehash  )  [inline, private]
 

Definition at line 558 of file HashMap.d.

References HashMap::HashEntry::hash, HashMap::HashEntry::key, loadFactor, HashMap::HashEntry::next, table, threshold, and HashMap::HashEntry::value.

Referenced by put().

synchronized V remove K  key,
uint  hash,
V  value
[inline, private]
 

Remove; match on key only if value null, else match both.

Definition at line 631 of file HashMap.d.

References count, HashMap::HashEntry::hash, HashMap::hash, HashMap::K, HashMap::HashEntry::key, matchKey(), HashMap::HashEntry::next, table, HashMap::V, and HashMap::HashEntry::value.

Referenced by HashMap::remove().

synchronized void clear  )  [inline, private]
 

Definition at line 671 of file HashMap.d.

References count, and table.

Referenced by HashMap::clear().


Member Data Documentation

int count
 

The number of elements in this segment's region.

Definition at line 394 of file HashMap.d.

Referenced by HashMap::HashIterator::advance(), clear(), containsKey(), get(), put(), and remove().

int threshold
 

The table is rehashed when its size exceeds this threshold. (The value of this field is always (int)(capacity * loadFactor).)

Definition at line 401 of file HashMap.d.

Referenced by put(), rehash(), and setTable().

HashEntry [] table
 

The per-segment table. Declared as a raw type, casted to HashEntry<K,V> on each use.

Definition at line 407 of file HashMap.d.

Referenced by HashMap::HashIterator::advance(), clear(), getFirst(), put(), rehash(), remove(), and setTable().

float loadFactor
 

The load factor for the hash table. Even though this value is same for all segments, it is replicated to avoid needing links to outer object.

Definition at line 415 of file HashMap.d.

Referenced by rehash(), setTable(), and this().


The documentation for this class was generated from the following file:
Generated on Tue Jan 25 21:18:33 2005 for Mango by doxygen 1.3.6