Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

de.lmu.ifi.dbs.elki.utilities.output
Class PrettyPrinter

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.logging.AbstractLoggable
      extended by de.lmu.ifi.dbs.elki.utilities.output.PrettyPrinter
All Implemented Interfaces:
Loggable

public class PrettyPrinter
extends AbstractLoggable

Class for formatting output into table.

Author:
Arthur Zimek

Field Summary
private  int[] columnWidth
          provides the column width for each column
static String NEWLINE
          The newline-String dependent on the system.
private  String separator
          provides a separator to separate different columns (could be empty String)
 
Fields inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable
debug
 
Constructor Summary
PrettyPrinter(int[] columnWidth, String separator)
          Provides a PrettyPrinter with specified columnWidth and specified separator.
 
Method Summary
 Vector<String> breakLine(String line, int column)
          Breaks a line at near line-end spaces fitting to width of columnWidth[column].
 String formattedLine(String[] lineEntries, char fillCharacter)
          Formattes given lineEntries into formatted tableLine, filled with specified fillCharacter.
 String formattedLine(String[] lineEntries, char fillCharacter, boolean[] leftBounded)
          Formattes given lineEntries into formatted tableLine, filled with specified fillCharacter.
 
Methods inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable
debugFine, debugFiner, debugFinest, exception, message, progress, progress, progress, verbose, verbose, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NEWLINE

public static final String NEWLINE
The newline-String dependent on the system.


columnWidth

private int[] columnWidth
provides the column width for each column


separator

private String separator
provides a separator to separate different columns (could be empty String)

Constructor Detail

PrettyPrinter

public PrettyPrinter(int[] columnWidth,
                     String separator)
Provides a PrettyPrinter with specified columnWidth and specified separator.

Method Detail

formattedLine

public String formattedLine(String[] lineEntries,
                            char fillCharacter)
Formattes given lineEntries into formatted tableLine, filled with specified fillCharacter.

Parameters:
lineEntries - the entries to be written into table
fillCharacter - char to fill the table line with
Returns:
formatted lineEntries

formattedLine

public String formattedLine(String[] lineEntries,
                            char fillCharacter,
                            boolean[] leftBounded)
Formattes given lineEntries into formatted tableLine, filled with specified fillCharacter.

Parameters:
lineEntries - the entries to be written into table
fillCharacter - char to fill the table line with
leftBounded - specifies, if column is leftBounded
Returns:
formatted lineEntries

breakLine

public Vector<String> breakLine(String line,
                                int column)
Breaks a line at near line-end spaces fitting to width of columnWidth[column].

Parameters:
line - the line to break
column - the index of column in columnWidth
Returns:
Vector contains the lines made of the given line

Release 0.1 (2008-07-10_1838)