net.rim.device.api.ui.text
Class BreakIterator

java.lang.Object
  extended by net.rim.device.api.ui.text.BreakIterator

public final class BreakIterator
extends Object

Since:
BlackBerry API 6.0.0

Field Summary
static int ALLOW_LINE_BREAK_ON_NON_BREAK_SPACE
          Allow breaks on non-break spaces.
static int CHARACTER_ITERATOR_TYPE
          Use an iterator that finds grapheme cluster boundaries.
static int DONE
          This value is returned by any of the break iterator methods when the BreakIterator object has reached the start or end of the text.
static int LINE_BREAK_CJK_AS_ALPHABETIC
          Treat CJK characters as alphabetic so that CJK sequences break on word spaces only.
static int LINE_ITERATOR_TYPE
          Use an iterator that finds possible line breaks.
static int SENTENCE_ITERATOR_TYPE
          Use an iterator that finds sentence boundaries.
static int WORD_BREAK_FULL_STOP_AS_NON_WORD
          Treat full stops as non-word characters.
static int WORD_BREAK_HYPHEN_AS_MIDLETTER
          Treat hyphens as part of a word by assigning them to the MidLetter catagory.
static int WORD_ITERATOR_TYPE
          Use an iterator that finds word boundaries.
 
Method Summary
static BreakIterator createInstance(int aType)
          Creates a BreakIterator object with default behaviour.
static BreakIterator createInstance(int aType, int aFlags)
          Creates a BreakIterator object.
 int first()
           
 int following(int aPos)
          Method searches for the first boundary following the specified offset.
 int getIteratorBreakingType()
          Method returns break iterator type for this Breakiterator object
 int last()
           
 int next()
          Method searches for the boundary following to the current boundary.
 int next(int aCount)
          Method searches for the boundary following the aCount of boundaries from the current position.
 int preceding(int aPos)
          Method searches for the last boundary preceding the specfied offset.
 int previous()
          Method searches for the boundary preceding the current boundary.
 int previous(int aCount)
          Method searches for the boundary preceding the aCount of boundaries from the current position.
 void setText(char[] aString)
          Sets text data as char array for this break iterator.
 void setText(char[] aString, int aOffset, int aLength)
          Sets text data as StringBuffer for this break iterator.
 void setText(String aString)
          Sets text data as String for this break iterator.
 void setText(String aString, int aOffset, int aLength)
          Sets text data as String for this break iterator.
 void setText(StringBuffer aString)
          Sets text data as StringBuffer for this break iterator.
 void setText(StringBuffer aString, int aOffset, int aLength)
          Sets text data as StringBuffer for this break iterator.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Field Detail

CHARACTER_ITERATOR_TYPE

public static final int CHARACTER_ITERATOR_TYPE
Use an iterator that finds grapheme cluster boundaries.

See Also:
Constant Field Values
Since:
BlackBerry API 6.0.0

WORD_ITERATOR_TYPE

public static final int WORD_ITERATOR_TYPE
Use an iterator that finds word boundaries.

See Also:
Constant Field Values
Since:
BlackBerry API 6.0.0

LINE_ITERATOR_TYPE

public static final int LINE_ITERATOR_TYPE
Use an iterator that finds possible line breaks.

See Also:
Constant Field Values
Since:
BlackBerry API 6.0.0

SENTENCE_ITERATOR_TYPE

public static final int SENTENCE_ITERATOR_TYPE
Use an iterator that finds sentence boundaries.

See Also:
Constant Field Values
Since:
BlackBerry API 6.0.0

ALLOW_LINE_BREAK_ON_NON_BREAK_SPACE

public static final int ALLOW_LINE_BREAK_ON_NON_BREAK_SPACE
Allow breaks on non-break spaces. Web pages can be displayed more clearly where no horizontal scrolling is available.

See Also:
Constant Field Values
Since:
BlackBerry API 6.0.0

LINE_BREAK_CJK_AS_ALPHABETIC

public static final int LINE_BREAK_CJK_AS_ALPHABETIC
Treat CJK characters as alphabetic so that CJK sequences break on word spaces only. This allows a series of Chinese or Japanese words to be presented to the user in an input method editor.

See Also:
Constant Field Values
Since:
BlackBerry API 6.0.0

WORD_BREAK_HYPHEN_AS_MIDLETTER

public static final int WORD_BREAK_HYPHEN_AS_MIDLETTER
Treat hyphens as part of a word by assigning them to the MidLetter catagory. The usual case is treat them as word separators.

See Also:
Constant Field Values
Since:
BlackBerry API 6.0.0

WORD_BREAK_FULL_STOP_AS_NON_WORD

public static final int WORD_BREAK_FULL_STOP_AS_NON_WORD
Treat full stops as non-word characters. The usual case is to treat them as characters that can occur inside numbers or words.

See Also:
Constant Field Values
Since:
BlackBerry API 6.0.0

DONE

public static final int DONE
This value is returned by any of the break iterator methods when the BreakIterator object has reached the start or end of the text. This value is also returned if the BreakIterator object was not initialized with any text through one of the setText() methods.

