Class TObjectDoubleHashMap<K>

    • Field Detail

      • _values

        protected transient double[] _values
        the values of the map
      • no_entry_value

        protected double no_entry_value
        the value that represents null
    • Constructor Detail

      • TObjectDoubleHashMap

        public TObjectDoubleHashMap()
        Creates a new TObjectDoubleHashMap instance with the default capacity and load factor.
      • TObjectDoubleHashMap

        public TObjectDoubleHashMap(int initialCapacity)
        Creates a new TObjectDoubleHashMap instance with a prime capacity equal to or greater than initialCapacity and with the default load factor.
        Parameters:
        initialCapacity - an int value
      • TObjectDoubleHashMap

        public TObjectDoubleHashMap(int initialCapacity,
                                    float loadFactor)
        Creates a new TObjectDoubleHashMap instance with a prime capacity equal to or greater than initialCapacity and with the specified load factor.
        Parameters:
        initialCapacity - an int value
        loadFactor - a float value
      • TObjectDoubleHashMap

        public TObjectDoubleHashMap(int initialCapacity,
                                    float loadFactor,
                                    double noEntryValue)
        Creates a new TObjectDoubleHashMap instance with a prime value at or near the specified capacity and load factor.
        Parameters:
        initialCapacity - used to find a prime capacity for the table.
        loadFactor - used to calculate the threshold over which rehashing takes place.
        noEntryValue - the value used to represent null.
      • TObjectDoubleHashMap

        public TObjectDoubleHashMap(TObjectDoubleMap<? extends K> map)
        Creates a new TObjectDoubleHashMap that contains the entries in the map passed to it.
        Parameters:
        map - the TObjectDoubleMap to be copied.
    • Method Detail

      • setUp

        public int setUp(int initialCapacity)
        initializes the hashtable to a prime capacity which is at least initialCapacity + 1.
        Overrides:
        setUp in class  TObjectHash<K>
        Parameters:
        initialCapacity - an int value
        Returns:
        the actual capacity chosen
      • rehash

        protected void rehash(int newCapacity)
        rehashes the map to the new capacity.
        Specified by:
        rehash in class  THash
        Parameters:
        newCapacity - an int value
      • getNoEntryValue

        public double getNoEntryValue()
      • containsKey

        public boolean containsKey(Object key)
      • containsValue

        public boolean containsValue(double val)
      • get

        public double get(Object key)
      • put

        public double put(K key,
                          double value)
      • putIfAbsent

        public double putIfAbsent(K key,
                                  double value)
      • remove

        public double remove(Object key)
      • removeAt

        protected void removeAt(int index)
        Removes the mapping at index from the map. This method is used internally and public mainly because of packaging reasons. Caveat Programmer.
        Overrides:
        removeAt in class  TObjectHash<K>
        Parameters:
        index - an int value
      • putAll

        public void putAll(Map<? extends K,? extends Double> map)
      • clear

        public void clear()
      • keySet

        public Set<K> keySet()
      • keys

        public Object[] keys()
      • keys

        public K[] keys(K[] a)
      • values

        public double[] values()
      • values

        public double[] values(double[] array)
      • increment

        public boolean increment(K key)
      • adjustValue

        public boolean adjustValue(K key,
                                   double amount)
      • adjustOrPutValue

        public double adjustOrPutValue(K key,
                                       double adjust_amount,
                                       double put_amount)
      • forEachKey

        public boolean forEachKey(TObjectProcedure<? super K> procedure)
        Executes procedure for each key in the map.
        Specified by:
        forEachKey in interface  TObjectDoubleMap<K>
        Parameters:
        procedure - a TObjectProcedure value
        Returns:
        false if the loop over the keys terminated because the procedure returned false for some key.
      • forEachValue

        public boolean forEachValue(TDoubleProcedure procedure)
        Executes procedure for each value in the map.
        Specified by:
        forEachValue in interface  TObjectDoubleMap<K>
        Parameters:
        procedure - a TDoubleProcedure value
        Returns:
        false if the loop over the values terminated because the procedure returned false for some value.
      • forEachEntry

        public boolean forEachEntry(TObjectDoubleProcedure<? super K> procedure)
        Executes procedure for each key/value entry in the map.
        Specified by:
        forEachEntry in interface  TObjectDoubleMap<K>
        Parameters:
        procedure - a TOObjectDoubleProcedure value
        Returns:
        false if the loop over the entries terminated because the procedure returned false for some entry.
      • retainEntries

        public boolean retainEntries(TObjectDoubleProcedure<? super K> procedure)
        Retains only those entries in the map for which the procedure returns a true value.
        Specified by:
        retainEntries in interface  TObjectDoubleMap<K>
        Parameters:
        procedure - determines which entries to keep
        Returns:
        true if the map was modified.
      • transformValues

        public void transformValues(TDoubleFunction function)
        Transform the values in this map using function.
        Specified by:
        transformValues in interface  TObjectDoubleMap<K>
        Parameters:
        function - a TDoubleFunction value
      • equals

        public boolean equals(Object other)
        Compares this map with another map for equality of their stored entries.
        Specified by:
        equals in interface  TObjectDoubleMap<K>
        Overrides:
        equals in class  Object
        Parameters:
        other - an Object value
        Returns:
        a boolean value
      • hashCode

        public int hashCode()
      • toString

        public String toString()