org.basex.util
Class Table

java.lang.Object
  extended by org.basex.util.Table

public final class Table
extends java.lang.Object

This is a table representation for textual table output. It should be guaranteed that the header object has the same number of entries as all contents string arrays.

Author:
BaseX Team 2005-12, BSD License, Christian Gruen

Field Summary
 BoolList align
          Alignment (false: left, true: right alignment).
 java.util.ArrayList<TokenList> contents
          Table contents.
 java.lang.String description
          Data description; if available, will be added as footer.
 TokenList header
          Table header.
 
Constructor Summary
Table()
          Default constructor.
Table(java.lang.String in)
          Constructor with table input.
 
Method Summary
 int cols()
          Returns the number of columns.
 byte[] finish()
          Returns a textual representation of the table.
 int rows()
          Returns the number of rows.
 Table sort()
          Sorts the table by the first column.
 java.lang.String toString()
           
 Table toTop(byte[] top)
          Moves the specified string to top.
 java.lang.String value(int r, int c)
          Returns the value for the specified table position.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

header

public final TokenList header
Table header.


align

public final BoolList align
Alignment (false: left, true: right alignment).


contents

public final java.util.ArrayList<TokenList> contents
Table contents.


description

public java.lang.String description
Data description; if available, will be added as footer.

Constructor Detail

Table

public Table()
Default constructor.


Table

public Table(java.lang.String in)
Constructor with table input.

Parameters:
in - textual table input
Method Detail

sort

public Table sort()
Sorts the table by the first column.

Returns:
self reference

value

public java.lang.String value(int r,
                              int c)
Returns the value for the specified table position.

Parameters:
r - row
c - column
Returns:
value

rows

public int rows()
Returns the number of rows.

Returns:
number of rows

cols

public int cols()
Returns the number of columns.

Returns:
number of columns

toTop

public Table toTop(byte[] top)
Moves the specified string to top.

Parameters:
top - entry to be moved to the top
Returns:
self reference

finish

public byte[] finish()
Returns a textual representation of the table.

Returns:
text

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object