Class Utility

  • public class Utility
    extends Object
    SmartChineseAnalyzer utility constants and methods
    • Constructor Detail

    • Method Detail

      • compareArray

        public static int compareArray(char[] larray,
                                       int lstartIndex,
                                       char[] rarray,
                                       int rstartIndex)
        compare two arrays starting at the specified offsets.
        larray - left array
        lstartIndex - start offset into larray
        rarray - right array
        rstartIndex - start offset into rarray
        0 if the arrays are equal,1 if larray > rarray, -1 if larray < rarray
      • compareArrayByPrefix

        public static int compareArrayByPrefix(char[] shortArray,
                                               int shortIndex,
                                               char[] longArray,
                                               int longIndex)
        Compare two arrays, starting at the specified offsets, but treating shortArray as a prefix to longArray. As long as shortArray is a prefix of longArray, return 0. Otherwise, behave as compareArray(char[], int, char[], int)
        shortArray - prefix array
        shortIndex - offset into shortArray
        longArray - long array (word)
        longIndex - offset into longArray
        0 if shortArray is a prefix of longArray, otherwise act as compareArray(char[], int, char[], int)
      • getCharType

        public static int getCharType(char ch)
        Return the internal CharType constant of a given character.
        ch - input character
        constant from CharType describing the character type.
        See Also: