com.generationjava.io
Class Table

java.lang.Object
  extended bycom.generationjava.io.Table
All Implemented Interfaces:
Iterator

public class Table
extends Object
implements Iterator

Represents a table of information. A Table consists of a Collection of TableRows. Some dubious design with regards to the iteratorness.


Constructor Summary
Table()
          An empty table.
Table(Collection coll2d)
          Build a table from a Collection of Objects.
 
Method Summary
 void addRow(Object obj)
          Add a Row.
 boolean firstRow()
          Are we currently on the first row?
 int[] getColumnWidths()
          Get the widths of each column in an array.
 int getNumberOfColumns()
          Number of columns in this table.
 int getNumberOfRows()
          Number of rows in this table.
 int getWidth()
          Get the width of all the columns added together.
 boolean hasNext()
          Used to iterate over the table.
 boolean lastRow()
          Are we on the last row?
 Object next()
          Get the next value from the table.
 void remove()
          Iterator interface.
 void reset()
          Reset the iterator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Table

public Table()
An empty table.


Table

public Table(Collection coll2d)
Build a table from a Collection of Objects. The Objects may be Collections themselves.

Method Detail

addRow

public void addRow(Object obj)
Add a Row.


hasNext

public boolean hasNext()
Used to iterate over the table.

Specified by:
hasNext in interface Iterator

next

public Object next()
Get the next value from the table.

Specified by:
next in interface Iterator

reset

public void reset()
Reset the iterator.


remove

public void remove()
Iterator interface. Unimplemented.

Specified by:
remove in interface Iterator

firstRow

public boolean firstRow()
Are we currently on the first row?


lastRow

public boolean lastRow()
Are we on the last row?


getNumberOfRows

public int getNumberOfRows()
Number of rows in this table.


getNumberOfColumns

public int getNumberOfColumns()
Number of columns in this table.


getWidth

public int getWidth()
Get the width of all the columns added together.


getColumnWidths

public int[] getColumnWidths()
Get the widths of each column in an array.



Copyright © 2000-2005 OSJava. All Rights Reserved.