|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--org.jfree.data.DefaultKeyedValues
A collection of (key, value) pairs.
This class provides a default implementation of the KeyedValues interface.
| Constructor Summary | |
DefaultKeyedValues()
Creates a new collection (initially empty). |
|
| Method Summary | |
void |
addValue(java.lang.Comparable key,
java.lang.Number value)
Adds a new value to the collection, or updates an existing value. |
boolean |
equals(java.lang.Object o)
Tests if this object is equal to another. |
int |
getIndex(java.lang.Comparable key)
Returns the index for a given key. |
int |
getItemCount()
Returns the number of items (values) in the collection. |
java.lang.Comparable |
getKey(int index)
Returns a key. |
java.util.List |
getKeys()
Returns the keys. |
java.lang.Number |
getValue(java.lang.Comparable key)
Returns the value (possibly null) for a given key.
|
java.lang.Number |
getValue(int item)
Returns a value. |
void |
removeValue(java.lang.Comparable key)
Removes a value from the collection. |
void |
removeValue(int index)
Removes a value from the collection. |
void |
setValue(java.lang.Comparable key,
java.lang.Number value)
Updates an existing value, or adds a new value to the collection. |
void |
sortByKeys(SortOrder order)
Sorts the items in the list by key. |
void |
sortByValues(SortOrder order)
Sorts the items in the list by value. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public DefaultKeyedValues()
| Method Detail |
public int getItemCount()
getItemCount in interface Valuespublic java.lang.Number getValue(int item)
getValue in interface Valuesitem - the item of interest (zero-based index).
public java.lang.Comparable getKey(int index)
getKey in interface KeyedValuesindex - the item index (zero-based).
public int getIndex(java.lang.Comparable key)
getIndex in interface KeyedValueskey - the key.
public java.util.List getKeys()
getKeys in interface KeyedValuespublic java.lang.Number getValue(java.lang.Comparable key)
null) for a given key.
If the key is not recognised, the method should return null.
getValue in interface KeyedValueskey - the key.
public void addValue(java.lang.Comparable key,
java.lang.Number value)
This is the same as the setValue(...) method.
key - the key.value - the value.
public void setValue(java.lang.Comparable key,
java.lang.Number value)
This is the same as the addValue(...) method.
key - the key.value - the value.public void removeValue(int index)
index - the index of the item to remove.public void removeValue(java.lang.Comparable key)
key - the key of the item to remove.public void sortByKeys(SortOrder order)
order - the sort order (ascending or descending).public void sortByValues(SortOrder order)
order - the sort order (ascending or descending).public boolean equals(java.lang.Object o)
equals in class java.lang.Objecto - the other object.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||