org.basex.util
Class Table

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

public final class Table
extends 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:
Workgroup DBIS, University of Konstanz 2005-10, ISC License, Christian Gruen

Field Summary
 BoolList align
          Alignment (false: left, true: right alignment).
 ArrayList<TokenList> contents
          Data (usually strings).
 String desc
          Data description.
static int DIST
          Distance between table columns.
 TokenList header
          Table header.
 
Constructor Summary
Table()
          Default constructor.
Table(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.
 void sort()
          Sorts the table by the first column.
 void toTop(byte[] top)
          Moves the specified string to top.
 String value(int r, int c)
          Returns the value for the specified table position.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

header

public TokenList header
Table header.


DIST

public static final int DIST
Distance between table columns.

See Also:
Constant Field Values

align

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


contents

public ArrayList<TokenList> contents
Data (usually strings).


desc

public String desc
Data description.

Constructor Detail

Table

public Table()
Default constructor.


Table

public Table(String in)
Constructor with table input.

Parameters:
in - textual table input
Method Detail

sort

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


value

public 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 void toTop(byte[] top)
Moves the specified string to top.

Parameters:
top - entry to be moved to the top

finish

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

Returns:
text