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.Serializable
A 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 void
addToList(java.lang.Object element, java.lang.Comparable rowKey, java.lang.Comparable columnKey)
Adds a element to a list.void
clear()
Clears all the data and associated keys.int
getColumnCount()
Returns the column count.int
getColumnIndex(java.lang.Comparable key)
Returns the column index for a given key.java.lang.Comparable
getColumnKey(int column)
Returns the key for a given column.java.util.List
getColumnKeys()
Returns the column keys in an unmodifiable list.java.util.List
getList(java.lang.Comparable rowKey, java.lang.Comparable columnKey)
Returns the List for the given row and column keys.int
getRowCount()
Returns the row count.int
getRowIndex(java.lang.Comparable key)
Returns the row index for a given key.java.lang.Comparable
getRowKey(int row)
Returns the key for a given row.java.util.List
getRowKeys()
Returns the row keys in an unmodifiable list.java.lang.Number
getValue(int row, int column)
Returns the value for a given row and column.java.lang.Number
getValue(java.lang.Comparable rowKey, java.lang.Comparable columnKey)
Returns the value for the given row and column keys.void
removeColumn(int columnIndex)
Removes a column.void
removeColumn(java.lang.Comparable columnKey)
Removes a column.void
removeFromList(java.lang.Object element, java.lang.Comparable rowKey, java.lang.Comparable columnKey)
Removes an element from the table.void
removeList(java.lang.Comparable rowKey, java.lang.Comparable columnKey)
Removes a value from the table by setting it tonull
.void
removeRow(int rowIndex)
Removes a row.void
removeRow(java.lang.Comparable rowKey)
Removes a row.void
setList(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 (null
not permitted).columnKey
- the column key (null
not 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 (null
permitted).rowKey
- the row key (null
not permitted).columnKey
- the column key (null
not 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 (null
permitted).rowKey
- the row key (null
not permitted).columnKey
- the column key (null
not 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 (null
not permitted).columnKey
- the column key (null
not 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 (null
not permitted).columnKey
- the column key (null
not 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 (null
not 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 (null
not permitted).
-
clear
public void clear()
Clears all the data and associated keys.
-
getRowCount
public int getRowCount()
Returns the row count.- Specified by:
getRowCount
in interfaceorg.jfree.data.Values2D
- Returns:
- The row count.
-
getColumnCount
public int getColumnCount()
Returns the column count.- Specified by:
getColumnCount
in 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:
getValue
in 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:
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
).
-
getRowKey
public java.lang.Comparable getRowKey(int row)
Returns the key for a given row.- Specified by:
getRowKey
in 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:
getRowIndex
in interfaceorg.jfree.data.KeyedValues2D
- Parameters:
key
- the key (null
not permitted).- Returns:
- The row index.
-
getRowKeys
public java.util.List getRowKeys()
Returns the row keys in an unmodifiable list.- Specified by:
getRowKeys
in 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:
getColumnKey
in 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:
getColumnIndex
in interfaceorg.jfree.data.KeyedValues2D
- Parameters:
key
- the key (null
not permitted).- Returns:
- The column index.
-
getColumnKeys
public java.util.List getColumnKeys()
Returns the column keys in an unmodifiable list.- Specified by:
getColumnKeys
in interfaceorg.jfree.data.KeyedValues2D
- Returns:
- The column keys.
-
-