Package org.jfree.data
Class DefaultPieDataset
java.lang.Object
org.jfree.data.AbstractDataset
org.jfree.data.DefaultPieDataset
- All Implemented Interfaces:
ObjectInputValidation,Serializable,Cloneable,Dataset,KeyedValues,PieDataset,Values
- Direct Known Subclasses:
DefaultKeyedValuesDataset,JDBCPieDataset
public class DefaultPieDataset extends AbstractDataset implements PieDataset, Cloneable, Serializable
A default implementation of the
PieDataset interface.- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description DefaultPieDataset()Constructs a new dataset, initially empty.DefaultPieDataset(KeyedValues data)Creates a new dataset that uses the data from aKeyedValuesinstance. -
Method Summary
Modifier and Type Method Description Objectclone()Returns a clone.booleanequals(Object o)Tests if this object is equal to another.intgetIndex(Comparable key)Returns the index for a key.intgetItemCount()Returns the number of items in the dataset.ComparablegetKey(int item)Returns the key for an item.ListgetKeys()Returns the categories in the dataset.NumbergetValue(int item)Returns a value.NumbergetValue(Comparable key)Returns the data value associated with a key.inthashCode()Returns a hash code.voidsetValue(Comparable key, double value)Sets the data value for a key.voidsetValue(Comparable key, Number value)Sets the data value for a key.Methods inherited from class org.jfree.data.AbstractDataset
addChangeListener, getGroup, removeChangeListener, setGroup, validateObjectMethods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jfree.data.Dataset
addChangeListener, getGroup, removeChangeListener, setGroup
-
Constructor Details
-
DefaultPieDataset
public DefaultPieDataset()Constructs a new dataset, initially empty. -
DefaultPieDataset
Creates a new dataset that uses the data from aKeyedValuesinstance.- Parameters:
data- the data.
-
-
Method Details
-
getItemCount
public int getItemCount()Returns the number of items in the dataset.- Specified by:
getItemCountin interfaceValues- Returns:
- the item count.
-
getKeys
Returns the categories in the dataset. The returned list is unmodifiable.- Specified by:
getKeysin interfaceKeyedValues- Returns:
- the categories in the dataset.
-
getKey
Returns the key for an item.- Specified by:
getKeyin interfaceKeyedValues- Parameters:
item- the item index (zero-based).- Returns:
- the category.
-
getIndex
Returns the index for a key.- Specified by:
getIndexin interfaceKeyedValues- Parameters:
key- the key.- Returns:
- the key index.
-
getValue
Returns a value. -
getValue
Returns the data value associated with a key.- Specified by:
getValuein interfaceKeyedValues- Parameters:
key- the key (nullnot permitted).- Returns:
- the value (possibly
null).
-
setValue
Sets the data value for a key.- Parameters:
key- the key.value- the value.
-
setValue
Sets the data value for a key.- Parameters:
key- the key.value- the value.
-
equals
Tests if this object is equal to another. -
hashCode
public int hashCode()Returns a hash code. -
clone
Returns a clone.- Overrides:
clonein classAbstractDataset- Returns:
- A clone.
- Throws:
CloneNotSupportedException- This class will not throw this exception, but subclasses (if any) might.
-