Package jadex.tools.comanalyzer.chart
Class KeyedListsTable
- java.lang.Object
-
- jadex.tools.comanalyzer.chart.KeyedListsTable
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,org.jfree.data.KeyedValues2D,org.jfree.data.Values2D
public class KeyedListsTable extends java.lang.Object implements org.jfree.data.KeyedValues2D, java.lang.Cloneable, java.io.SerializableA data structure that stores lists, where each list is associated with two keys (a 'row' key and a 'column' key).- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description KeyedListsTable()Creates a new table.KeyedListsTable(boolean sortRowKeys)Creates a new table.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddToList(java.lang.Object element, java.lang.Comparable rowKey, java.lang.Comparable columnKey)Adds a element to a list.voidclear()Clears all the data and associated keys.intgetColumnCount()Returns the column count.intgetColumnIndex(java.lang.Comparable key)Returns the column index for a given key.java.lang.ComparablegetColumnKey(int column)Returns the key for a given column.java.util.ListgetColumnKeys()Returns the column keys in an unmodifiable list.java.util.ListgetList(java.lang.Comparable rowKey, java.lang.Comparable columnKey)Returns the List for the given row and column keys.intgetRowCount()Returns the row count.intgetRowIndex(java.lang.Comparable key)Returns the row index for a given key.java.lang.ComparablegetRowKey(int row)Returns the key for a given row.java.util.ListgetRowKeys()Returns the row keys in an unmodifiable list.java.lang.NumbergetValue(int row, int column)Returns the value for a given row and column.java.lang.NumbergetValue(java.lang.Comparable rowKey, java.lang.Comparable columnKey)Returns the value for the given row and column keys.voidremoveColumn(int columnIndex)Removes a column.voidremoveColumn(java.lang.Comparable columnKey)Removes a column.voidremoveFromList(java.lang.Object element, java.lang.Comparable rowKey, java.lang.Comparable columnKey)Removes an element from the table.voidremoveList(java.lang.Comparable rowKey, java.lang.Comparable columnKey)Removes a value from the table by setting it tonull.voidremoveRow(int rowIndex)Removes a row.voidremoveRow(java.lang.Comparable rowKey)Removes a row.voidsetList(java.util.List list, java.lang.Comparable rowKey, java.lang.Comparable columnKey)Adds or updates a list.
-
-
-
Method Detail
-
getList
public java.util.List getList(java.lang.Comparable rowKey, java.lang.Comparable columnKey)Returns the List for the given row and column keys.- Parameters:
rowKey- the row key (nullnot permitted).columnKey- the column key (nullnot permitted).- Returns:
- The List (possibly
null).
-
setList
public void setList(java.util.List list, java.lang.Comparable rowKey, java.lang.Comparable columnKey)Adds or updates a list.- Parameters:
list- the list (nullpermitted).rowKey- the row key (nullnot permitted).columnKey- the column key (nullnot permitted).
-
addToList
public void addToList(java.lang.Object element, java.lang.Comparable rowKey, java.lang.Comparable columnKey)Adds a element to a list.- Parameters:
element- the element to add (nullpermitted).rowKey- the row key (nullnot permitted).columnKey- the column key (nullnot permitted).
-
removeList
public void removeList(java.lang.Comparable rowKey, java.lang.Comparable columnKey)Removes a value from the table by setting it tonull. If all the values in the specified row and/or column are nownull, the row and/or column is removed from the table.- Parameters:
rowKey- the row key (nullnot permitted).columnKey- the column key (nullnot permitted).
-
removeFromList
public void removeFromList(java.lang.Object element, java.lang.Comparable rowKey, java.lang.Comparable columnKey)Removes an element from the table. If the list is empty, it is set tonull. If all the values in the specified row and/or column are nownull, the row and/or column is removed from the table.- Parameters:
rowKey- the row key (nullnot permitted).columnKey- the column key (nullnot permitted).
-
removeRow
public void removeRow(int rowIndex)
Removes a row.- Parameters:
rowIndex- the row index.
-
removeRow
public void removeRow(java.lang.Comparable rowKey)
Removes a row. If all values of any column arenull, the column(s) is/are removed.- Parameters:
rowKey- the row key (nullnot permitted).
-
removeColumn
public void removeColumn(int columnIndex)
Removes a column.- Parameters:
columnIndex- the column index.
-
removeColumn
public void removeColumn(java.lang.Comparable columnKey)
Removes a column.- Parameters:
columnKey- the column key (nullnot permitted).
-
clear
public void clear()
Clears all the data and associated keys.
-
getRowCount
public int getRowCount()
Returns the row count.- Specified by:
getRowCountin interfaceorg.jfree.data.Values2D- Returns:
- The row count.
-
getColumnCount
public int getColumnCount()
Returns the column count.- Specified by:
getColumnCountin interfaceorg.jfree.data.Values2D- Returns:
- The column count.
-
getValue
public java.lang.Number getValue(int row, int column)Returns the value for a given row and column.- Specified by:
getValuein interfaceorg.jfree.data.Values2D- Parameters:
row- the row index.column- the column index.- Returns:
- The value.
-
getValue
public java.lang.Number getValue(java.lang.Comparable rowKey, java.lang.Comparable columnKey)Returns the value for the given row and column 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).
-
getRowKey
public java.lang.Comparable getRowKey(int row)
Returns the key for a given row.- Specified by:
getRowKeyin interfaceorg.jfree.data.KeyedValues2D- Parameters:
row- the row index (in the range 0 togetRowCount()- 1).- 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 key (nullnot permitted).- Returns:
- The row index.
-
getRowKeys
public java.util.List getRowKeys()
Returns the row keys in an unmodifiable list.- Specified by:
getRowKeysin interfaceorg.jfree.data.KeyedValues2D- Returns:
- The row keys.
-
getColumnKey
public java.lang.Comparable getColumnKey(int column)
Returns the key for a given column.- Specified by:
getColumnKeyin interfaceorg.jfree.data.KeyedValues2D- Parameters:
column- the column (in the range 0 togetColumnCount()- 1).- Returns:
- The 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 key (nullnot permitted).- Returns:
- The column index.
-
getColumnKeys
public java.util.List getColumnKeys()
Returns the column keys in an unmodifiable list.- Specified by:
getColumnKeysin interfaceorg.jfree.data.KeyedValues2D- Returns:
- The column keys.
-
-