Package org.eclipse.wst.xml.xpath2.processor.internal.utils


org.eclipse.wst.xml.xpath2.processor.internal.utils
Class CodePointIterator



public class CodePointIterator
extends 

Field Summary

public static intDONE
     Sentinel value returned from iterator when the end is reached. The value is -1 which will never be a valid codepoint.

Method Summary

public java.lang.Objectclone()
     Create a copy of this code point iterator
public intcurrent()
     Gets the code point at the current position (as returned by getIndex()).
public intfirst()
     Resets the position to 0 and returns the first code point.
public intgetIndex()
     Returns the current index (as a codepoint, not a string index).
public intlast()
     Sets the position to the last possible position (or 0 if the text is empty) and returns the code point at that position.
public intnext()
     Increments the iterator's code point index by one and returns the code point at the new index. If the resulting index is at the end of the string, the index is not incremented, and DONE is returned.
public intprevious()
     Decrements the iterator's index by one and returns the character at the new index. If the current index is 0, the index remains at 0 and a value of DONE is returned.

Field Detail

DONE

public static int DONE

Sentinel value returned from iterator when the end is reached. The value is -1 which will never be a valid codepoint.

Methods Detail

clone

public java.lang.Object clone()

Create a copy of this code point iterator

Returns

java.lang.Object - A copy of this


current

public int current()

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

Returns

int - the code point at the current position or DONE if the current position is off the end of the text.


first

public int first()

Resets the position to 0 and returns the first code point.

Returns

int - the first code point in the text, or DONE if the text is empty


getIndex

public int getIndex()

Returns the current index (as a codepoint, not a string index).

Returns

int - the current index.


last

public int last()

Sets the position to the last possible position (or 0 if the text is empty) and returns the code point at that position.

Returns

int - the last code point in the text, or DONE if the text is empty


next

public int next()

Increments the iterator's code point index by one and returns the code point at the new index. If the resulting index is at the end of the string, the index is not incremented, and DONE is returned.

Returns

int - the code point at the new position or DONE if the new position is after the text range.


previous

public int previous()

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

Returns

int - the code point at the new position (or DONE if the current position is 0)