javax.swing.text
Class Segment
- CharacterIterator, Cloneable
A text fragment represented by a sequence of characters stored in an array.
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.
|
Segment() - Creates a new
Segment .
|
Segment(char[] array, int offset, int count) - Creates a new
Segment .
|
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 .
|
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
array
public char[] array
Storage for the characters (may contain additional characters).
count
public int count
The number of characters in the segment.
offset
public int offset
The offset of the first character in the segment.
Segment
public Segment()
Creates a new Segment
.
Segment
public Segment(char[] array,
int offset,
int count)
Creates a new Segment
.
array
- the underlying character data.offset
- the offset of the first character in the segment.count
- the number of characters in the segment.
current
public char current()
Returns the character at the current index. If the segment consists of
zero characters, or the current index has passed the end of the
characters in the segment, this method returns
CharacterIterator.DONE
.
- current in interface CharacterIterator
- The character at the current index.
getEndIndex
public 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).
- getEndIndex in interface CharacterIterator
- The end index for the segment.
isPartialReturn
public boolean isPartialReturn()
Returns the partial return flag.
next
public char next()
Sets the current index to point to the next character in the segment and
returns that character. If the next character position is past the end of
the segment, the index is set to
getEndIndex()
and the method
returns
CharacterIterator.DONE
. If the segment contains zero characters, this
method returns
CharacterIterator.DONE
.
- next in interface CharacterIterator
- The next character in the segment or
CharacterIterator.DONE
(if the next
character position is past the end of the segment or if the
segment contains zero characters).
previous
public char previous()
Sets the current index to point to the previous character in the segment
and returns that character. If the current index is equal to
getBeginIndex()
, or if the segment contains zero characters, this
method returns
CharacterIterator.DONE
.
- previous in interface CharacterIterator
- The previous character in the segment or
CharacterIterator.DONE
(if the
current character position is at the beginning of the segment or
if the segment contains zero characters).
setPartialReturn
public void setPartialReturn(boolean p)
Sets the partial return flag.
p
- the new value of the flag.
toString
public String toString()
Returns a String
containing the same characters as this
Segment
.
- toString in interface Object
- A
String
containing the same characters as this
Segment
.
Segment.java --
Copyright (C) 2002, 2004, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.