All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class jp.kyasu.graphics.TextCharacterIterator

java.lang.Object
   |
   +----jp.kyasu.graphics.TextCharacterIterator

public class TextCharacterIterator
extends Object
implements CharacterIterator
The TextCharacterIterator implements the CharacterIterater protocol for an array of characters.

Version:
10 Jun 1998
Author:
Kazuki YASUMATSU

Constructor Index

 o TextCharacterIterator(char[])
Construct an iterator over the specified array of characters, with an initial index of 0.
 o TextCharacterIterator(char[], int)
Construct an iterator over the specified array of characters, with the specified initial index.
 o TextCharacterIterator(char[], int, int, int)
Construct an iterator over the specified range of the specified array of characters, with the index set at the specified position.
 o TextCharacterIterator(Text)
Construct an iterator over the specified text object, with an initial index of 0.
 o TextCharacterIterator(Text, int)
Construct an iterator over the specified text object, with the specified initial index.
 o TextCharacterIterator(Text, int, int, int)
Construct an iterator over the specified range of the specified text object, with the index set at the specified position.

Method Index

 o clone()
Returns a clone of this object.
 o current()
Returns the character at the current position (as returned by getIndex()).
 o equals(Object)
Compares two objects for equality.
 o first()
Set the position to getBeginIndex() and return the character at that position.
 o getBeginIndex()
Return the start index of the array of characters.
 o getEndIndex()
Return the end index of the array of characters.
 o getIndex()
Return the current index.
 o getText()
Returns the text to be iterated over.
 o hashCode()
Returns a hashcode for this object.
 o last()
Set the position to getEndIndex() and return the character at that position.
 o next()
Increment the iterator's index by one and return the character at the new index.
 o previous()
Decrement the iterator's index by one and return the character at the new index.
 o setIndex(int)
Set the position to specified position in the array of characters and return that character.

Constructors

 o TextCharacterIterator
 public TextCharacterIterator(Text text)
Construct an iterator over the specified text object, with an initial index of 0.

Parameters:
text - the text object to be iterated over.
 o TextCharacterIterator
 public TextCharacterIterator(Text text,
                              int pos)
Construct an iterator over the specified text object, with the specified initial index.

Parameters:
text - the text object to be iterated over.
pos - initial iterator position.
 o TextCharacterIterator
 public TextCharacterIterator(Text text,
                              int begin,
                              int end,
                              int pos)
Construct an iterator over the specified range of the specified text object, with the index set at the specified position.

Parameters:
text - the text object to be iterated over.
begin - index of the first character.
end - index of the character following the last character.
pos - initial iterator position.
 o TextCharacterIterator
 public TextCharacterIterator(char array[])
Construct an iterator over the specified array of characters, with an initial index of 0.

Parameters:
array - the array of characters to be iterated over.
 o TextCharacterIterator
 public TextCharacterIterator(char array[],
                              int pos)
Construct an iterator over the specified array of characters, with the specified initial index.

Parameters:
array - the array of characters to be iterated over.
pos - initial iterator position.
 o TextCharacterIterator
 public TextCharacterIterator(char array[],
                              int begin,
                              int end,
                              int pos)
Construct an iterator over the specified range of the specified array of characters, with the index set at the specified position.

Parameters:
array - the array of characters to be iterated over.
begin - index of the first character.
end - index of the character following the last character.
pos - initial iterator position.

Methods

 o getText
 public final Text getText()
Returns the text to be iterated over.

Returns:
the text to be iterated over.
 o first
 public final char first()
Set the position to getBeginIndex() and return the character at that position.

Returns:
the character at the position to getBeginIndex().
 o last
 public final char last()
Set the position to getEndIndex() and return the character at that position.

Returns:
the character at the position to getEndIndex().
 o setIndex
 public final char setIndex(int p)
Set the position to specified position in the array of characters and return that character.

Parameters:
p - the position.
Returns:
the character at the position.
 o current
 public final char current()
Returns the character at the current position (as returned by getIndex()).

Returns:
the character at the current position or DONE if the current position is off the end of the array of characters.
 o next
 public final char next()
Increment the iterator's index by one and return 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:
the character at the new position or DONE if the current position is off the end of the array of characters.
 o previous
 public final char previous()
Decrement the iterator's index by one and return the character at the new index. If the resulting index is less than getBeginIndex(), the current index is reset to getBeginIndex() and a value of DONE is returned.

Returns:
the character at the new position or DONE if the current position is off the end of the array of characters.
 o getBeginIndex
 public final int getBeginIndex()
Return the start index of the array of characters.

Returns:
the index at which the array of characters begins.
 o getEndIndex
 public final int getEndIndex()
Return the end index of the array of characters. This index is the index of the first character following the end of the array of characters.

Returns:
the index at which the array of characters end.
 o getIndex
 public final int getIndex()
Return the current index.

Returns:
the current index.
 o hashCode
 public int hashCode()
Returns a hashcode for this object.

Overrides:
hashCode in class Object
 o equals
 public boolean equals(Object anObject)
Compares two objects for equality.

Overrides:
equals in class Object
 o clone
 public Object clone()
Returns a clone of this object.

Returns:
a clone of this object.
Overrides:
clone in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index