org.jfree.data.general
Class DefaultPieDataset
- Cloneable, Dataset, KeyedValues, ObjectInputValidation, PieDataset, PublicCloneable, Serializable, Values
implements PieDataset, Cloneable, PublicCloneable, Serializable
A default implementation of the
PieDataset
interface.
void | clear() - Clears all data from this dataset and sends a
DatasetChangeEvent
to all registered listeners (unless the dataset was already empty).
|
Object | clone() - Returns a clone of the dataset.
|
boolean | equals(Object obj) - Tests if this object is equal to another.
|
int | getIndex(Comparable key) - Returns the index for a key, or -1 if the key is not recognised.
|
int | getItemCount() - Returns the number of items in the dataset.
|
Comparable | getKey(int item) - Returns the key for the specified item, or
null .
|
List | getKeys() - Returns the categories in the dataset.
|
Number | getValue(Comparable key) - Returns the data value associated with a key.
|
Number | getValue(int item) - Returns a value.
|
int | hashCode() - Returns a hash code.
|
void | remove(Comparable key) - Removes an item from the dataset and sends a
DatasetChangeEvent
to all registered listeners.
|
void | setValue(Comparable key, Number value) - Sets the data value for a key and sends a
DatasetChangeEvent to
all registered listeners.
|
void | setValue(Comparable key, double value) - Sets the data value for a key and sends a
DatasetChangeEvent to
all registered listeners.
|
void | sortByKeys(SortOrder order) - Sorts the dataset's items by key and sends a
DatasetChangeEvent
to all registered listeners.
|
void | sortByValues(SortOrder order) - Sorts the dataset's items by value and sends a
DatasetChangeEvent
to all registered listeners.
|
DefaultPieDataset
public DefaultPieDataset()
Constructs a new dataset, initially empty.
clear
public void clear()
Clears all data from this dataset and sends a
DatasetChangeEvent
to all registered listeners (unless the dataset was already empty).
clone
public Object clone()
throws CloneNotSupportedException
Returns a clone of the dataset.
- clone in interface AbstractDataset
equals
public boolean equals(Object obj)
Tests if this object is equal to another.
getIndex
public int getIndex(Comparable key)
Returns the index for a key, or -1 if the key is not recognised.
- getIndex in interface KeyedValues
key
- the key (null
not permitted).
- The index, or
-1
if the key is unrecognised.
getKey
public Comparable getKey(int item)
Returns the key for the specified item, or null
.
- getKey in interface KeyedValues
item
- the item index (in the range 0
to
getItemCount() - 1
).
getKeys
public List getKeys()
Returns the categories in the dataset. The returned list is
unmodifiable.
- getKeys in interface KeyedValues
- The categories in the dataset.
getValue
public Number getValue(Comparable key)
Returns the data value associated with a key.
- getValue in interface KeyedValues
key
- the key (null
not permitted).
- The value (possibly
null
).
getValue
public Number getValue(int item)
Returns a value.
- getValue in interface Values
- The value (possibly
null
).
hashCode
public int hashCode()
Returns a hash code.
remove
public void remove(Comparable key)
Removes an item from the dataset and sends a
DatasetChangeEvent
to all registered listeners.
key
- the key (null
not permitted).
setValue
public void setValue(Comparable key,
Number value)
key
- the key (null
not permitted).value
- the value.
setValue
public void setValue(Comparable key,
double value)
key
- the key (null
not permitted).value
- the value.
sortByKeys
public void sortByKeys(SortOrder order)
Sorts the dataset's items by key and sends a
DatasetChangeEvent
to all registered listeners.
order
- the sort order (null
not permitted).
sortByValues
public void sortByValues(SortOrder order)
Sorts the dataset's items by value and sends a
DatasetChangeEvent
to all registered listeners.
order
- the sort order (null
not permitted).