|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.text.Segment
public class Segment
A text fragment represented by a sequence of characters stored in an array.
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. |
Fields inherited from interface java.text.CharacterIterator |
---|
DONE |
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 CharacterIterator.DONE 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 . |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public char[] array
public int count
public int offset
Constructor Detail |
---|
public Segment()
Segment
.
public Segment(char[] array, int offset, int count)
Segment
.
array
- the underlying character data.offset
- the offset of the first character in the segment.count
- the number of characters in the segment.Method Detail |
---|
public Object clone()
clone
in interface CharacterIterator
clone
in class Object
Cloneable
public char current()
CharacterIterator.DONE
.
current
in interface CharacterIterator
public char first()
CharacterIterator.DONE
.
first
in interface CharacterIterator
CharacterIterator.DONE
if the
segment contains zero characters.public int getBeginIndex()
getBeginIndex
in interface CharacterIterator
public int getEndIndex()
getEndIndex
in interface CharacterIterator
public int getIndex()
getIndex
in interface CharacterIterator
public char last()
getEndIndex()
and this method returns
CharacterIterator.DONE
.
last
in interface CharacterIterator
CharacterIterator.DONE
if the
segment contains zero characters.public char next()
getEndIndex()
and the method
returns CharacterIterator.DONE
. If the segment contains zero characters, this
method returns CharacterIterator.DONE
.
next
in interface CharacterIterator
CharacterIterator.DONE
(if the next
character position is past the end of the segment or if the
segment contains zero characters).public char previous()
getBeginIndex()
, or if the segment contains zero characters, this
method returns CharacterIterator.DONE
.
previous
in interface CharacterIterator
CharacterIterator.DONE
(if the
current character position is at the beginning of the segment or
if the segment contains zero characters).public char setIndex(int position)
CharacterIterator.DONE
if the index is equal to getEndIndex()
.
setIndex
in interface CharacterIterator
position
- the current position.
position
, or
CharacterIterator.DONE
if position
is equal to
getEndIndex()
.
IllegalArgumentException
- if position
is not in the
range getBeginIndex()
to getEndIndex()
.public String toString()
String
containing the same characters as this
Segment
.
toString
in class Object
String
containing the same characters as this
Segment
.Object.getClass()
,
Object.hashCode()
,
Class.getName()
,
Integer.toHexString(int)
public void setPartialReturn(boolean p)
p
- the new value of the flag.public boolean isPartialReturn()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |