|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jfree.data.DefaultKeyedValues
An ordered list of (key, value) items. 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,
double value)
Updates an existing value, or adds a new value to the collection. |
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 obj)
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 for the values in the collection. |
java.lang.Number |
getValue(java.lang.Comparable key)
Returns the value 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,
double value)
Updates an existing value, or adds a new value to 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 |
finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DefaultKeyedValues()
Method Detail |
public int getItemCount()
getItemCount
in interface Values
public java.lang.Number getValue(int item)
getValue
in interface Values
item
- the item of interest (zero-based index).
java.lang.IndexOutOfBoundsException
- if item
is out of bounds.public java.lang.Comparable getKey(int index)
getKey
in interface KeyedValues
index
- the item index (zero-based).
java.lang.IndexOutOfBoundsException
- if item
is out of bounds.public int getIndex(java.lang.Comparable key)
getIndex
in interface KeyedValues
key
- the key.
-1
if the key is unrecognised.public java.util.List getKeys()
getKeys
in interface KeyedValues
null
).public java.lang.Number getValue(java.lang.Comparable key)
null
.
getValue
in interface KeyedValues
key
- the key.
null
).
UnknownKeyException
- if the key is not recognised.public void addValue(java.lang.Comparable key, double value)
key
- the key (null
not permitted).value
- the value.public void addValue(java.lang.Comparable key, java.lang.Number value)
setValue(Comparable, Number)
method.
key
- the key (null
not permitted).value
- the value (null
permitted).public void setValue(java.lang.Comparable key, double value)
key
- the key (null
not permitted).value
- the value.public void setValue(java.lang.Comparable key, java.lang.Number value)
key
- the key (null
not permitted).value
- the value (null
permitted).public void removeValue(int index)
index
- the index of the item to remove.public void removeValue(java.lang.Comparable key)
key
- the item key.
UnknownKeyException
- if the key is not recognised.public void sortByKeys(SortOrder order)
order
- the sort order (null
not permitted).public void sortByValues(SortOrder order)
null
values, they will sort to the end of the list,
irrespective of the sort order.
order
- the sort order (null
not permitted).public boolean equals(java.lang.Object obj)
obj
- the object (null
permitted).
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 |