FileDocCategorySizeDatePackage
CollationAttribute.javaAPI DocAndroid 1.5 API5989Wed May 06 22:41:04 BST 2009com.ibm.icu4jni.text

CollationAttribute

public final class CollationAttribute extends Object
Interface for storing ICU collation equivalent enum values. Constants with the prefix VALUE corresponds to ICU's UColAttributeValues, the rest corresponds to UColAttribute.
author
syn wee quek
stable
ICU 2.4

Fields Summary
public static final int
VALUE_DEFAULT
Default value, accepted by most attributes
public static final int
VALUE_PRIMARY
Primary collation strength
public static final int
VALUE_SECONDARY
Secondary collation strength
public static final int
VALUE_TERTIARY
Tertiary collation strength
public static final int
VALUE_DEFAULT_STRENGTH
Default collation strength
public static final int
VALUE_QUATERNARY
Quaternary collation strength
public static final int
VALUE_IDENTICAL
Identical collation strength
public static final int
VALUE_OFF
Turn the feature off - works for FRENCH_COLLATION, CASE_LEVEL, HIRAGANA_QUATERNARY_MODE and DECOMPOSITION_MODE
public static final int
VALUE_ON
public static final int
VALUE_SHIFTED
ALTERNATE_HANDLING mode constants
public static final int
VALUE_NON_IGNORABLE
public static final int
VALUE_LOWER_FIRST
CASE_FIRST mode constants
public static final int
VALUE_UPPER_FIRST
public static final int
VALUE_ON_WITHOUT_HANGUL
NORMALIZATION_MODE mode constants
public static final int
VALUE_ATTRIBUTE_VALUE_COUNT
Number of attribute value constants
public static final int
FRENCH_COLLATION
Attribute for direction of secondary weights
public static final int
ALTERNATE_HANDLING
Attribute for handling variable elements
public static final int
CASE_FIRST
Who goes first, lower case or uppercase.
public static final int
CASE_LEVEL
Do we have an extra case level
public static final int
NORMALIZATION_MODE
Attribute for normalization
public static final int
STRENGTH
Attribute for strength
public static final int
ATTRIBUTE_COUNT
Attribute count
Constructors Summary
Methods Summary
static booleancheckAttribute(int type, int value)
Checks if attribute type and corresponding attribute value is valid

param
type attribute type
param
value attribute value
return
true if the pair is valid, false otherwise

    if (value == VALUE_DEFAULT) {
      return true;
    }
      
    switch (type)
    {
      case FRENCH_COLLATION :
                          if (value >= VALUE_OFF && value <= VALUE_ON)
                            return true;
                          break;
      case ALTERNATE_HANDLING :
                          if (value >= VALUE_SHIFTED && 
                              value <= VALUE_NON_IGNORABLE)
                            return true;
                          break;
      case CASE_FIRST :
                          if (value >= VALUE_LOWER_FIRST && 
                              value <= VALUE_UPPER_FIRST)
                            return true;
                          break;
      case CASE_LEVEL :
                          return (value == VALUE_ON || 
                                  value <= VALUE_OFF);
      case NORMALIZATION_MODE : 
                          return (value == VALUE_OFF || value == VALUE_ON ||
                                  value == VALUE_ON_WITHOUT_HANGUL);
      case STRENGTH :
                          checkStrength(value);
    }
    return false;
  
static booleancheckNormalization(int type)
Checks if argument is a valid normalization type

param
type normalization type to be checked
return
true if type is a valid normalization type, false otherwise

    if (type != VALUE_ON && type != VALUE_OFF 
        && type != VALUE_ON_WITHOUT_HANGUL) {
        return false;
    }
    return true;
  
static booleancheckStrength(int strength)
Checks if argument is a valid collation strength

param
strength potential collation strength
return
true if strength is a valid collation strength, false otherwise

  
  // package methods --------------------------------------------------
  
                            
     
  
    if (strength < VALUE_PRIMARY || 
        (strength > VALUE_QUATERNARY && strength != VALUE_IDENTICAL))
      return false;
    return true;
  
static booleancheckType(int type)
Checks if argument is a valid collation type

param
type collation type to be checked
return
true if type is a valid collation type, false otherwise

    if (type < FRENCH_COLLATION || type > STRENGTH)
      return false;
    return true;