APIdia Launch Partner
Top Description Fields Constructors Methods
javax.swing.text

pack-priv Class WhitespaceBasedBreakIterator

extends BreakIterator
Class Inheritance
Imports
java.text.BreakIterator, .CharacterIterator, .StringCharacterIterator, java.util.Arrays

A simple whitespace-based BreakIterator implementation.
Author
Sergey Groznyh

Field Summary

Modifier and TypeField and Description
private int[]
private int
private char[]
Inherited from java.text.BreakIterator:
DONE

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
private int
adjacent(int n, int bias)

private int
checkhit(int hit)

public int
current()

Implements abstract java.text.BreakIterator.current.

Returns character index of the text boundary that was most recently returned by next(), next(int), previous(), first(), last(), following(int) or preceding(int).

public int
first()

Implements abstract java.text.BreakIterator.first.

Returns the first boundary.

public int
following(int n)

Implements abstract java.text.BreakIterator.following.

Returns the first boundary following the specified character offset.

public CharacterIterator
getText()

Implements abstract java.text.BreakIterator.getText.

Get the text being scanned

public int
last()

Implements abstract java.text.BreakIterator.last.

Returns the last boundary.

public int
next()

Implements abstract java.text.BreakIterator.next.

Returns the boundary following the current boundary.

public int
next(int n)

Implements abstract java.text.BreakIterator.next.

Returns the nth boundary from the current boundary.

public int
preceding(int n)

Overrides java.text.BreakIterator.preceding.

Returns the last boundary preceding the specified character offset.

public int
previous()

Implements abstract java.text.BreakIterator.previous.

Returns the boundary preceding the current boundary.

public void
setText(CharacterIterator ci)

Implements abstract java.text.BreakIterator.setText.

Calculate break positions eagerly parallel to reading text.

Inherited from java.text.BreakIterator:
clonegetAvailableLocalesgetCharacterInstancegetCharacterInstancegetLineInstancegetLineInstancegetSentenceInstancegetSentenceInstancegetWordInstancegetWordInstanceisBoundarysetText

Field Detail

breaksback to summary
private int[] breaks
posback to summary
private int pos
textback to summary
private char[] text

Constructor Detail

WhitespaceBasedBreakIteratorback to summary
pack-priv WhitespaceBasedBreakIterator()

Method Detail

adjacentback to summary
private int adjacent(int n, int bias)
checkhitback to summary
private int checkhit(int hit)
currentback to summary
public int current()

Implements abstract java.text.BreakIterator.current.

Doc from java.text.BreakIterator.current.

Returns character index of the text boundary that was most recently returned by next(), next(int), previous(), first(), last(), following(int) or preceding(int). If any of these methods returns BreakIterator.DONE because either first or last text boundary has been reached, it returns the first or last text boundary depending on which one is reached.

firstback to summary
public int first()

Implements abstract java.text.BreakIterator.first.

Doc from java.text.BreakIterator.first.

Returns the first boundary. The iterator's current position is set to the first text boundary.

followingback to summary
public int following(int n)

Implements abstract java.text.BreakIterator.following.

Doc from java.text.BreakIterator.following.

Returns the first boundary following the specified character offset. If the specified offset is equal to the last text boundary, it returns BreakIterator.DONE and the iterator's current position is unchanged. Otherwise, the iterator's current position is set to the returned boundary. The value returned is always greater than the offset or the value BreakIterator.DONE.

getTextback to summary
public CharacterIterator getText()

Implements abstract java.text.BreakIterator.getText.

Doc from java.text.BreakIterator.getText.

Get the text being scanned

lastback to summary
public int last()

Implements abstract java.text.BreakIterator.last.

Doc from java.text.BreakIterator.last.

Returns the last boundary. The iterator's current position is set to the last text boundary.

nextback to summary
public int next()

Implements abstract java.text.BreakIterator.next.

Doc from java.text.BreakIterator.next.

Returns the boundary following the current boundary. If the current boundary is the last text boundary, it returns BreakIterator.DONE and the iterator's current position is unchanged. Otherwise, the iterator's current position is set to the boundary following the current boundary.

nextback to summary
public int next(int n)

Implements abstract java.text.BreakIterator.next.

Doc from java.text.BreakIterator.next.

Returns the nth boundary from the current boundary. If either the first or last text boundary has been reached, it returns BreakIterator.DONE and the current position is set to either the first or last text boundary depending on which one is reached. Otherwise, the iterator's current position is set to the new boundary. For example, if the iterator's current position is the mth text boundary and three more boundaries exist from the current boundary to the last text boundary, the next(2) call will return m + 2. The new text position is set to the (m + 2)th text boundary. A next(4) call would return BreakIterator.DONE and the last text boundary would become the new text position.

precedingback to summary
public int preceding(int n)

Overrides java.text.BreakIterator.preceding.

Doc from java.text.BreakIterator.preceding.

Returns the last boundary preceding the specified character offset. If the specified offset is equal to the first text boundary, it returns BreakIterator.DONE and the iterator's current position is unchanged. Otherwise, the iterator's current position is set to the returned boundary. The value returned is always less than the offset or the value BreakIterator.DONE.

previousback to summary
public int previous()

Implements abstract java.text.BreakIterator.previous.

Doc from java.text.BreakIterator.previous.

Returns the boundary preceding the current boundary. If the current boundary is the first text boundary, it returns BreakIterator.DONE and the iterator's current position is unchanged. Otherwise, the iterator's current position is set to the boundary preceding the current boundary.

setTextback to summary
public void setText(CharacterIterator ci)

Implements abstract java.text.BreakIterator.setText.

Calculate break positions eagerly parallel to reading text.