|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.icu.lang.UScriptRun
public final class UScriptRun
UScriptRun
is used to find runs of characters in
the same script, as defined in the UScript
class.
It implements a simple iterator over an array of characters.
The iterator will assign COMMON
and INHERITED
characters to the same script as the preceeding characters. If the
COMMON and INHERITED characters are first, they will be assigned to
the same script as the following characters.
The iterator will try to match paired punctuation. If it sees an
opening punctuation character, it will remember the script that
was assigned to that character, and assign the same script to the
matching closing punctuation.
No attempt is made to combine related scripts into a single run. In
particular, Hiragana, Katakana, and Han characters will appear in separate
runs.
Here is an example of how to iterate over script runs:
void printScriptRuns(char[] text) { UScriptRun scriptRun = new UScriptRun(text); while (scriptRun.next()) { int start = scriptRun.getScriptStart(); int limit = scriptRun.getScriptLimit(); int script = scriptRun.getScriptCode(); System.out.println("Script \"" + UScript.getName(script) + "\" from " + start + " to " + limit + "."); } }
Constructor Summary | |
---|---|
UScriptRun()
Deprecated. This API is ICU internal only. |
|
UScriptRun(char[] chars)
Deprecated. This API is ICU internal only. |
|
UScriptRun(char[] chars,
int start,
int count)
Deprecated. This API is ICU internal only. |
|
UScriptRun(String text)
Deprecated. This API is ICU internal only. |
|
UScriptRun(String text,
int start,
int count)
Deprecated. This API is ICU internal only. |
Method Summary | |
---|---|
int |
getScriptCode()
Deprecated. This API is ICU internal only. |
int |
getScriptLimit()
Deprecated. This API is ICU internal only. |
int |
getScriptStart()
Deprecated. This API is ICU internal only. |
boolean |
next()
Deprecated. This API is ICU internal only. |
void |
reset()
Deprecated. This API is ICU internal only. |
void |
reset(char[] chars)
Deprecated. This API is ICU internal only. |
void |
reset(char[] chars,
int start,
int count)
Deprecated. This API is ICU internal only. |
void |
reset(int start,
int count)
Deprecated. This API is ICU internal only. |
void |
reset(String str)
Deprecated. This API is ICU internal only. |
void |
reset(String str,
int start,
int count)
Deprecated. This API is ICU internal only. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public UScriptRun()
UScriptRun
object. The next()
method will return false
the first time it is called.
public UScriptRun(String text)
UScriptRun
object which iterates over the
characters in the given string.
text
- the string of characters over which to iterate.public UScriptRun(String text, int start, int count)
UScriptRun
object which iterates over a subrange
of the characetrs in the given string.
text
- the string of characters over which to iterate.start
- the index of the first character over which to iteratecount
- the number of characters over which to iteratepublic UScriptRun(char[] chars)
UScriptRun
object which iterates over the given
characetrs.
chars
- the array of characters over which to iterate.public UScriptRun(char[] chars, int start, int count)
UScriptRun
object which iterates over a subrange
of the given characetrs.
chars
- the array of characters over which to iterate.start
- the index of the first character over which to iteratecount
- the number of characters over which to iterateMethod Detail |
---|
public final void reset()
public final void reset(int start, int count) throws IllegalArgumentException
start
- the index of the new first character over which to iteratecount
- the new number of characters over which to iterate.
IllegalArgumentException
public final void reset(char[] chars, int start, int count)
count
characters
in chars
starting at start
. This allows
clients to reuse an iterator.
chars
- the new array of characters over which to iterate.start
- the index of the first character over which to iterate.count
- the number of characters over which to iterate.public final void reset(char[] chars)
chars
. This allows clients to reuse an iterator.
chars
- the new array of characters over which to iterate.public final void reset(String str, int start, int count)
count
characters
in text
starting at start
. This allows
clients to reuse an iterator.
str
- the new string of characters over which to iterate.start
- the index of the first character over which to iterate.count
- the nuber of characters over which to iterate.public final void reset(String str)
text
. This allows clients to reuse an iterator.
str
- the new string of characters over which to iterate.public final int getScriptStart()
public final int getScriptLimit()
public final int getScriptCode()
UScript
public final boolean next()
false
if there
isn't another run, returns true
if there is.
false
if there isn't another run, true
if there is.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |