|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.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. |
java.lang.Object |
clone()
Returns a clone. |
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 or -1 if the key is not found. |
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 for the values in the collection. |
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. |
int |
hashCode()
Returns a hash code. |
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(org.jfree.util.SortOrder order)
Sorts the items in the list by key. |
void |
sortByValues(org.jfree.util.SortOrder order)
Sorts the items in the list by value. |
| Methods inherited from class java.lang.Object |
finalize, getClass, 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 KeyedValuesnull).public java.lang.Number getValue(java.lang.Comparable key)
null) for a given key. If the key is not
recognised, the method returns 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(org.jfree.util.SortOrder order)
order - the sort order (ascending or descending).public void sortByValues(org.jfree.util.SortOrder order)
null values, they
will sort to the end of the list, irrespective of the sort order.
order - the sort order (ascending or descending).public boolean equals(java.lang.Object o)
o - the other object.
public int hashCode()
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
java.lang.CloneNotSupportedException - this class will not throw this exception, but subclasses
might.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||