prefuse.data.util
Class RowManager

java.lang.Object
  extended by prefuse.data.util.RowManager
Direct Known Subclasses:
FilteredRowManager

public class RowManager
extends java.lang.Object

Manages the set of valid rows for a Table instance, maintains an index of the available and occupied rows. RowManager instances are used internally by Table instances.

Author:
jeffrey heer

Nested Class Summary
 class RowManager.ColumnRowIterator
          Iterator over the indices into a given data column, mapped to from the rows of this RowManager.
 class RowManager.RowIterator
          Iterator over the occupied rows of this RowManager.
 
Field Summary
protected  Table m_table
           
 
Constructor Summary
RowManager(Table table)
          Create a new RowManager for the given Table.
 
Method Summary
 int addRow()
          Add a new row to management.
 void clear()
          Clear the row manager status, marking all rows as available.
 IntIterator columnRows(int col)
          Return an iterator over column row indices.
 IntIterator columnRows(int col, boolean reverse)
          Return an iterator over column row indices.
 IntIterator columnRows(IntIterator rows, int col)
          Return an iterator over column row indices.
 int getColumnRow(int row, int col)
          Given Table row and column indices, return the corresponding row in the underlying data column.
 int getMaximumRow()
          Get the highest-numbered occupied table row.
 int getMinimumRow()
          Get the lowest-numbered occupied table row.
 int getRowCount()
          Get the total number of occupied rows
 Table getTable()
          Get the table managed by this RowManager.
 int getTableRow(int columnRow, int col)
          Given a column row index and a table column index, return the table row corresponding to the column value.
 boolean isValidRow(int row)
          Indicates if a given row value is a valid, occupied row of the table.
 boolean releaseRow(int row)
          Release a row and mark it as free.
 IntIterator rows()
          Get an iterator over the table rows.
 IntIterator rows(boolean reverse)
          Get an iterator over the table rows.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_table

protected Table m_table
Constructor Detail

RowManager

public RowManager(Table table)
Create a new RowManager for the given Table.

Parameters:
table - the Table to manage
Method Detail

getTable

public Table getTable()
Get the table managed by this RowManager.

Returns:
the managed table

getMinimumRow

public int getMinimumRow()
Get the lowest-numbered occupied table row.

Returns:
the minimum row

getMaximumRow

public int getMaximumRow()
Get the highest-numbered occupied table row.

Returns:
the maximum row

getRowCount

public int getRowCount()
Get the total number of occupied rows

Returns:
the number of rows being used by the table

isValidRow

public boolean isValidRow(int row)
Indicates if a given row value is a valid, occupied row of the table.

Parameters:
row - the row index to check
Returns:
true if the row is valid and in use by the Table, false if it is an illegal value or is currently free

clear

public void clear()
Clear the row manager status, marking all rows as available.


addRow

public int addRow()
Add a new row to management. The lowest valued available row will be used.

Returns:
the row index of the newly added row

releaseRow

public boolean releaseRow(int row)
Release a row and mark it as free.

Parameters:
row - the row index of the released row
Returns:
true if the row was successfully released, false if it was already free or if the input is not a valid row index

getColumnRow

public int getColumnRow(int row,
                        int col)
Given Table row and column indices, return the corresponding row in the underlying data column. This is of use for CascadedTable instances, which may reveal only a limited set of a parent table's rows and so must map between table rows and the actual indices of the inherited data columns.

Parameters:
row - the table row
col - the table column
Returns:
the row value for accessing the correct value of the referenced data column.

getTableRow

public int getTableRow(int columnRow,
                       int col)
Given a column row index and a table column index, return the table row corresponding to the column value. This is of use for CascadedTable instances, which may reveal only a limited set of a parent table's rows and so must map between table rows and the actual indices of the inherited data columns.

Parameters:
columnRow - the row of the underlying data column
col - the table column
Returns:
the row value for the Table that corresponds to the given column row

columnRows

public IntIterator columnRows(int col)
Return an iterator over column row indices.

Parameters:
col - the table column index
Returns:
an iterator over column row indices corresponding to valid rows of this RowManager

columnRows

public IntIterator columnRows(int col,
                              boolean reverse)
Return an iterator over column row indices.

Parameters:
col - the table column index
reverse - indicates the direction to iterate over, true for reverse, false for normal
Returns:
an iterator over column row indices corresponding to valid rows of this RowManager

columnRows

public IntIterator columnRows(IntIterator rows,
                              int col)
Return an iterator over column row indices.

Parameters:
rows - an iterator over table row indices
col - the table column index
Returns:
an iterator over column row indices corresponding to valid rows of this RowManager

rows

public IntIterator rows()
Get an iterator over the table rows.

Returns:
an iterator over the table rows

rows

public IntIterator rows(boolean reverse)
Get an iterator over the table rows.

Parameters:
reverse - indicates the direction to iterate over, true for reverse, false for normal
Returns:
an iterator over the table rows


Copyright © 2007 Regents of the University of California