Package jadex.tools.comanalyzer.chart
Class CategoryPieDataset
- java.lang.Object
-
- org.jfree.data.general.AbstractDataset
-
- jadex.tools.comanalyzer.chart.CategoryPieDataset
-
- All Implemented Interfaces:
java.io.ObjectInputValidation
,java.io.Serializable
,java.lang.Cloneable
,org.jfree.data.category.CategoryDataset
,org.jfree.data.general.Dataset
,org.jfree.data.general.PieDataset
,org.jfree.data.KeyedValues
,org.jfree.data.KeyedValues2D
,org.jfree.data.Values
,org.jfree.data.Values2D
public class CategoryPieDataset extends org.jfree.data.general.AbstractDataset implements org.jfree.data.general.PieDataset, org.jfree.data.category.CategoryDataset, java.io.Serializable
A dataset that implements both PieDataset and CategoryDataset and can be used for both types of charts. The dataset contains Lists rather than values. For the interfaces getValue() retrieves the size of the list for a specific row and column index- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CategoryPieDataset()
Creates a new (empty) dataset.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addElement(java.lang.Object element, java.lang.Comparable rowKey, java.lang.Comparable columnKey)
Adds an element to an existing list in the dataset and sends a DatasetChangeEvent to all registered listeners.void
clear()
Clears all data from the dataset and sends a DatasetChangeEvent} to all registered listeners.int
getColumnCount()
Returns the number of columns in the table.int
getColumnIndex(java.lang.Comparable key)
Returns the column index for a given key.java.lang.Comparable
getColumnKey(int column)
Returns a column key.java.util.List
getColumnKeys()
Returns the column keys.int
getExtractMode()
int
getIndex(java.lang.Comparable key)
Returns the index for a key in the pie dataset, or -1 if the key is not recognised.int
getItemCount()
Returns the number of items in the pie dataset.java.lang.Comparable
getKey(int item)
Returns the key for the specified item in the pie dataset, ornull
.java.util.List
getKeys()
Returns the categories in the pie dataset.java.util.List
getList(java.lang.Comparable key)
Returns the list of all pie elements.java.util.List
getList(java.lang.Comparable key, int pieindex)
Returns the list of elements from a specific pieindex.java.util.List
getList(java.lang.Comparable rowKey, java.lang.Comparable columnKey)
Retrun the list for a given row and column key.int
getRowCount()
Returns the number of rows in the table.int
getRowIndex(java.lang.Comparable key)
Returns the row index for a given key.java.lang.Comparable
getRowKey(int row)
Returns a row key.java.util.List
getRowKeys()
Returns the row keys.java.lang.Number
getValue(int item)
Returns a value for a specific item in the pie dataset.java.lang.Number
getValue(int row, int column)
Returns a value from the table.java.lang.Number
getValue(java.lang.Comparable key)
Returns the data value associated with a key.java.lang.Number
getValue(java.lang.Comparable rowKey, java.lang.Comparable columnKey)
Returns the value for a pair of keys.void
removeColumn(int columnIndex)
Removes a column from the dataset and sends a DatasetChangeEvent to all registered listeners.void
removeColumn(java.lang.Comparable columnKey)
Removes a column from the dataset and sends a DatasetChangeEvent to all registered listeners.void
removeElement(java.lang.Object element, java.lang.Comparable rowKey, java.lang.Comparable columnKey)
Removes an element from an existing list in the dataset and sends a DatasetChangeEvent to all registered listeners.void
removeRow(int rowIndex)
Removes a row from the dataset and sends a DatasetChangeEvent to all registered listeners.void
removeRow(java.lang.Comparable rowKey)
Removes a row from the dataset and sends a DatasetChangeEvent to all registered listeners.void
setExtractMode(int extractMode)
void
setList(java.util.List list, java.lang.Comparable rowKey, java.lang.Comparable columnKey)
Adds or updates a list in the table and sends a DatasetChangeEvent to all registered listeners.-
Methods inherited from class org.jfree.data.general.AbstractDataset
addChangeListener, clone, fireDatasetChanged, getGroup, hasListener, notifyListeners, removeChangeListener, setGroup, validateObject
-
-
-
-
Field Detail
-
BY_ROW
public static final int BY_ROW
Extact pie data by row- See Also:
- Constant Field Values
-
BY_COLUMN
public static final int BY_COLUMN
Extact pie data by column- See Also:
- Constant Field Values
-
-
Method Detail
-
setList
public void setList(java.util.List list, java.lang.Comparable rowKey, java.lang.Comparable columnKey)
Adds or updates a list in the table and sends a DatasetChangeEvent to all registered listeners.- Parameters:
list
- the list (null
permitted).rowKey
- the row key (null
not permitted).columnKey
- the column key (null
not permitted).
-
addElement
public void addElement(java.lang.Object element, java.lang.Comparable rowKey, java.lang.Comparable columnKey)
Adds an element to an existing list in the dataset and sends a DatasetChangeEvent to all registered listeners. If the existing list isnull
, a new list is created and the element is added.- Parameters:
element
- The element.rowKey
- The row key (null
is converted to the nullstring).columnKey
- The column key (null
is converted to the nullstring)..
-
removeElement
public void removeElement(java.lang.Object element, java.lang.Comparable rowKey, java.lang.Comparable columnKey)
Removes an element from an existing list in the dataset and sends a DatasetChangeEvent to all registered listeners. If the existing list isnull
, a new list is created and the element is added.- Parameters:
element
- The element.rowKey
- The row key (null
is converted to the nullstring).columnKey
- The column key (null
is converted to the nullstring)..
-
getList
public java.util.List getList(java.lang.Comparable rowKey, java.lang.Comparable columnKey)
Retrun the list for a given row and column key.- Parameters:
rowKey
- The row key (null
is converted to the nullstring).columnKey
- The column key (null
is converted to the nullstring)..- Returns:
- The list.
-
removeRow
public void removeRow(int rowIndex)
Removes a row from the dataset and sends a DatasetChangeEvent to all registered listeners.- Parameters:
rowIndex
- the row index.
-
removeRow
public void removeRow(java.lang.Comparable rowKey)
Removes a row from the dataset and sends a DatasetChangeEvent to all registered listeners.- Parameters:
rowKey
- the row key.
-
removeColumn
public void removeColumn(int columnIndex)
Removes a column from the dataset and sends a DatasetChangeEvent to all registered listeners.- Parameters:
columnIndex
- the column index.
-
removeColumn
public void removeColumn(java.lang.Comparable columnKey)
Removes a column from the dataset and sends a DatasetChangeEvent to all registered listeners.- Parameters:
columnKey
- the column key.
-
clear
public void clear()
Clears all data from the dataset and sends a DatasetChangeEvent} to all registered listeners.
-
getRowCount
public int getRowCount()
Returns the number of rows in the table.- Specified by:
getRowCount
in interfaceorg.jfree.data.Values2D
- Returns:
- The row count.
-
getColumnCount
public int getColumnCount()
Returns the number of columns in the table.- Specified by:
getColumnCount
in interfaceorg.jfree.data.Values2D
- Returns:
- The column count.
-
getValue
public java.lang.Number getValue(int row, int column)
Returns a value from the table.- Specified by:
getValue
in interfaceorg.jfree.data.Values2D
- Parameters:
row
- the row index (zero-based).column
- the column index (zero-based).- Returns:
- The value (possibly
null
).
-
getRowKey
public java.lang.Comparable getRowKey(int row)
Returns a row key.- Specified by:
getRowKey
in interfaceorg.jfree.data.KeyedValues2D
- Parameters:
row
- the row index (zero-based).- Returns:
- The row key.
-
getRowIndex
public int getRowIndex(java.lang.Comparable key)
Returns the row index for a given key.- Specified by:
getRowIndex
in interfaceorg.jfree.data.KeyedValues2D
- Parameters:
key
- the row key.- Returns:
- The row index.
-
getRowKeys
public java.util.List getRowKeys()
Returns the row keys.- Specified by:
getRowKeys
in interfaceorg.jfree.data.KeyedValues2D
- Returns:
- The keys.
-
getColumnKey
public java.lang.Comparable getColumnKey(int column)
Returns a column key.- Specified by:
getColumnKey
in interfaceorg.jfree.data.KeyedValues2D
- Parameters:
column
- the column index (zero-based).- Returns:
- The column key.
-
getColumnIndex
public int getColumnIndex(java.lang.Comparable key)
Returns the column index for a given key.- Specified by:
getColumnIndex
in interfaceorg.jfree.data.KeyedValues2D
- Parameters:
key
- the column key.- Returns:
- The column index.
-
getColumnKeys
public java.util.List getColumnKeys()
Returns the column keys.- Specified by:
getColumnKeys
in interfaceorg.jfree.data.KeyedValues2D
- Returns:
- The keys.
-
getValue
public java.lang.Number getValue(java.lang.Comparable rowKey, java.lang.Comparable columnKey)
Returns the value for a pair of keys.- Specified by:
getValue
in interfaceorg.jfree.data.KeyedValues2D
- Parameters:
rowKey
- the row key (null
not permitted).columnKey
- the column key (null
not permitted).- Returns:
- The value (possibly
null
).
-
getExtractMode
public int getExtractMode()
- Returns:
- the extract mode for pie data
-
setExtractMode
public void setExtractMode(int extractMode)
- Parameters:
extractMode
- the extract mode to set
-
getList
public java.util.List getList(java.lang.Comparable key)
Returns the list of all pie elements.- Parameters:
key
- The key (null
not permitted).- Returns:
- The list (possibly
null
).
-
getList
public java.util.List getList(java.lang.Comparable key, int pieindex)
Returns the list of elements from a specific pieindex.- Parameters:
key
- The key (null
not permitted).pieindex
- The pieindex.- Returns:
- The list (possibly
null
).
-
getItemCount
public int getItemCount()
Returns the number of items in the pie dataset.- Specified by:
getItemCount
in interfaceorg.jfree.data.Values
- Returns:
- The item count.
-
getValue
public java.lang.Number getValue(int item)
Returns a value for a specific item in the pie dataset.- Specified by:
getValue
in interfaceorg.jfree.data.Values
- Parameters:
item
- The item index.- Returns:
- The value (possibly
null
).
-
getIndex
public int getIndex(java.lang.Comparable key)
Returns the index for a key in the pie dataset, or -1 if the key is not recognised.- Specified by:
getIndex
in interfaceorg.jfree.data.KeyedValues
- Parameters:
key
- the key (null
not permitted).- Returns:
- The index, or
-1
if the key is unrecognised.
-
getKey
public java.lang.Comparable getKey(int item)
Returns the key for the specified item in the pie dataset, ornull
.- Specified by:
getKey
in interfaceorg.jfree.data.KeyedValues
- Parameters:
item
- the item index (in the range0
togetItemCount() - 1
).- Returns:
- The key, or
null
.
-
getKeys
public java.util.List getKeys()
Returns the categories in the pie dataset. The returned list is unmodifiable.- Specified by:
getKeys
in interfaceorg.jfree.data.KeyedValues
- Returns:
- The categories in the dataset.
-
getValue
public java.lang.Number getValue(java.lang.Comparable key)
Returns the data value associated with a key.- Specified by:
getValue
in interfaceorg.jfree.data.KeyedValues
- Parameters:
key
- the key (null
not permitted).- Returns:
- The value (possibly
null
).
-
-