org.writersforge.catalan.transform
Class TokenSplitter

java.lang.Object
  |
  +--org.writersforge.catalan.transform.BaseNodeProcessor
        |
        +--org.writersforge.catalan.transform.TextProcessor
              |
              +--org.writersforge.catalan.transform.TokenSplitter
All Implemented Interfaces:
org.writersforge.bellows.traverse.NodeProcessor

public class TokenSplitter
extends TextProcessor

A text processor which breaks apart its String contents into smaller parts, based on its own parameters. This processor expects only String input, and will produce only String output. The number of processed items may be equal to or greater than the input, but the total character count will always be the same; thus, this processor may break strings apart, but will not change the data content.

Author:
jsheets

Constructor Summary
TokenSplitter(java.lang.String[] tokens)
          Creates a new instance of TokenSplitter.
 
Method Summary
protected  java.util.List processText(java.lang.String text)
          Processes the text node.
 void setIncludeDelimiters(boolean includeDelimiters)
          Sets the policy for including delimiters in the output.
 java.lang.String toString()
          Convert this object to a String value.
 
Methods inherited from class org.writersforge.catalan.transform.TextProcessor
processNode
 
Methods inherited from class org.writersforge.catalan.transform.BaseNodeProcessor
addLeftover, end, getLeftovers, getNodes, start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TokenSplitter

public TokenSplitter(java.lang.String[] tokens)
Creates a new instance of TokenSplitter.

Parameters:
tokens - an array of tokens at which to split the content
Method Detail

setIncludeDelimiters

public void setIncludeDelimiters(boolean includeDelimiters)
Sets the policy for including delimiters in the output. If false, the processor will remove the delimiters; if true, the processor will include the delimiters as separate nodes in the results. By default, delimiters are not included.

Parameters:
includeDelimiters - true to include delimiters in the output

processText

protected java.util.List processText(java.lang.String text)
Processes the text node. Not called for non-String nodes.

Specified by:
processText in class TextProcessor
Parameters:
text - the text to process
Returns:
the processed text

toString

public java.lang.String toString()
Convert this object to a String value.

Overrides:
toString in class java.lang.Object
Returns:
stringified object