    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class collections.HashedMap

    java.lang.Object
       |
       +----collections.UpdatableImpl
               |
               +----collections.UpdatableMapImpl
                       |
                       +----collections.HashedMap

public class HashedMap
extends UpdatableMapImpl
implements UpdatableMap, HashTableParams

Hash table implementation of Map

##

loadFactor_
  The threshold load factor
table_
  The table.

##

HashedMap()
  Make a new empty map.
HashedMap(Predicate)
  Make a new empty map to use given element screener.
HashedMap(Predicate, float)
  Special version of constructor needed by clone()

##

aKeyOf(Object)
  Implements collections.Map.aKeyOf.
at(Object)
  Implements collections.Map.at.
buckets()
  Implements collections.HashTableParams.buckets.
buckets(int)
  Implements collections.HashTableParams.buckets.
checkImplementation()
  Implements collections.ImplementationCheckable.checkImplementation.
checkLoadFactor()
  Check to see if we are past load factor threshold.
clear()
  Implements collections.UpdatableCollection.clear.
clone()
  Make an independent copy of the table.
elements()
  Implements collections.Collection.elements.
exclude(Object)
  Implements collections.UpdatableCollection.exclude.
hashOf(Object)
  Mask off and remainder the hashCode for element so it can be used as table index
includes(Object)
  Implements collections.Collection.includes.
includesAt(Object, Object)
  Implements collections.Map.includesAt Time complexity: O(1) average; O(n) worst.
includesKey(Object)
  Implements collections.Map.includesKey.
keys()
  Implements collections.Map.keys.
occurrencesOf(Object)
  Implements collections.Collection.occurrencesOf.
putAt(Object, Object)
  Implements collections.UpdatableMap.putAt.
removeAt(Object)
  Implements collections.UpdatableMap.removeAt.
removeOneOf(Object)
  Implements collections.UpdatableCollection.removeOneOf.
replaceAllOf(Object, Object)
  Implements collections.UpdatableCollection.replaceAllOf.
replaceElement(Object, Object, Object)
  Implements collections.UpdatableMap.replaceElement.
replaceOneOf(Object, Object)
  Implements collections.UpdatableCollection.replaceOneOf.
resize(int)
take()
  Implements collections.UpdatableCollection.take.
thresholdLoadFactor()
  Implements collections.HashTableParams.thresholdLoadfactor Time complexity: O(1).
thresholdLoadFactor(float)
  Implements collections.HashTableParams.thresholdLoadfactor Time complexity: O(n).

##

table_

     protected LLPair table_[]

  The table. Each entry is a list. Null if no table allocated

loadFactor_

     protected float loadFactor_

  The threshold load factor

##

HashedMap

     public HashedMap()

  Make a new empty map.

HashedMap

     public HashedMap(Predicate screener)

  Make a new empty map to use given element screener.

HashedMap

     protected HashedMap(Predicate s,
                         float f)

  Special version of constructor needed by clone()

##

clone

     protected Object clone() throws CloneNotSupportedException

  Make an independent copy of the table. Elements themselves are not cloned.

  Overrides:
    clone in class Object

buckets

     public synchronized int buckets()

  Implements collections.HashTableParams.buckets. Time complexity: O(1).

  See Also:
    buckets.

buckets

     public synchronized void buckets(int newCap) throws IllegalArgumentException

  Implements collections.HashTableParams.buckets. Time complexity: O(n).

  See Also:
    buckets.

thresholdLoadFactor

     public synchronized float thresholdLoadFactor()

  Implements collections.HashTableParams.thresholdLoadfactor Time complexity: O(1).

  See Also:
    thresholdLoadfactor

thresholdLoadFactor

     public synchronized void thresholdLoadFactor(float desired) throws IllegalArgumentException

  Implements collections.HashTableParams.thresholdLoadfactor Time complexity: O(n).

  See Also:
    thresholdLoadfactor

includes

     public synchronized boolean includes(Object element)

  Implements collections.Collection.includes. Time complexity: O(1) average; O(n) worst.

  Overrides:
    includes in class UpdatableImpl
  See Also:
    includes

occurrencesOf

     public synchronized int occurrencesOf(Object element)

  Implements collections.Collection.occurrencesOf. Time complexity: O(n).

  Overrides:
    occurrencesOf in class UpdatableImpl
  See Also:
    occurrencesOf

