Top Description Fields Constructors Methods
com.ibm.icu.impl

public Class CSCharacterIterator

extends Object
implements CharacterIterator
Class Inheritance
All Implemented Interfaces
java.text.CharacterIterator, java.lang.Cloneable
Imports
java.text.CharacterIterator

Implement the Java CharacterIterator interface on a CharSequence. Intended for internal use by ICU only.

Field Summary

Modifier and TypeField and Description
private int
private CharSequence

Constructor Summary

AccessConstructor and Description
public
CSCharacterIterator(CharSequence
The CharSequence to iterate over.
text
)

Constructor.

Method Summary

Modifier and TypeMethod and Description
public Object
clone()

Overrides java.lang.Object.clone.

Implements java.text.CharacterIterator.clone.

Create a copy of this iterator
public char
current()

Implements java.text.CharacterIterator.current.

Gets the character at the current position (as returned by getIndex()).
public char
first()

Implements java.text.CharacterIterator.first.

Sets the position to getBeginIndex() and returns the character at that position.
public int
getBeginIndex()

Implements java.text.CharacterIterator.getBeginIndex.

Returns the start index of the text.
public int
getEndIndex()

Implements java.text.CharacterIterator.getEndIndex.

Returns the end index of the text.
public int
getIndex()

Implements java.text.CharacterIterator.getIndex.

Returns the current index.
public char
last()

Implements java.text.CharacterIterator.last.

Sets the position to getEndIndex()-1 (getEndIndex() if the text is empty) and returns the character at that position.
public char
next()

Implements java.text.CharacterIterator.next.

Increments the iterator's index by one and returns the character at the new index.
public char
previous()

Implements java.text.CharacterIterator.previous.

Decrements the iterator's index by one and returns the character at the new index.
public char
setIndex(int
the position within the text. Valid values range from getBeginIndex() to getEndIndex(). An IllegalArgumentException is thrown if an invalid value is supplied.
position
)

Implements java.text.CharacterIterator.setIndex.

Sets the position to the specified position in the text and returns that character.
Inherited from java.lang.Object:
equalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

indexback to summary
private int index
seqback to summary
private CharSequence seq

Constructor Detail

CSCharacterIteratorback to summary
public CSCharacterIterator(CharSequence text)

Constructor.

Parameters
text:CharSequence

The CharSequence to iterate over.

Method Detail

cloneback to summary
public Object clone()

Overrides java.lang.Object.clone.

Implements java.text.CharacterIterator.clone.

Doc from java.text.CharacterIterator.clone.

Create a copy of this iterator

Returns:Object

A copy of this

Annotations
@Override
currentback to summary
public char current()

Implements java.text.CharacterIterator.current.

Doc from java.text.CharacterIterator.current.

Gets the character at the current position (as returned by getIndex()).

Returns:char

the character at the current position or DONE if the current position is off the end of the text.

Annotations
@Override
firstback to summary
public char first()

Implements java.text.CharacterIterator.first.

Doc from java.text.CharacterIterator.first.

Sets the position to getBeginIndex() and returns the character at that position.

Returns:char

the first character in the text, or DONE if the text is empty

Annotations
@Override
getBeginIndexback to summary
public int getBeginIndex()

Implements java.text.CharacterIterator.getBeginIndex.

Doc from java.text.CharacterIterator.getBeginIndex.

Returns the start index of the text.

Returns:int

the index at which the text begins.

Annotations
@Override
getEndIndexback to summary
public int getEndIndex()

Implements java.text.CharacterIterator.getEndIndex.

Doc from java.text.CharacterIterator.getEndIndex.

Returns the end index of the text. This index is the index of the first character following the end of the text.

Returns:int

the index after the last character in the text

Annotations
@Override
getIndexback to summary
public int getIndex()

Implements java.text.CharacterIterator.getIndex.

Doc from java.text.CharacterIterator.getIndex.

Returns the current index.

Returns:int

the current index.

Annotations
@Override
lastback to summary
public char last()

Implements java.text.CharacterIterator.last.

Doc from java.text.CharacterIterator.last.

Sets the position to getEndIndex()-1 (getEndIndex() if the text is empty) and returns the character at that position.

Returns:char

the last character in the text, or DONE if the text is empty

Annotations
@Override
nextback to summary
public char next()

Implements java.text.CharacterIterator.next.

Doc from java.text.CharacterIterator.next.

Increments the iterator's index by one and returns the character at the new index. If the resulting index is greater or equal to getEndIndex(), the current index is reset to getEndIndex() and a value of DONE is returned.

Returns:char

the character at the new position or DONE if the new position is off the end of the text range.

Annotations
@Override
previousback to summary
public char previous()

Implements java.text.CharacterIterator.previous.

Doc from java.text.CharacterIterator.previous.

Decrements the iterator's index by one and returns the character at the new index. If the current index is getBeginIndex(), the index remains at getBeginIndex() and a value of DONE is returned.

Returns:char

the character at the new position or DONE if the current position is equal to getBeginIndex().

Annotations
@Override
setIndexback to summary
public char setIndex(int position)

Implements java.text.CharacterIterator.setIndex.

Doc from java.text.CharacterIterator.setIndex.

Sets the position to the specified position in the text and returns that character.

Parameters
position:int

the position within the text. Valid values range from getBeginIndex() to getEndIndex(). An IllegalArgumentException is thrown if an invalid value is supplied.

Returns:char

the character at the specified position or DONE if the specified position is equal to getEndIndex()

Annotations
@Override