|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.util.AbstractMap<K,V>
java.util.HashMap<E,Double>
com.aliasi.util.ObjectToDoubleMap<E>
public class ObjectToDoubleMap<E>
An ObjectToDoubleMap maintains a mapping from
objects to double-valued counters, which may be incremented or set.
Objects not in the underlying map's key set are assumed to have
value 0.0. Thus incrementing an object that is not currently
set is equivalent to setting it to the increment value.
| Constructor Summary | |
|---|---|
ObjectToDoubleMap()
Construct an object to double mapping. |
|
| Method Summary | |
|---|---|
double |
getValue(E key)
Returns the value of the specified key in the map. |
void |
increment(E key,
double increment)
Increment the value of the specified key by the specified increment amount. |
Object[] |
keysOrderedByValue()
Returns the array of keys ordered in decreasing order of value. |
List<E> |
keysOrderedByValueList()
Returns the list of keys ordered in decreasing order of value. |
ScoredObject<E>[] |
scoredObjectsOrderedByValue()
Returns an array of scored objects corresponding to the entries in this map in decreasing order of value. |
List<ScoredObject<E>> |
scoredObjectsOrderedByValueList()
Returns a list of scored objects corresponding to the entries in decreasing order of value. |
void |
set(E key,
double val)
Sets the specified key to the specified value. |
Comparator<E> |
valueComparator()
Returns the comparator that compares objects based on their values. |
| Methods inherited from class java.util.HashMap |
|---|
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values |
| Methods inherited from class java.util.AbstractMap |
|---|
equals, hashCode, toString |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Map |
|---|
equals, hashCode |
| Constructor Detail |
|---|
public ObjectToDoubleMap()
| Method Detail |
|---|
public void increment(E key,
double increment)
key - Object to increment.increment - Increment amount.
public void set(E key,
double val)
key - Object to set.val - New value for the object.public double getValue(E key)
key - Object whose value is returned.
public List<E> keysOrderedByValueList()
public Object[] keysOrderedByValue()
public List<ScoredObject<E>> scoredObjectsOrderedByValueList()
public ScoredObject<E>[] scoredObjectsOrderedByValue()
public Comparator<E> valueComparator()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||