elements

     public synchronized CollectionEnumeration elements()

  Implements collections.Collection.elements. Time complexity: O(1).

  Overrides:
    elements in class UpdatableImpl
  See Also:
    elements

includesKey

     public synchronized boolean includesKey(Object key)

  Implements collections.Map.includesKey. Time complexity: O(1) average; O(n) worst.

  Overrides:
    includesKey in class UpdatableMapImpl
  See Also:
    includesKey

includesAt

     public synchronized boolean includesAt(Object key,
                                            Object element)

  Implements collections.Map.includesAt Time complexity: O(1) average; O(n) worst.

  Overrides:
    includesAt in class UpdatableMapImpl
  See Also:
    includesAt

keys

     public synchronized CollectionEnumeration keys()

  Implements collections.Map.keys. Time complexity: O(1).

  Overrides:
    keys in class UpdatableMapImpl
  See Also:
    keys

at

     public synchronized Object at(Object key) throws NoSuchElementException

  Implements collections.Map.at. Time complexity: O(1) average; O(n) worst.

  Overrides:
    at in class UpdatableMapImpl
  See Also:
    at

aKeyOf

     public synchronized Object aKeyOf(Object element)

  Implements collections.Map.aKeyOf. Time complexity: O(n).

  Overrides:
    aKeyOf in class UpdatableMapImpl
  See Also:
    aKeyOf

clear

     public synchronized void clear()

  Implements collections.UpdatableCollection.clear. Time complexity: O(1).

  Overrides:
    clear in class UpdatableImpl
  See Also:
    clear

exclude

     public synchronized void exclude(Object element)

  Implements collections.UpdatableCollection.exclude. Time complexity: O(n).

  Overrides:
    exclude in class UpdatableImpl
  See Also:
    exclude

removeOneOf

     public synchronized void removeOneOf(Object element)

  Implements collections.UpdatableCollection.removeOneOf. Time complexity: O(n).

  Overrides:
    removeOneOf in class UpdatableImpl
  See Also:
    removeOneOf

replaceOneOf

     public synchronized void replaceOneOf(Object oldElement,
                                           Object newElement) throws IllegalElementException

  Implements collections.UpdatableCollection.replaceOneOf. Time complexity: O(n).

  Overrides:
    replaceOneOf in class UpdatableImpl
  See Also:
    replaceOneOf

replaceAllOf

     public synchronized void replaceAllOf(Object oldElement,
                                           Object newElement) throws IllegalElementException

  Implements collections.UpdatableCollection.replaceAllOf. Time complexity: O(n).

  Overrides:
    replaceAllOf in class UpdatableImpl
  See Also:
    replaceAllOf

take

     public synchronized Object take() throws NoSuchElementException

  Implements collections.UpdatableCollection.take. Time complexity: O(number of buckets).

  Overrides:
    take in class UpdatableImpl
  See Also:
    take

putAt

     public synchronized void putAt(Object key,
                                    Object element)

  Implements collections.UpdatableMap.putAt. Time complexity: O(1) average; O(n) worst.

  Overrides:
    putAt in class UpdatableMapImpl
  See Also:
    putAt

removeAt

     public synchronized void removeAt(Object key)

  Implements collections.UpdatableMap.removeAt. Time complexity: O(1) average; O(n) worst.

  Overrides:
    removeAt in class UpdatableMapImpl
  See Also:
    removeAt

replaceElement

     public synchronized void replaceElement(Object key,
                                             Object oldElement,
                                             Object newElement) throws IllegalElementException

  Implements collections.UpdatableMap.replaceElement. Time complexity: O(1) average; O(n) worst.

  Overrides:
    replaceElement in class UpdatableMapImpl
  See Also:
    replaceElement

checkLoadFactor

     protected void checkLoadFactor()

  Check to see if we are past load factor threshold. If so, resize so that we are at half of the desired threshold. Also while at it, check to see if we are empty so can just unlink table.

hashOf

     protected final int hashOf(Object element)

  Mask off and remainder the hashCode for element so it can be used as table index

resize

     protected void resize(int newCap)

checkImplementation

     public synchronized void checkImplementation() throws ImplementationError

  Implements collections.ImplementationCheckable.checkImplementation.

  Overrides:
    checkImplementation in class UpdatableImpl
  See Also:
    checkImplementation

    All Packages  Class Hierarchy  This Package  Previous  Next  Index