See Also:
Constant Field Values
Since:
BlackBerry API 6.0.0


Method Detail

createInstance

public static BreakIterator createInstance(int aType,
                                           int aFlags)
Creates a BreakIterator object.

Parameters:
aType - is the iterator type. It must be either CHARACTER_ITERATOR_TYPE, WORD_ITERATOR_TYPE, LINE_ITERATOR_TYPE or SENTENCE_ITERATOR_TYPE.
aFlags - the flags used to modify the behaviour of the iterator; use the value 0 for standard behaviour.
Returns:
Returns reference to newly created BreakIterator if aType is available on the native level (depending on the build, but line breaking is always available). Otherwise returns null.
Since:
BlackBerry API 6.0.0

createInstance

public static BreakIterator createInstance(int aType)
Creates a BreakIterator object with default behaviour.

Parameters:
aType - is the iterator type. It must be either CHARACTER_ITERATOR_TYPE, WORD_ITERATOR_TYPE, LINE_ITERATOR_TYPE or SENTENCE_ITERATOR_TYPE.
Returns:
Returns reference to newly created BreakIterator if aType is available on the native level (depending on the build, but line breaking is always available). Otherwise returns null.
Since:
BlackBerry API 6.0.0

setText

public void setText(String aString)
Sets text data as String for this break iterator.

Parameters:
strToBreak - Represents string data to be analyzed by Break Iterator while looking for breaks.
Since:
BlackBerry API 6.0.0

setText

public void setText(String aString,
                    int aOffset,
                    int aLength)
Sets text data as String for this break iterator.

Parameters:
strToBreak - Represents string data to be analyzed by Break Iterator while looking for breaks.
aOffset - Offset from the start
aLength - Number of character to process.
Since:
BlackBerry API 6.0.0

setText

public void setText(StringBuffer aString)
Sets text data as StringBuffer for this break iterator.

Parameters:
strToBreak - Represents StringBuffer data to be analyzed by Break Iterator while looking for breaks.
Since:
BlackBerry API 6.0.0

setText

public void setText(StringBuffer aString,
                    int aOffset,
                    int aLength)
Sets text data as StringBuffer for this break iterator.

Parameters:
strToBreak - Represents StringBuffer data to be analyzed by Break Iterator while looking for breaks.
aOffset - Offset from the start
aLength - Number of character to process.
Since:
BlackBerry API 6.0.0

setText

public void setText(char[] aString)
Sets text data as char array for this break iterator.

Parameters:
strToBreak - Represents char array data to be analyzed by Break Iterator while looking for breaks.
Since:
BlackBerry API 6.0.0

setText

public void setText(char[] aString,
                    int aOffset,
                    int aLength)
Sets text data as StringBuffer for this break iterator.

Parameters:
strToBreak - Represents StringBuffer data to be analyzed by Break Iterator while looking for breaks.
aOffset - Offset from the start
aLength - Number of character to process.
Since:
BlackBerry API 6.0.0

getIteratorBreakingType

public int getIteratorBreakingType()
Method returns break iterator type for this Breakiterator object

Returns:
The break iterator type for this Breakiterator object. It can be one of the following: CHARACTER_ITERATOR_TYPE, WORD_ITERATOR_TYPE, LINE_ITERATOR_TYPE, SENTENCE_ITERATOR_TYPE.
Since:
BlackBerry API 6.0.0

first

public int first()
Returns:
Returns the first boundary.
Since:
BlackBerry API 6.0.0

last

public int last()
Returns:
Returns the last boundary.
Since:
BlackBerry API 6.0.0

following

public int following(int aPos)
Method searches for the first boundary following the specified offset.

Parameters:
aPos - Offset to start search from.
Returns:
Returns the first boundary following the specified offset.
Since:
BlackBerry API 6.0.0

preceding

public int preceding(int aPos)
Method searches for the last boundary preceding the specfied offset.

Parameters:
aPos - Offset to start search from.
Returns:
Returns the last boundary preceding the specfied offset.
Since:
BlackBerry API 6.0.0

next

public int next()
Method searches for the boundary following to the current boundary.

Returns:
Returns the boundary following the current boundary.
Since:
BlackBerry API 6.0.0

next

public int next(int aCount)
Method searches for the boundary following the aCount of boundaries from the current position.

Parameters:
aCount - Number of break points to skip before valid break is returned.
Returns:
Returns the boundary that follows current position after aCount of break points are skipped.
Since:
BlackBerry API 6.0.0

previous

public int previous()
Method searches for the boundary preceding the current boundary.

Returns:
Returns the boundary preceding the current boundary.
Since:
BlackBerry API 6.0.0

previous

public int previous(int aCount)
Method searches for the boundary preceding the aCount of boundaries from the current position.

Parameters:
aCount - Number of break points to skip before valid break is returned.
Returns:
Returns the boundary that precedes current position after aCount of break points are skipped.
Since:
BlackBerry API 6.0.0





Copyright 1999-2010 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.