|
Préférences
Moteurs de recherche
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
JavaTM 2 Platform Std. Ed. v1.6.0
java.text
|
Field Summary | |
---|---|
static int |
DONE
DONE is returned by previous(), next(), next(int), preceding(int) and following(int) when either the first or last text boundary has been reached. |
Constructor Summary | |
---|---|
protected |
BreakIterator()
Constructor. |
Method Summary | |
---|---|
Object |
clone()
Create a copy of this iterator |
abstract int |
current()
Returns character index of the text boundary that was most recently returned by next(), next(int), previous(), first(), last(), following(int) or preceding(int). |
abstract int |
first()
Returns the first boundary. |
abstract int |
following(int offset)
Returns the first boundary following the specified character offset. |
static Locale[] |
getAvailableLocales()
Returns an array of all locales for which the get*Instance methods of this class can return
localized instances. |
static BreakIterator |
getCharacterInstance()
Returns a new BreakIterator instance
for character breaks
for the default locale. |
static BreakIterator |
getCharacterInstance(Locale locale)
Returns a new BreakIterator instance
for character breaks
for the given locale. |
static BreakIterator |
getLineInstance()
Returns a new BreakIterator instance
for line breaks
for the default locale. |
static BreakIterator |
getLineInstance(Locale locale)
Returns a new BreakIterator instance
for line breaks
for the given locale. |
static BreakIterator |
getSentenceInstance()
Returns a new BreakIterator instance
for sentence breaks
for the default locale. |
static BreakIterator |
getSentenceInstance(Locale locale)
Returns a new BreakIterator instance
for sentence breaks
for the given locale. |
abstract CharacterIterator |
getText()
Get the text being scanned |
static BreakIterator |
getWordInstance()
Returns a new BreakIterator instance
for word breaks
for the default locale. |
static BreakIterator |
getWordInstance(Locale locale)
Returns a new BreakIterator instance
for word breaks
for the given locale. |
boolean |
isBoundary(int offset)
Returns true if the specified character offset is a text boundary. |
abstract int |
last()
Returns the last boundary. |
abstract int |
next()
Returns the boundary following the current boundary. |
abstract int |
next(int n)
Returns the nth boundary from the current boundary. |
int |
preceding(int offset)
Returns the last boundary preceding the specified character offset. |
abstract int |
previous()
Returns the boundary preceding the current boundary. |
abstract void |
setText(CharacterIterator newText)
Set a new text for scanning. |
void |
setText(String newText)
Set a new text string to be scanned. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DONE
Constructor Detail |
---|
protected BreakIterator()
Method Detail |
---|
public Object clone()
Cloneable
public abstract int first()
public abstract int last()
public abstract int next(int n)
BreakIterator.DONE
and the current position is set to either
the first or last text boundary depending on which one is reached. Otherwise,
the iterator's current position is set to the new boundary.
For example, if the iterator's current position is the mth text boundary
and three more boundaries exist from the current boundary to the last text
boundary, the next(2) call will return m + 2. The new text position is set
to the (m + 2)th text boundary. A next(4) call would return
BreakIterator.DONE
and the last text boundary would become the
new text position.
n
- which boundary to return. A value of 0
does nothing. Negative values move to previous boundaries
and positive values move to later boundaries.
BreakIterator.DONE
if either first or last text boundary
has been reached.public abstract int next()
BreakIterator.DONE
and
the iterator's current position is unchanged. Otherwise, the iterator's
current position is set to the boundary following the current boundary.
BreakIterator.DONE
if the current boundary is the last text
boundary.
Equivalent to next(1).next(int)
public abstract int previous()
BreakIterator.DONE
and
the iterator's current position is unchanged. Otherwise, the iterator's
current position is set to the boundary preceding the current boundary.
BreakIterator.DONE
if the current boundary is the first text
boundary.public abstract int following(int offset)
BreakIterator.DONE
and the iterator's current position is unchanged.
Otherwise, the iterator's current position is set to the returned boundary.
The value returned is always greater than the offset or the value
BreakIterator.DONE
.
offset
- the character offset to begin scanning.
BreakIterator.DONE
if the last text boundary is passed in
as the offset.
IllegalArgumentException
- if the specified offset is less than
the first text boundary or greater than the last text boundary.public int preceding(int offset)
BreakIterator.DONE
and the iterator's current position is unchanged.
Otherwise, the iterator's current position is set to the returned boundary.
The value returned is always less than the offset or the value
BreakIterator.DONE
.
offset
- the characater offset to begin scanning.
BreakIterator.DONE
if the first text boundary is passed in
as the offset.
IllegalArgumentException
- if the specified offset is less than
the first text boundary or greater than the last text boundary.public boolean isBoundary(int offset)
offset
- the character offset to check.
true
if "offset" is a boundary position,
false
otherwise.public abstract int current()
BreakIterator.DONE
because either first or last text boundary
has been reached, it returns the first or last text boundary depending on
which one is reached.
next()
,
next(int)
,
previous()
,
first()
,
last()
,
following(int)
,
preceding(int)
public abstract CharacterIterator getText()
public void setText(String newText)
newText
- new text to scan.public abstract void setText(CharacterIterator newText)
newText
- new text to scan.public static BreakIterator getWordInstance()
BreakIterator
instance
for word breaks
for the default locale.
public static BreakIterator getWordInstance(Locale locale)
BreakIterator
instance
for word breaks
for the given locale.
locale
- the desired locale
NullPointerException
- if locale
is nullpublic static BreakIterator getLineInstance()
BreakIterator
instance
for line breaks
for the default locale.
public static BreakIterator getLineInstance(Locale locale)
BreakIterator
instance
for line breaks
for the given locale.
locale
- the desired locale
NullPointerException
- if locale
is nullpublic static BreakIterator getCharacterInstance()
BreakIterator
instance
for character breaks
for the default locale.
public static BreakIterator getCharacterInstance(Locale locale)
BreakIterator
instance
for character breaks
for the given locale.
locale
- the desired locale
NullPointerException
- if locale
is nullpublic static BreakIterator getSentenceInstance()
BreakIterator
instance
for sentence breaks
for the default locale.
public static BreakIterator getSentenceInstance(Locale locale)
BreakIterator
instance
for sentence breaks
for the given locale.
locale
- the desired locale
NullPointerException
- if locale
is nullpublic static Locale[] getAvailableLocales()
get*Instance
methods of this class can return
localized instances.
The returned array represents the union of locales supported by the Java
runtime and by installed
BreakIteratorProvider
implementations.
It must contain at least a Locale
instance equal to Locale.US
.
BreakIterator
instances are available.