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 aKeyedValues
instance. -
Method Summary
Modifier and Type Method Description Object
clone()
Returns a clone.boolean
equals(Object o)
Tests if this object is equal to another.int
getIndex(Comparable key)
Returns the index for a key.int
getItemCount()
Returns the number of items in the dataset.Comparable
getKey(int item)
Returns the key for an item.List
getKeys()
Returns the categories in the dataset.Number
getValue(int item)
Returns a value.Number
getValue(Comparable key)
Returns the data value associated with a key.int
hashCode()
Returns a hash code.void
setValue(Comparable key, double value)
Sets the data value for a key.void
setValue(Comparable key, Number value)
Sets the data value for a key.Methods inherited from class org.jfree.data.AbstractDataset
addChangeListener, getGroup, removeChangeListener, setGroup, validateObject
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
Methods 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 aKeyedValues
instance.- Parameters:
data
- the data.
-
-
Method Details
-
getItemCount
public int getItemCount()Returns the number of items in the dataset.- Specified by:
getItemCount
in interfaceValues
- Returns:
- the item count.
-
getKeys
Returns the categories in the dataset. The returned list is unmodifiable.- Specified by:
getKeys
in interfaceKeyedValues
- Returns:
- the categories in the dataset.
-
getKey
Returns the key for an item.- Specified by:
getKey
in interfaceKeyedValues
- Parameters:
item
- the item index (zero-based).- Returns:
- the category.
-
getIndex
Returns the index for a key.- Specified by:
getIndex
in interfaceKeyedValues
- Parameters:
key
- the key.- Returns:
- the key index.
-
getValue
Returns a value. -
getValue
Returns the data value associated with a key.- Specified by:
getValue
in interfaceKeyedValues
- Parameters:
key
- the key (null
not 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:
clone
in classAbstractDataset
- Returns:
- A clone.
- Throws:
CloneNotSupportedException
- This class will not throw this exception, but subclasses (if any) might.
-