## org.jfree.data.general
Class DefaultPieDataset

    java.lang.Object
      org.jfree.data.general.AbstractDataset
          org.jfree.data.general.DefaultPieDataset

All Implemented Interfaces:
  java.io.ObjectInputValidation, java.io.Serializable, java.lang.Cloneable, Dataset, PieDataset, KeyedValues, Values, org.jfree.util.PublicCloneable

Direct Known Subclasses:
  DefaultKeyedValuesDataset, JDBCPieDataset

    public class DefaultPieDataset

extends AbstractDataset
implements PieDataset, java.lang.Cloneable, org.jfree.util.PublicCloneable, java.io.Serializable

A default implementation of the `PieDataset` interface.

See Also:
  Serialized Form

Constructor Summary
`DefaultPieDataset()` Constructs a new dataset, initially empty.
`DefaultPieDataset(KeyedValues data)` Creates a new dataset by copying data from a `KeyedValues` instance.

Method Summary
`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.
`int` `getItemCount()` Returns the number of items in the dataset.
`java.lang.Comparable` `getKey(int item)` Returns the key for an item.
`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` `setValue(java.lang.Comparable key, double value)` Sets the data value for a key.
`void` `setValue(java.lang.Comparable key, java.lang.Number value)` Sets the data value for a key.

Methods inherited from class org.jfree.data.general.AbstractDataset
`addChangeListener, fireDatasetChanged, getGroup, notifyListeners, removeChangeListener, setGroup, validateObject`

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.jfree.data.general.Dataset
`addChangeListener, getGroup, removeChangeListener, setGroup`

Constructor Detail

### DefaultPieDataset

    public DefaultPieDataset()

  Constructs a new dataset, initially empty.

### DefaultPieDataset

    public DefaultPieDataset(KeyedValues data)

  Creates a new dataset by copying data from a `KeyedValues` instance.

  Parameters:
    `data` - the data (`null` not permitted).

Method Detail

### getItemCount

    public int getItemCount()

  Returns the number of items in the dataset.

  Specified by:
    `getItemCount` in interface `Values`
  Returns:
    The item count.

### getKeys

    public java.util.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 java.lang.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 key.

### getIndex

    public int getIndex(java.lang.Comparable key)

  Returns the index for a key.

  Specified by:
    `getIndex` in interface `KeyedValues`
  Parameters:
    `key` - the key.
  Returns:
    The index, or `-1` if the key is unrecognised.

### getValue

    public java.lang.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 java.lang.Number getValue(java.lang.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`).
  Throws:
    `UnknownKeyException` - if the key is not recognised.

### setValue

    public void setValue(java.lang.Comparable key,
                         java.lang.Number value)

  Sets the data value for a key.

  Parameters:
    `key` - the key.
    `value` - the value.

### setValue

    public void setValue(java.lang.Comparable key,
                         double value)

  Sets the data value for a key.

  Parameters:
    `key` - the key.
    `value` - the value.

### equals

    public boolean equals(java.lang.Object obj)

  Tests if this object is equal to another.

  Overrides:
    `equals` in class `java.lang.Object`
  Parameters:
    `obj` - the other object.
  Returns:
    A boolean.

### hashCode

    public int hashCode()

  Returns a hash code.

  Overrides:
    `hashCode` in class `java.lang.Object`
  Returns:
    A hash code.

### clone

    public java.lang.Object clone()
                           throws java.lang.CloneNotSupportedException

  Returns a clone of the dataset.

  Specified by:
    `clone` in interface `org.jfree.util.PublicCloneable`
  Overrides:
    `clone` in class `AbstractDataset`
  Returns:
    A clone.
  Throws:
    `java.lang.CloneNotSupportedException` - This class will not throw this exception, but subclasses (if any) might.