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.SerializableA 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 voidaddElement(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.voidclear()Clears all data from the dataset and sends a DatasetChangeEvent} to all registered listeners.intgetColumnCount()Returns the number of columns in the table.intgetColumnIndex(java.lang.Comparable key)Returns the column index for a given key.java.lang.ComparablegetColumnKey(int column)Returns a column key.java.util.ListgetColumnKeys()Returns the column keys.intgetExtractMode()intgetIndex(java.lang.Comparable key)Returns the index for a key in the pie dataset, or -1 if the key is not recognised.intgetItemCount()Returns the number of items in the pie dataset.java.lang.ComparablegetKey(int item)Returns the key for the specified item in the pie dataset, ornull.java.util.ListgetKeys()Returns the categories in the pie dataset.java.util.ListgetList(java.lang.Comparable key)Returns the list of all pie elements.java.util.ListgetList(java.lang.Comparable key, int pieindex)Returns the list of elements from a specific pieindex.java.util.ListgetList(java.lang.Comparable rowKey, java.lang.Comparable columnKey)Retrun the list for a given row and column key.intgetRowCount()Returns the number of rows in the table.intgetRowIndex(java.lang.Comparable key)Returns the row index for a given key.java.lang.ComparablegetRowKey(int row)Returns a row key.java.util.ListgetRowKeys()Returns the row keys.java.lang.NumbergetValue(int item)Returns a value for a specific item in the pie dataset.java.lang.NumbergetValue(int row, int column)Returns a value from the table.java.lang.NumbergetValue(java.lang.Comparable key)Returns the data value associated with a key.java.lang.NumbergetValue(java.lang.Comparable rowKey, java.lang.Comparable columnKey)Returns the value for a pair of keys.voidremoveColumn(int columnIndex)Removes a column from the dataset and sends a DatasetChangeEvent to all registered listeners.voidremoveColumn(java.lang.Comparable columnKey)Removes a column from the dataset and sends a DatasetChangeEvent to all registered listeners.voidremoveElement(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.voidremoveRow(int rowIndex)Removes a row from the dataset and sends a DatasetChangeEvent to all registered listeners.voidremoveRow(java.lang.Comparable rowKey)Removes a row from the dataset and sends a DatasetChangeEvent to all registered listeners.voidsetExtractMode(int extractMode)voidsetList(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 (nullpermitted).rowKey- the row key (nullnot permitted).columnKey- the column key (nullnot 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 (nullis converted to the nullstring).columnKey- The column key (nullis 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 (nullis converted to the nullstring).columnKey- The column key (nullis 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 (nullis converted to the nullstring).columnKey- The column key (nullis 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:
getRowCountin interfaceorg.jfree.data.Values2D- Returns:
- The row count.
-
getColumnCount
public int getColumnCount()
Returns the number of columns in the table.- Specified by:
getColumnCountin 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:
getValuein 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:
getRowKeyin 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:
getRowIndexin 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:
getRowKeysin interfaceorg.jfree.data.KeyedValues2D- Returns:
- The keys.
-
getColumnKey
public java.lang.Comparable getColumnKey(int column)
Returns a column key.- Specified by:
getColumnKeyin 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:
getColumnIndexin 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:
getColumnKeysin 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:
getValuein interfaceorg.jfree.data.KeyedValues2D- Parameters:
rowKey- the row key (nullnot permitted).columnKey- the column key (nullnot 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 (nullnot 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 (nullnot permitted).pieindex- The pieindex.- Returns:
- The list (possibly
null).
-
getItemCount
public int getItemCount()
Returns the number of items in the pie dataset.- Specified by:
getItemCountin 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:
getValuein 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:
getIndexin interfaceorg.jfree.data.KeyedValues- Parameters:
key- the key (nullnot permitted).- Returns:
- The index, or
-1if 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:
getKeyin interfaceorg.jfree.data.KeyedValues- Parameters:
item- the item index (in the range0togetItemCount() - 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:
getKeysin 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:
getValuein interfaceorg.jfree.data.KeyedValues- Parameters:
key- the key (nullnot permitted).- Returns:
- The value (possibly
null).
-
-