Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
org.jfree.data.DefaultKeyedValues
public class DefaultKeyedValues
extends java.lang.Object
implements KeyedValues, Cloneable, PublicCloneable, Serializable
KeyedValues
interface.
Constructor Summary | |
|
Method Summary | |
void |
|
void |
|
void |
|
Object |
|
boolean |
|
int |
|
int |
|
Comparable |
|
List |
|
Number |
|
Number |
|
int |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
public void addValue(Comparable key, Number value)
Adds a new value to the collection, or updates an existing value. This method passes control directly to thesetValue(Comparable,Number)
method.
- Parameters:
key
- the key (null
not permitted).value
- the value (null
permitted).
public void addValue(Comparable key, double value)
Updates an existing value, or adds a new value to the collection.
- Parameters:
key
- the key (null
not permitted).value
- the value.
- See Also:
addValue(Comparable,Number)
public boolean equals(Object obj)
Tests if this object is equal to another.
- Parameters:
obj
- the object (null
permitted).
- Returns:
- A boolean.
public int getIndex(Comparable key)
Returns the index for a given key.
- Specified by:
- getIndex in interface KeyedValues
- Parameters:
key
- the key (null
not permitted).
- Returns:
- The index, or
-1
if the key is not recognised.
public int getItemCount()
Returns the number of items (values) in the collection.
- Specified by:
- getItemCount in interface Values
- Returns:
- The item count.
public Comparable getKey(int index)
Returns a key.
- Specified by:
- getKey in interface KeyedValues
- Parameters:
index
- the item index (zero-based).
- Returns:
- The row key.
public List getKeys()
Returns the keys for the values in the collection.
- Specified by:
- getKeys in interface KeyedValues
- Returns:
- The keys (never
null
).
public Number getValue(Comparable key)
Returns the value for a given key.
- Specified by:
- getValue in interface KeyedValues
- Parameters:
key
- the key (null
not permitted).
- Returns:
- The value (possibly
null
).
- See Also:
getValue(int)
public Number getValue(int item)
Returns a value.
- Parameters:
item
- the item of interest (zero-based index).
- Returns:
- The value (possibly
null
).
public 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.
- 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
public 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.
- Parameters:
position
- the position (in the range 0 to getItemCount()).key
- the key (null
not permitted).value
- the value.
- Since:
- 1.0.6
public void removeValue(Comparable key)
Removes a value from the collection.
- Parameters:
key
- the item key (null
not permitted).
public void removeValue(int index)
Removes a value from the collection.
- Parameters:
index
- the index of the item to remove (in the range0
togetItemCount() - 1
).
public void setValue(Comparable key, Number value)
Updates an existing value, or adds a new value to the collection.
- Parameters:
key
- the key (null
not permitted).value
- the value (null
permitted).
public void setValue(Comparable key, double value)
Updates an existing value, or adds a new value to the collection.
- Parameters:
key
- the key (null
not permitted).value
- the value.
public void sortByKeys(SortOrder order)
Sorts the items in the list by key.
- Parameters:
order
- the sort order (null
not permitted).
public void sortByValues(SortOrder order)
Sorts the items in the list by value. If the list containsnull
values, they will sort to the end of the list, irrespective of the sort order.
- Parameters:
order
- the sort order (null
not permitted).