src/share/classes/java/text/RBCollationTables.java

Print this page




 175     }
 176 
 177     /**
 178      * Returns true if this character appears anywhere in a contracting
 179      * character sequence.  (Used by CollationElementIterator.setOffset().)
 180      */
 181     boolean usedInContractSeq(int c) {
 182         return contractFlags.get(c) == 1;
 183     }
 184 
 185     /**
 186       * Return the maximum length of any expansion sequences that end
 187       * with the specified comparison order.
 188       *
 189       * @param order a collation order returned by previous or next.
 190       * @return the maximum length of any expansion seuences ending
 191       *         with the specified order.
 192       *
 193       * @see CollationElementIterator#getMaxExpansion
 194       */
 195     int getMaxExpansion(int order)
 196     {
 197         int result = 1;
 198 
 199         if (expandTable != null) {
 200             // Right now this does a linear search through the entire
 201             // expandsion table.  If a collator had a large number of expansions,
 202             // this could cause a performance problem, but in practise that
 203             // rarely happens
 204             for (int i = 0; i < expandTable.size(); i++) {
 205                 int[] valueList = expandTable.elementAt(i);
 206                 int length = valueList.length;
 207 
 208                 if (length > result && valueList[length-1] == order) {
 209                     result = length;
 210                 }
 211             }
 212         }
 213 
 214         return result;
 215     }
 216 
 217     /**
 218      *  Get the entry of hash table of the expanding string in the collation
 219      *  table.
 220      *  @param idx the index of the expanding string value list
 221      */
 222     final int[] getExpandValueList(int order) {
 223         return expandTable.elementAt(order - EXPANDCHARINDEX);
 224     }
 225 
 226     /**
 227      *  Get the comarison order of a character from the collation table.
 228      *  @return the comparison order of a character.
 229      */
 230     int getUnicodeOrder(int ch)
 231     {
 232         return mapping.elementAt(ch);
 233     }
 234 
 235     short getMaxSecOrder() {
 236         return maxSecOrder;
 237     }
 238 
 239     short getMaxTerOrder() {
 240         return maxTerOrder;
 241     }
 242 
 243     /**
 244      * Reverse a string.
 245      */
 246     //shemran/Note: this is used for secondary order value reverse, no
 247     //              need to consider supplementary pair.
 248     static void reverse (StringBuffer result, int from, int to)
 249     {
 250         int i = from;
 251         char swap;




 175     }
 176 
 177     /**
 178      * Returns true if this character appears anywhere in a contracting
 179      * character sequence.  (Used by CollationElementIterator.setOffset().)
 180      */
 181     boolean usedInContractSeq(int c) {
 182         return contractFlags.get(c) == 1;
 183     }
 184 
 185     /**
 186       * Return the maximum length of any expansion sequences that end
 187       * with the specified comparison order.
 188       *
 189       * @param order a collation order returned by previous or next.
 190       * @return the maximum length of any expansion seuences ending
 191       *         with the specified order.
 192       *
 193       * @see CollationElementIterator#getMaxExpansion
 194       */
 195     int getMaxExpansion(int order) {

 196         int result = 1;
 197 
 198         if (expandTable != null) {
 199             // Right now this does a linear search through the entire
 200             // expansion table.  If a collator had a large number of expansions,
 201             // this could cause a performance problem, but in practise that
 202             // rarely happens
 203             for (int i = 0; i < expandTable.size(); i++) {
 204                 int[] valueList = expandTable.elementAt(i);
 205                 int length = valueList.length;
 206 
 207                 if (length > result && valueList[length-1] == order) {
 208                     result = length;
 209                 }
 210             }
 211         }
 212 
 213         return result;
 214     }
 215 
 216     /**
 217      * Get the entry of hash table of the expanding string in the collation
 218      * table.
 219      * @param idx the index of the expanding string value list
 220      */
 221     final int[] getExpandValueList(int idx) {
 222         return expandTable.elementAt(idx - EXPANDCHARINDEX);
 223     }
 224 
 225     /**
 226      * Get the comarison order of a character from the collation table.
 227      * @return the comparison order of a character.
 228      */
 229     int getUnicodeOrder(int ch) {

 230         return mapping.elementAt(ch);
 231     }
 232 
 233     short getMaxSecOrder() {
 234         return maxSecOrder;
 235     }
 236 
 237     short getMaxTerOrder() {
 238         return maxTerOrder;
 239     }
 240 
 241     /**
 242      * Reverse a string.
 243      */
 244     //shemran/Note: this is used for secondary order value reverse, no
 245     //              need to consider supplementary pair.
 246     static void reverse (StringBuffer result, int from, int to)
 247     {
 248         int i = from;
 249         char swap;