edu.indiana.util.doublecollection
Class DoubleMap

java.lang.Object
  extended by edu.indiana.util.doublecollection.DoubleMap
All Implemented Interfaces:
DoubleCollection, java.io.Serializable, java.lang.Cloneable

public class DoubleMap
extends java.lang.Object
implements DoubleCollection, java.lang.Cloneable

A DoubleCollection that uses a HashMap to store the doubles.

See Also:
Serialized Form

Field Summary
protected  java.util.HashMap values
           
 
Constructor Summary
DoubleMap()
          Creates a new instance of DoubleMap
DoubleMap(int initialCapacity)
           
DoubleMap(java.util.Iterator keyIter, double[] values)
           
DoubleMap(JDBCDriverInfo driverInfo, RDBCollectionInfo collectionInfo, RDBCollectionID collectionID)
          Initalize an instance of DoubleMap that will basically reads its contents from the hashmaptable in the database.
DoubleMap(java.lang.Object[] keys, double[] values)
           
 
Method Summary
 void clear()
           
 java.lang.Object clone()
           
 boolean containsKey(java.lang.Object key)
           
 boolean containsValue(double value)
           
 java.util.Iterator entryIterator()
           
 boolean equals(java.lang.Object other)
           
 double getValue(java.lang.Object key)
          returns 0 if weight is unknown!
 int hashCode()
           
 boolean isEmpty()
           
 void putValue(java.lang.Object key, double value)
           
 double removeValue(java.lang.Object key)
           
 int size()
           
 java.lang.String toString()
           
 java.lang.String toString(java.util.Iterator keyIter)
           
 void updateMemoryToDB(JDBCDriverInfo driverInfo, RDBCollectionInfo collectionInfo, RDBCollectionID collectionID)
           
 boolean wasLastValueKnown()
          returns true if the last value returned was actually unknown (and 0 was returned to indicate this)
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

values

protected java.util.HashMap values
Constructor Detail

DoubleMap

public DoubleMap()
Creates a new instance of DoubleMap


DoubleMap

public DoubleMap(int initialCapacity)

DoubleMap

public DoubleMap(java.lang.Object[] keys,
                 double[] values)

DoubleMap

public DoubleMap(java.util.Iterator keyIter,
                 double[] values)

DoubleMap

public DoubleMap(JDBCDriverInfo driverInfo,
                 RDBCollectionInfo collectionInfo,
                 RDBCollectionID collectionID)
Initalize an instance of DoubleMap that will basically reads its contents from the hashmaptable in the database.

Parameters:
driverInfo - a JDBCDriverInfo
collectionInfo - a RDBCollectionInfo
collectionID - a RDBCollectionID
Method Detail

updateMemoryToDB

public void updateMemoryToDB(JDBCDriverInfo driverInfo,
                             RDBCollectionInfo collectionInfo,
                             RDBCollectionID collectionID)
Specified by:
updateMemoryToDB in interface DoubleCollection

getValue

public double getValue(java.lang.Object key)
Description copied from interface: DoubleCollection
returns 0 if weight is unknown!

Specified by:
getValue in interface DoubleCollection

wasLastValueKnown

public boolean wasLastValueKnown()
Description copied from interface: DoubleCollection
returns true if the last value returned was actually unknown (and 0 was returned to indicate this)

Specified by:
wasLastValueKnown in interface DoubleCollection

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toString

public java.lang.String toString(java.util.Iterator keyIter)
Specified by:
toString in interface DoubleCollection

equals

public boolean equals(java.lang.Object other)
Specified by:
equals in interface DoubleCollection
Overrides:
equals in class java.lang.Object

clone

public java.lang.Object clone()
Specified by:
clone in interface DoubleCollection
Overrides:
clone in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

putValue

public void putValue(java.lang.Object key,
                     double value)
Specified by:
putValue in interface DoubleCollection

removeValue

public double removeValue(java.lang.Object key)
Specified by:
removeValue in interface DoubleCollection

clear

public void clear()
Specified by:
clear in interface DoubleCollection

containsKey

public boolean containsKey(java.lang.Object key)
Specified by:
containsKey in interface DoubleCollection

containsValue

public boolean containsValue(double value)
Specified by:
containsValue in interface DoubleCollection

entryIterator

public java.util.Iterator entryIterator()
Specified by:
entryIterator in interface DoubleCollection

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface DoubleCollection

size

public int size()
Specified by:
size in interface DoubleCollection