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 Details

    • DefaultPieDataset

      public DefaultPieDataset()
      Constructs a new dataset, initially empty.
    • DefaultPieDataset

      public DefaultPieDataset​(KeyedValues data)
      Creates a new dataset that uses the data from a KeyedValues instance.
      Parameters:
      data - the data.
  • Method Details

    • getItemCount

      public int getItemCount()
      Returns the number of items in the dataset.
      Specified by:
      getItemCount in interface Values
      Returns:
      the item count.
    • getKeys

      public List getKeys()
      Returns the categories in the dataset. The returned list is unmodifiable.
      Specified by:
      getKeys in interface KeyedValues
      Returns:
      the categories in the dataset.
    • getKey

      public Comparable getKey​(int item)
      Returns the key for an item.
      Specified by:
      getKey in interface KeyedValues
      Parameters:
      item - the item index (zero-based).
      Returns:
      the category.
    • getIndex

      public int getIndex​(Comparable key)
      Returns the index for a key.
      Specified by:
      getIndex in interface KeyedValues
      Parameters:
      key - the key.
      Returns:
      the key index.
    • getValue

      public Number getValue​(int item)
      Returns a value.
      Specified by:
      getValue in interface Values
      Parameters:
      item - the value index.
      Returns:
      the value (possibly null).
    • getValue

      public Number getValue​(Comparable key)
      Returns the data value associated with a key.
      Specified by:
      getValue in interface KeyedValues
      Parameters:
      key - the key (null not permitted).
      Returns:
      the value (possibly null).
    • setValue

      public void setValue​(Comparable key, Number value)
      Sets the data value for a key.
      Parameters:
      key - the key.
      value - the value.
    • setValue

      public void setValue​(Comparable key, double value)
      Sets the data value for a key.
      Parameters:
      key - the key.
      value - the value.
    • equals

      public boolean equals​(Object o)
      Tests if this object is equal to another.
      Overrides:
      equals in class Object
      Parameters:
      o - the other object.
      Returns:
      A boolean.
    • hashCode

      public int hashCode()
      Returns a hash code.
      Overrides:
      hashCode in class Object
      Returns:
      a hash code.
    • clone

      public Object clone() throws CloneNotSupportedException
      Returns a clone.
      Overrides:
      clone in class AbstractDataset
      Returns:
      A clone.
      Throws:
      CloneNotSupportedException - This class will not throw this exception, but subclasses (if any) might.