sbrt.shell.text
Class WhitespaceListFormat<E>

java.lang.Object
  extended by sbrt.shell.text.AbstractListFormat<E>
      extended by sbrt.shell.text.WhitespaceListFormat<E>
Type Parameters:
E - the element type.
All Implemented Interfaces:
Formatter<java.util.List<? extends E>>, ListFormat<E>, Parser<java.util.List<E>>

public final class WhitespaceListFormat<E>
extends AbstractListFormat<E>

This class is used to define a format for whitespace-delimited lists. Whitespace characters include: spaces, tabs, and new line characters. If a list is composed of elements a, b, c, its string representation would be "a b c".

Author:
This class was written and documented by Jeremiah Wright while in the Wagner lab.

Constructor Summary
WhitespaceListFormat(Formatter<E> elementFormatter, Parser<E> elementParser)
          Constructs a new whitespace-delimited list format with the provided element format.
WhitespaceListFormat(SimpleFormat<E> elementFormat)
          Constructs a new whitespace-delimited list format with the provided element format.
 
Method Summary
static WhitespaceListFormat<java.lang.String> getBasic()
          Returns a WhitespaceListFormat that does not format or parse the elements supplied to it.
 
Methods inherited from class sbrt.shell.text.AbstractListFormat
format, getDelimiter, getElementFormatter, getElementParser, getRegex, parse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface sbrt.shell.text.Formatter
format
 

Constructor Detail

WhitespaceListFormat

public WhitespaceListFormat(SimpleFormat<E> elementFormat)
Constructs a new whitespace-delimited list format with the provided element format.

Parameters:
elementFormat - the format of the list-elements.

WhitespaceListFormat

public WhitespaceListFormat(Formatter<E> elementFormatter,
                            Parser<E> elementParser)
Constructs a new whitespace-delimited list format with the provided element format.

Parameters:
elementFormatter - the formatter for the list-elements.
elementParser - the parser for the list-elements.
Method Detail

getBasic

public static final WhitespaceListFormat<java.lang.String> getBasic()
Returns a WhitespaceListFormat that does not format or parse the elements supplied to it. In other words, it returns a WhitespaceListFormat with the most basic possible functionality. Empty strings are not allowed however.

Returns:
an WhitespaceListFormat that does not format or parse the elements supplied to it.