org.jfree.data.category
Class CategoryToPieDataset

java.lang.Object
  extended byorg.jfree.data.general.AbstractDataset
      extended byorg.jfree.data.category.CategoryToPieDataset
All Implemented Interfaces:
java.lang.Cloneable, Dataset, DatasetChangeListener, java.util.EventListener, KeyedValues, java.io.ObjectInputValidation, PieDataset, java.io.Serializable, Values

public class CategoryToPieDataset
extends AbstractDataset
implements PieDataset, DatasetChangeListener

A PieDataset implementation that obtains its data from one row or column of a CategoryDataset.

See Also:
Serialized Form

Constructor Summary
CategoryToPieDataset(CategoryDataset source, TableOrder extract, int index)
          An adaptor class that converts any CategoryDataset into a PieDataset, by taking the values from a single row or column.
 
Method Summary
 void datasetChanged(DatasetChangeEvent event)
          Passes the DatasetChangeEvent through.
 int getIndex(java.lang.Comparable key)
          Returns the index for a given key.
 int getItemCount()
          Returns the number of items (values) in the collection.
 java.lang.Comparable getKey(int index)
          Returns a key.
 java.util.List getKeys()
          Returns the keys.
 java.lang.Number getValue(java.lang.Comparable key)
          Returns the value for a given key.
 java.lang.Number getValue(int item)
          Returns a value.
 
Methods inherited from class org.jfree.data.general.AbstractDataset
addChangeListener, clone, fireDatasetChanged, getGroup, notifyListeners, removeChangeListener, setGroup, validateObject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jfree.data.general.Dataset
addChangeListener, getGroup, removeChangeListener, setGroup
 

Constructor Detail

CategoryToPieDataset

public CategoryToPieDataset(CategoryDataset source,
                            TableOrder extract,
                            int index)
An adaptor class that converts any CategoryDataset into a PieDataset, by taking the values from a single row or column.

Parameters:
source - the source dataset (null permitted).
extract - extract data from rows or columns? (null not permitted).
index - the row or column index.
Method Detail

getItemCount

public int getItemCount()
Returns the number of items (values) in the collection. If the underlying dataset is null, this method returns zero.

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

getValue

public java.lang.Number getValue(int item)
Returns a value.

Specified by:
getValue in interface Values
Parameters:
item - the item index (zero-based).
Returns:
The value (possibly null).

getKey

public java.lang.Comparable getKey(int index)
Returns a key.

Specified by:
getKey in interface KeyedValues
Parameters:
index - the item index (zero-based).
Returns:
The key.

getIndex

public int getIndex(java.lang.Comparable key)
Returns the index for a given key.

Specified by:
getIndex in interface KeyedValues
Parameters:
key - the key.
Returns:
The index.

getKeys

public java.util.List getKeys()
Returns the keys.

Specified by:
getKeys in interface KeyedValues
Returns:
The keys.

getValue

public java.lang.Number getValue(java.lang.Comparable key)
Returns the value for a given key. If the key is not recognised, the method should return null (but note that null can be associated with a valid key also).

Specified by:
getValue in interface KeyedValues
Parameters:
key - the key.
Returns:
The value (possibly null).

datasetChanged

public void datasetChanged(DatasetChangeEvent event)
Passes the DatasetChangeEvent through.

Specified by:
datasetChanged in interface DatasetChangeListener
Parameters:
event - the event.