joptsimple.internal
Class ColumnarData

java.lang.Object
  extended by joptsimple.internal.ColumnarData

public class ColumnarData
extends Object

A means to display data in a text grid.

Author:
Paul Holser

Constructor Summary
ColumnarData(String... headers)
          Creates a new grid with the given column headers.
 
Method Summary
 void addRow(Object... rowData)
          Adds a row to the grid.
 void clear()
          Removes all data from the grid, but preserves the headers.
 String format()
          Gives a string that represents the data formatted in columns.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ColumnarData

public ColumnarData(String... headers)
Creates a new grid with the given column headers.

Parameters:
headers - column headers
Method Detail

addRow

public void addRow(Object... rowData)
Adds a row to the grid. The data will fall under the corresponding headers. There can be fewer elements in the row than headers. Any data in columns outside of the number of headers will not be added to the grid.

Parameters:
rowData - row data to add

format

public String format()
Gives a string that represents the data formatted in columns.

Returns:
the formatted grid

clear

public final void clear()
Removes all data from the grid, but preserves the headers.



Copyright © 2011. All Rights Reserved.