org.jfree.data
public class DefaultKeyedValues extends Object implements KeyedValues, Cloneable, PublicCloneable, Serializable
Constructor Summary | |
---|---|
DefaultKeyedValues()
Creates a new collection (initially empty). |
Method Summary | |
---|---|
void | addValue(Comparable key, double value)
Updates an existing value, or adds a new value to the collection.
|
void | addValue(Comparable key, Number value)
Adds a new value to the collection, or updates an existing value.
|
void | clear()
Clears all values from the collection.
|
Object | clone()
Returns a clone.
|
boolean | equals(Object obj)
Tests if this object is equal to another.
|
int | getIndex(Comparable key)
Returns the index for a given key.
|
int | getItemCount()
Returns the number of items (values) in the collection.
|
Comparable | getKey(int index)
Returns a key.
|
List | getKeys()
Returns the keys for the values in the collection.
|
Number | getValue(int item)
Returns a value.
|
Number | getValue(Comparable key)
Returns the value for a given key.
|
int | hashCode()
Returns a hash code.
|
void | insertValue(int position, Comparable key, double value)
Inserts a new value at the specified position in the dataset or, if
there is an existing item with the specified key, updates the value
for that item and moves it to the specified position.
|
void | insertValue(int position, Comparable key, Number value)
Inserts a new value at the specified position in the dataset or, if
there is an existing item with the specified key, updates the value
for that item and moves it to the specified position.
|
void | removeValue(int index)
Removes a value from the collection.
|
void | removeValue(Comparable key)
Removes a value from the collection.
|
void | setValue(Comparable key, double value)
Updates an existing value, or adds a new value to the collection.
|
void | setValue(Comparable key, 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. |
Parameters: key the key (null
not permitted). value the value.
See Also: DefaultKeyedValues
Parameters: key the key (null
not permitted). value the value (null
permitted).
Since: 1.0.2
Returns: A clone.
Throws: CloneNotSupportedException this class will not throw this exception, but subclasses might.
Parameters: obj the object (null
permitted).
Returns: A boolean.
Parameters: key the key (null
not permitted).
Returns: The index, or -1
if the key is not recognised.
Throws: IllegalArgumentException if key
is
null
.
Returns: The item count.
Parameters: index the item index (zero-based).
Returns: The row key.
Throws: IndexOutOfBoundsException if item
is out of bounds.
Returns: The keys (never null
).
Parameters: item the item of interest (zero-based index).
Returns: The value (possibly null
).
Throws: IndexOutOfBoundsException if item
is out of bounds.
Parameters: key the key (null
not permitted).
Returns: The value (possibly null
).
Throws: UnknownKeyException if the key is not recognised.
See Also: DefaultKeyedValues
Returns: A hash code.
Parameters: position the position (in the range 0 to getItemCount()). key the key (null
not permitted). value the value.
Since: 1.0.6
Parameters: position the position (in the range 0 to getItemCount()). key the key (null
not permitted). value the value (null
permitted).
Since: 1.0.6
Parameters: index the index of the item to remove (in the range
0
to getItemCount() - 1
).
Throws: IndexOutOfBoundsException if index
is not within
the specified range.
Parameters: key the item key (null
not permitted).
Throws: IllegalArgumentException if key
is
null
. UnknownKeyException if key
is not recognised.
Parameters: key the key (null
not permitted). value the value.
Parameters: key the key (null
not permitted). value the value (null
permitted).
Parameters: order the sort order (null
not permitted).
null
values, they will sort to the end of the list,
irrespective of the sort order.
Parameters: order the sort order (null
not permitted).