public class

DefaultPieDataset

extends AbstractDataset
implements Serializable Cloneable PieDataset
java.lang.Object
   ↳ org.jfree.data.general.AbstractDataset
     ↳ org.jfree.data.general.DefaultPieDataset
Known Direct Subclasses

Class Overview

A default implementation of the PieDataset interface.

Summary

Public Constructors
DefaultPieDataset()
Constructs a new dataset, initially empty.
DefaultPieDataset(KeyedValues data)
Creates a new dataset by copying data from a KeyedValues instance.
Public Methods
void clear()
Clears all data from this dataset and sends a DatasetChangeEvent to all registered listeners (unless the dataset was already empty).
Object clone()
Returns a clone of the dataset.
boolean equals(Object obj)
Tests if this object is equal to another.
int getIndex(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.
Comparable getKey(int item)
Returns the key for the specified item, or null.
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 insertValue(int position, 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, Comparable key, 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(Comparable key)
Removes an item from the dataset and sends a DatasetChangeEvent to all registered listeners.
void setValue(Comparable key, double value)
Sets the data value for a key and sends a DatasetChangeEvent to all registered listeners.
void setValue(Comparable key, Number value)
Sets the data value for a key and sends a DatasetChangeEvent to all registered listeners.
void sortByKeys(SortOrder order)
Sorts the dataset's items by key and sends a DatasetChangeEvent to all registered listeners.
void sortByValues(SortOrder order)
Sorts the dataset's items by value and sends a DatasetChangeEvent to all registered listeners.
[Expand]
Inherited Methods
From class org.jfree.data.general.AbstractDataset
From class java.lang.Object
From interface java.io.ObjectInputValidation
From interface org.jfree.data.KeyedValues
From interface org.jfree.data.Values
From interface org.jfree.data.general.Dataset

Public Constructors

public DefaultPieDataset ()

Constructs a new dataset, initially empty.

public DefaultPieDataset (KeyedValues data)

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

Parameters
data the data (null not permitted).

Public Methods

public void clear ()

Clears all data from this dataset and sends a DatasetChangeEvent to all registered listeners (unless the dataset was already empty).

public Object clone ()

Returns a clone of the dataset.

Returns
  • A clone.
Throws
CloneNotSupportedException This class will not throw this exception, but subclasses (if any) might.

public boolean equals (Object obj)

Tests if this object is equal to another.

Parameters
obj the other object.
Returns
  • A boolean.

public int getIndex (Comparable key)

Returns the index for a key, or -1 if the key is not recognised.

Parameters
key the key (null not permitted).
Returns
  • The index, or -1 if the key is unrecognised.
Throws
IllegalArgumentException if key is null.

public int getItemCount ()

Returns the number of items in the dataset.

Returns
  • The item count.

public Comparable getKey (int item)

Returns the key for the specified item, or null.

Parameters
item the item index (in the range 0 to getItemCount() - 1).
Returns
  • The key, or null.
Throws
IndexOutOfBoundsException if item is not in the specified range.

public List getKeys ()

Returns the categories in the dataset. The returned list is unmodifiable.

Returns
  • The categories in the dataset.

public Number getValue (int item)

Returns a value.

Parameters
item the value index.
Returns
  • The value (possibly null).

public Number getValue (Comparable key)

Returns the data value associated with a key.

Parameters
key the key (null not permitted).
Returns
  • The value (possibly null).
Throws
UnknownKeyException if the key is not recognised.

public int hashCode ()

Returns a hash code.

Returns
  • A hash code.

public void insertValue (int position, 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. After the change is made, this methods sends a DatasetChangeEvent to all registered listeners.

Parameters
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, Comparable key, 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. After the change is made, this methods sends a DatasetChangeEvent to all registered listeners.

Parameters
position the position (in the range 0 to getItemCount()).
key the key (null not permitted).
value the value (null permitted).

public void remove (Comparable key)

Removes an item from the dataset and sends a DatasetChangeEvent to all registered listeners.

Parameters
key the key (null not permitted).
Throws
IllegalArgumentException if key is null.

public void setValue (Comparable key, double value)

Sets the data value for a key and sends a DatasetChangeEvent to all registered listeners.

Parameters
key the key (null not permitted).
value the value.
Throws
IllegalArgumentException if key is null.

public void setValue (Comparable key, Number value)

Sets the data value for a key and sends a DatasetChangeEvent to all registered listeners.

Parameters
key the key (null not permitted).
value the value.
Throws
IllegalArgumentException if key is null.

public void sortByKeys (SortOrder order)

Sorts the dataset's items by key and sends a DatasetChangeEvent to all registered listeners.

Parameters
order the sort order (null not permitted).

public void sortByValues (SortOrder order)

Sorts the dataset's items by value and sends a DatasetChangeEvent to all registered listeners.

Parameters
order the sort order (null not permitted).