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 348 of file HashMap.d.


Member Function Documentation

this int  initialCapacity,
float  lf
[inline]
 

Definition at line 413 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 423 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 432 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 443 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 452 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 480 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 501 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 518 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 554 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 627 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 667 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 390 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 397 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 403 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 411 of file HashMap.d.

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


The documentation for this class was generated from the following file:
Generated on Sun Nov 7 19:07:03 2004 for Mango by doxygen 1.3.6