javax.swing.text
public class Segment extends Object implements Cloneable, CharacterIterator
Field Summary | |
---|---|
char[] | array Storage for the characters (may contain additional characters). |
int | count The number of characters in the segment. |
int | offset The offset of the first character in the segment. |
Constructor Summary | |
---|---|
Segment()
Creates a new Segment . | |
Segment(char[] array, int offset, int count)
Creates a new Segment .
|
Method Summary | |
---|---|
Object | clone()
Clones the segment (note that the underlying character array is not cloned,
just the reference to it).
|
char | current()
Returns the character at the current index. |
char | first()
Sets the current index to the first character in the segment and returns
that character. |
int | getBeginIndex()
Returns the index of the first character in the segment.
|
int | getEndIndex()
Returns the end index for the segment (one position beyond the last
character in the segment - note that this can be outside the range of the
underlying character array).
|
int | getIndex()
Returns the index of the current character in the segment.
|
boolean | isPartialReturn()
Returns the partial return flag.
|
char | last()
Sets the current index to point to the last character in the segment and
returns that character. |
char | next()
Sets the current index to point to the next character in the segment and
returns that character. |
char | previous()
Sets the current index to point to the previous character in the segment
and returns that character. |
char | setIndex(int position)
Sets the current index and returns the character at that position (or
Segment if the index is equal to getEndIndex.
|
void | setPartialReturn(boolean p)
Sets the partial return flag.
|
String | toString()
Returns a String containing the same characters as this
Segment .
|
Segment
.Segment
.
Parameters: array the underlying character data. offset the offset of the first character in the segment. count the number of characters in the segment.
Returns: A clone of the segment.
Returns: The character at the current index.
Returns: The first character in the segment, or Segment if the segment contains zero characters.
Returns: The index of the first character.
Returns: The end index for the segment.
Returns: The index of the current character.
Returns: The partial return flag.
Since: 1.4
Returns: The last character in the segment, or Segment if the segment contains zero characters.
Returns: The next character in the segment or Segment (if the next character position is past the end of the segment or if the segment contains zero characters).
Returns: The previous character in the segment or Segment (if the current character position is at the beginning of the segment or if the segment contains zero characters).
Parameters: position the current position.
Returns: The character at the specified position
, or
Segment if position
is equal to
getEndIndex.
Throws: IllegalArgumentException if position
is not in the
range getBeginIndex to getEndIndex.
Parameters: p the new value of the flag.
Since: 1.4
String
containing the same characters as this
Segment
.
Returns: A String
containing the same characters as this
Segment
.