public class DefaultPieDataset extends AbstractDataset implements PieDataset, java.lang.Cloneable, org.jfree.util.PublicCloneable, java.io.Serializable
PieDataset
interface.Constructor and Description |
---|
DefaultPieDataset()
Constructs a new dataset, initially empty.
|
DefaultPieDataset(KeyedValues data)
Creates a new dataset by copying data from a
KeyedValues
instance. |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears all data from this dataset and sends a
DatasetChangeEvent
to all registered listeners (unless the dataset was already empty). |
java.lang.Object |
clone()
Returns a clone of the dataset.
|
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 key, or -1 if the key is not recognised.
|
int |
getItemCount()
Returns the number of items in the dataset.
|
java.lang.Comparable |
getKey(int item)
Returns the key for the specified item, or
null . |
java.util.List |
getKeys()
Returns the categories in the dataset.
|
java.lang.Number |
getValue(java.lang.Comparable key)
Returns the data value associated with a key.
|
java.lang.Number |
getValue(int item)
Returns a value.
|
int |
hashCode()
Returns a hash code.
|
void |
insertValue(int position,
java.lang.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,
java.lang.Comparable key,
java.lang.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 |
remove(java.lang.Comparable key)
Removes an item from the dataset and sends a
DatasetChangeEvent
to all registered listeners. |
void |
setValue(java.lang.Comparable key,
double value)
Sets the data value for a key and sends a
DatasetChangeEvent to
all registered listeners. |
void |
setValue(java.lang.Comparable key,
java.lang.Number value)
Sets the data value for a key and sends a
DatasetChangeEvent to
all registered listeners. |
void |
sortByKeys(org.jfree.util.SortOrder order)
Sorts the dataset's items by key and sends a
DatasetChangeEvent
to all registered listeners. |
void |
sortByValues(org.jfree.util.SortOrder order)
Sorts the dataset's items by value and sends a
DatasetChangeEvent
to all registered listeners. |
addChangeListener, fireDatasetChanged, getGroup, getNotify, hasListener, notifyListeners, removeChangeListener, setGroup, setNotify, validateObject
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
addChangeListener, getGroup, removeChangeListener, setGroup
public DefaultPieDataset()
public DefaultPieDataset(KeyedValues data)
KeyedValues
instance.data
- the data (null
not permitted).public int getItemCount()
getItemCount
in interface Values
public java.util.List getKeys()
getKeys
in interface KeyedValues
public java.lang.Comparable getKey(int item)
null
.getKey
in interface KeyedValues
item
- the item index (in the range 0
to
getItemCount() - 1
).null
.java.lang.IndexOutOfBoundsException
- if item
is not in the
specified range.public int getIndex(java.lang.Comparable key)
getIndex
in interface KeyedValues
key
- the key (null
not permitted).-1
if the key is unrecognised.java.lang.IllegalArgumentException
- if key
is
null
.public java.lang.Number getValue(int item)
public java.lang.Number getValue(java.lang.Comparable key)
getValue
in interface KeyedValues
key
- the key (null
not permitted).null
).UnknownKeyException
- if the key is not recognised.public void setValue(java.lang.Comparable key, java.lang.Number value)
DatasetChangeEvent
to
all registered listeners.key
- the key (null
not permitted).value
- the value.java.lang.IllegalArgumentException
- if key
is
null
.public void setValue(java.lang.Comparable key, double value)
DatasetChangeEvent
to
all registered listeners.key
- the key (null
not permitted).value
- the value.java.lang.IllegalArgumentException
- if key
is
null
.public void insertValue(int position, java.lang.Comparable key, double value)
DatasetChangeEvent
to all
registered listeners.position
- the position (in the range 0 to getItemCount()).key
- the key (null
not permitted).value
- the value (null
permitted).public void insertValue(int position, java.lang.Comparable key, java.lang.Number value)
DatasetChangeEvent
to all
registered listeners.position
- the position (in the range 0 to getItemCount()).key
- the key (null
not permitted).value
- the value (null
permitted).public void remove(java.lang.Comparable key)
DatasetChangeEvent
to all registered listeners.key
- the key (null
not permitted).java.lang.IllegalArgumentException
- if key
is
null
.public void clear()
DatasetChangeEvent
to all registered listeners (unless the dataset was already empty).public void sortByKeys(org.jfree.util.SortOrder order)
DatasetChangeEvent
to all registered listeners.order
- the sort order (null
not permitted).public void sortByValues(org.jfree.util.SortOrder order)
DatasetChangeEvent
to all registered listeners.order
- the sort order (null
not permitted).public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the other object.public int hashCode()
hashCode
in class java.lang.Object
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in interface org.jfree.util.PublicCloneable
clone
in class AbstractDataset
java.lang.CloneNotSupportedException
- This class will not throw this
exception, but subclasses (if any) might.