org.jfree.report.util
Class WordBreakIterator

java.lang.Object
  extended byorg.jfree.report.util.WordBreakIterator

public class WordBreakIterator
extends java.lang.Object

Behaves similiar to BreakIterator.getWordInstance() but handles line break delimeters as simple whitespaces.

This class is not synchronized.

Author:
Thomas Morgner.

Field Summary
static int DONE
          A useful constant.
 
Constructor Summary
WordBreakIterator(java.lang.String text)
          Creates a new iterator.
 
Method Summary
 int getPosition()
          Returns the current parsing position of this iterator.
 java.lang.String getText()
          Returns the text to be broken up.
 int next()
          Returns the next word boundary.
 int nextWithEnd()
          Same like next(), but returns the End-Of-Text as if there was a linebreak added (Reader.readLine() compatible)
 int previous()
          Returns the position of the previous break.
 void setPosition(int position)
          Defines the current parse position for the word break iterator.
 void setText(java.lang.String text)
          Sets the text to be broken up.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DONE

public static final int DONE
A useful constant.

See Also:
Constant Field Values
Constructor Detail

WordBreakIterator

public WordBreakIterator(java.lang.String text)
Creates a new iterator.

Parameters:
text - the text to break.
Method Detail

next

public int next()
Returns the next word boundary.

Returns:
The index of the next word boundary.

nextWithEnd

public int nextWithEnd()
Same like next(), but returns the End-Of-Text as if there was a linebreak added (Reader.readLine() compatible)

Returns:
The next position.

previous

public int previous()
Returns the position of the previous break.

Returns:
The index.

getText

public java.lang.String getText()
Returns the text to be broken up.

Returns:
the text.

setText

public void setText(java.lang.String text)
Sets the text to be broken up.

Parameters:
text - the text.

getPosition

public int getPosition()
Returns the current parsing position of this iterator.

Returns:
returns the current parsing position of this iterator.

setPosition

public void setPosition(int position)
Defines the current parse position for the word break iterator. The position must be positive and within the range of the current text.

Parameters:
position - the position.