Class UScriptRun

java.lang.Object
com.ibm.icu.lang.UScriptRun

@Deprecated public final class UScriptRun extends Object
Deprecated.
This API is ICU internal only.
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 preceding 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 + ".");
     }
  }
 
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    private static final class 
    Deprecated.
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private char[]
    Deprecated.
     
    private int
    Deprecated.
     
    private static int
    Deprecated.
     
    private static int
    Deprecated.
     
    private static int[]
    Deprecated.
     
    private static int
    Deprecated.
     
    private int
    Deprecated.
     
    Deprecated.
     
    private int
    Deprecated.
     
    private int
    Deprecated.
     
    private int
    Deprecated.
     
    private int
    Deprecated.
     
    private char[]
    Deprecated.
     
    private int
    Deprecated.
     
    private int
    Deprecated.
     
    private int
    Deprecated.
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    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.
    Deprecated.
    This API is ICU internal only.
    UScriptRun(String text, int start, int count)
    Deprecated.
    This API is ICU internal only.
  • Method Summary

    Modifier and Type
    Method
    Description
    private static final int
    dec(int sp)
    Deprecated.
     
    private static final int
    dec(int sp, int count)
    Deprecated.
     
    private final void
    fixup(int scrptCode)
    Deprecated.
     
    private static int
    getPairIndex(int ch)
    Deprecated.
    Search the pairedChars array for the given character.
    final int
    Deprecated.
    This API is ICU internal only.
    final int
    Deprecated.
    This API is ICU internal only.
    final int
    Deprecated.
    This API is ICU internal only.
    private static final byte
    highBit(int n)
    Deprecated.
    Find the highest bit that's set in a word.
    private static final int
    inc(int sp)
    Deprecated.
     
    private static final int
    inc(int sp, int count)
    Deprecated.
     
    private static final int
    limitInc(int count)
    Deprecated.
     
    private static final int
    mod(int sp)
    Deprecated.
     
    final boolean
    Deprecated.
    This API is ICU internal only.
    private final void
    pop()
    Deprecated.
     
    private final void
    push(int pairIndex, int scrptCode)
    Deprecated.
     
    final void
    Deprecated.
    This API is ICU internal only.
    final void
    reset(char[] chars)
    Deprecated.
    This API is ICU internal only.
    final void
    reset(char[] chars, int start, int count)
    Deprecated.
    This API is ICU internal only.
    final void
    reset(int start, int count)
    Deprecated.
    This API is ICU internal only.
    final void
    Deprecated.
    This API is ICU internal only.
    final void
    reset(String str, int start, int count)
    Deprecated.
    This API is ICU internal only.
    private static boolean
    sameScript(int scriptOne, int scriptTwo)
    Deprecated.
    Compare two script codes to see if they are in the same script.
    private final boolean
    Deprecated.
     
    private final boolean
    Deprecated.
     
    private final void
    Deprecated.
     
    top()
    Deprecated.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • emptyCharArray

      private char[] emptyCharArray
      Deprecated.
    • text

      private char[] text
      Deprecated.
    • textIndex

      private int textIndex
      Deprecated.
    • textStart

      private int textStart
      Deprecated.
    • textLimit

      private int textLimit
      Deprecated.
    • scriptStart

      private int scriptStart
      Deprecated.
    • scriptLimit

      private int scriptLimit
      Deprecated.
    • scriptCode

      private int scriptCode
      Deprecated.
    • PAREN_STACK_DEPTH

      private static int PAREN_STACK_DEPTH
      Deprecated.
    • parenStack

      private static UScriptRun.ParenStackEntry[] parenStack
      Deprecated.
    • parenSP

      private int parenSP
      Deprecated.
    • pushCount

      private int pushCount
      Deprecated.
    • fixupCount

      private int fixupCount
      Deprecated.
    • pairedChars

      private static int[] pairedChars
      Deprecated.
    • pairedCharPower

      private static int pairedCharPower
      Deprecated.
    • pairedCharExtra

      private static int pairedCharExtra
      Deprecated.
  • Constructor Details

    • UScriptRun

      @Deprecated public UScriptRun()
      Deprecated.
      This API is ICU internal only.
      Construct an empty UScriptRun object. The next() method will return false the first time it is called.
    • UScriptRun

      @Deprecated public UScriptRun(String text)
      Deprecated.
      This API is ICU internal only.
      Construct a UScriptRun object which iterates over the characters in the given string.
      Parameters:
      text - the string of characters over which to iterate.
    • UScriptRun

      @Deprecated public UScriptRun(String text, int start, int count)
      Deprecated.
      This API is ICU internal only.
      Construct a UScriptRun object which iterates over a subrange of the characters in the given string.
      Parameters:
      text - the string 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
    • UScriptRun

      @Deprecated public UScriptRun(char[] chars)
      Deprecated.
      This API is ICU internal only.
      Construct a UScriptRun object which iterates over the given characters.
      Parameters:
      chars - the array of characters over which to iterate.
    • UScriptRun

      @Deprecated public UScriptRun(char[] chars, int start, int count)
      Deprecated.
      This API is ICU internal only.
      Construct a UScriptRun object which iterates over a subrange of the given characters.
      Parameters:
      chars - the 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
  • Method Details

    • reset

      @Deprecated public final void reset()
      Deprecated.
      This API is ICU internal only.
      Reset the iterator to the start of the text.
    • reset

      @Deprecated public final void reset(int start, int count) throws IllegalArgumentException
      Deprecated.
      This API is ICU internal only.
      Reset the iterator to iterate over the given range of the text. Throws IllegalArgumentException if the range is outside of the bounds of the character array.
      Parameters:
      start - the index of the new first character over which to iterate
      count - the new number of characters over which to iterate.
      Throws:
      IllegalArgumentException - If invalid arguments are passed.
    • reset

      @Deprecated public final void reset(char[] chars, int start, int count)
      Deprecated.
      This API is ICU internal only.
      Reset the iterator to iterate over count characters in chars starting at start. This allows clients to reuse an iterator.
      Parameters:
      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.
    • reset

      @Deprecated public final void reset(char[] chars)
      Deprecated.
      This API is ICU internal only.
      Reset the iterator to iterate over the characters in chars. This allows clients to reuse an iterator.
      Parameters:
      chars - the new array of characters over which to iterate.
    • reset

      @Deprecated public final void reset(String str, int start, int count)
      Deprecated.
      This API is ICU internal only.
      Reset the iterator to iterate over count characters in text starting at start. This allows clients to reuse an iterator.
      Parameters:
      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.
    • reset

      @Deprecated public final void reset(String str)
      Deprecated.
      This API is ICU internal only.
      Reset the iterator to iterate over the characters in text. This allows clients to reuse an iterator.
      Parameters:
      str - the new string of characters over which to iterate.
    • getScriptStart

      @Deprecated public final int getScriptStart()
      Deprecated.
      This API is ICU internal only.
      Get the starting index of the current script run.
      Returns:
      the index of the first character in the current script run.
    • getScriptLimit

      @Deprecated public final int getScriptLimit()
      Deprecated.
      This API is ICU internal only.
      Get the index of the first character after the current script run.
      Returns:
      the index of the first character after the current script run.
    • getScriptCode

      @Deprecated public final int getScriptCode()
      Deprecated.
      This API is ICU internal only.
      Get the script code for the script of the current script run.
      Returns:
      the script code for the script of the current script run.
      See Also:
    • next

      @Deprecated public final boolean next()
      Deprecated.
      This API is ICU internal only.
      Find the next script run. Returns false if there isn't another run, returns true if there is.
      Returns:
      false if there isn't another run, true if there is.
    • sameScript

      private static boolean sameScript(int scriptOne, int scriptTwo)
      Deprecated.
      Compare two script codes to see if they are in the same script. If one script is a strong script, and the other is INHERITED or COMMON, it will compare equal.
      Parameters:
      scriptOne - one of the script codes.
      scriptTwo - the other script code.
      Returns:
      true if the two scripts are the same.
      See Also:
    • mod

      private static final int mod(int sp)
      Deprecated.
    • inc

      private static final int inc(int sp, int count)
      Deprecated.
    • inc

      private static final int inc(int sp)
      Deprecated.
    • dec

      private static final int dec(int sp, int count)
      Deprecated.
    • dec

      private static final int dec(int sp)
      Deprecated.
    • limitInc

      private static final int limitInc(int count)
      Deprecated.
    • stackIsEmpty

      private final boolean stackIsEmpty()
      Deprecated.
    • stackIsNotEmpty

      private final boolean stackIsNotEmpty()
      Deprecated.
    • push

      private final void push(int pairIndex, int scrptCode)
      Deprecated.
    • pop

      private final void pop()
      Deprecated.
    • top

      private final UScriptRun.ParenStackEntry top()
      Deprecated.
    • syncFixup

      private final void syncFixup()
      Deprecated.
    • fixup

      private final void fixup(int scrptCode)
      Deprecated.
    • highBit

      private static final byte highBit(int n)
      Deprecated.
      Find the highest bit that's set in a word. Uses a binary search through the bits.
      Parameters:
      n - the word in which to find the highest bit that's set.
      Returns:
      the bit number (counting from the low order bit) of the highest bit.
    • getPairIndex

      private static int getPairIndex(int ch)
      Deprecated.
      Search the pairedChars array for the given character.
      Parameters:
      ch - the character for which to search.
      Returns:
      the index of the character in the table, or -1 if it's not there.