Java Doc for Collator.java in  » Internationalization-Localization » icu4j » com » ibm » icu » text » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Internationalization Localization » icu4j » com.ibm.icu.text 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.ibm.icu.text.Collator

All known Subclasses:   com.ibm.icu.text.CollatorServiceShim,  com.ibm.icu.text.RuleBasedCollator,
Collator
abstract public class Collator implements Comparator,Cloneable(Code)

Collator performs locale-sensitive string comparison. A concrete subclass, RuleBasedCollator, allows customization of the collation ordering by the use of rule sets.

Following the Unicode Consortium's specifications for the Unicode Collation Algorithm (UCA), there are 5 different levels of strength used in comparisons:

  • PRIMARY strength: Typically, this is used to denote differences between base characters (for example, "a" < "b"). It is the strongest difference. For example, dictionaries are divided into different sections by base character.
  • SECONDARY strength: Accents in the characters are considered secondary differences (for example, "as" < "às" < "at"). Other differences between letters can also be considered secondary differences, depending on the language. A secondary difference is ignored when there is a primary difference anywhere in the strings.
  • TERTIARY strength: Upper and lower case differences in characters are distinguished at tertiary strength (for example, "ao" < "Ao" < "aò"). In addition, a variant of a letter differs from the base form on the tertiary strength (such as "A" and "Ⓐ"). Another example is the difference between large and small Kana. A tertiary difference is ignored when there is a primary or secondary difference anywhere in the strings.
  • QUATERNARY strength: When punctuation is ignored (see Ignoring Punctuations in the user guide) at PRIMARY to TERTIARY strength, an additional strength level can be used to distinguish words with and without punctuation (for example, "ab" < "a-b" < "aB"). This difference is ignored when there is a PRIMARY, SECONDARY or TERTIARY difference. The QUATERNARY strength should only be used if ignoring punctuation is required.
  • IDENTICAL strength: When all other strengths are equal, the IDENTICAL strength is used as a tiebreaker. The Unicode code point values of the NFD form of each string are compared, just in case there is no difference. For example, Hebrew cantellation marks are only distinguished at this strength. This strength should be used sparingly, as only code point value differences between two strings is an extremely rare occurrence. Using this strength substantially decreases the performance for both comparison and collation key generation APIs. This strength also increases the size of the collation key.
Unlike the JDK, ICU4J's Collator deals only with 2 decomposition modes, the canonical decomposition mode and one that does not use any decomposition. The compatibility decomposition mode, java.text.Collator.FULL_DECOMPOSITION is not supported here. If the canonical decomposition mode is set, the Collator handles un-normalized text properly, producing the same results as if the text were normalized in NFD. If canonical decomposition is turned off, it is the user's responsibility to ensure that all text is already in the appropriate form before performing a comparison or before getting a CollationKey.

For more information about the collation service see the users guide.

Examples of use

 // Get the Collator for US English and set its strength to PRIMARY
 Collator usCollator = Collator.getInstance(Locale.US);
 usCollator.setStrength(Collator.PRIMARY);
 if (usCollator.compare("abc", "ABC") == 0) {
 System.out.println("Strings are equivalent");
 }
 The following example shows how to compare two strings using the
 Collator for the default locale.
 // Compare two strings in the default locale
 Collator myCollator = Collator.getInstance();
 myCollator.setDecomposition(NO_DECOMPOSITION);
 if (myCollator.compare("à\u0325", "a\u0325̀") != 0) {
 System.out.println("à\u0325 is not equals to a\u0325̀ without decomposition");
 myCollator.setDecomposition(CANONICAL_DECOMPOSITION);
 if (myCollator.compare("à\u0325", "a\u0325̀") != 0) {
 System.out.println("Error: à\u0325 should be equals to a\u0325̀ with decomposition");
 }
 else {
 System.out.println("à\u0325 is equals to a\u0325̀ with decomposition");
 }
 }
 else {
 System.out.println("Error: à\u0325 should be not equals to a\u0325̀ without decomposition");
 }
 


See Also:   RuleBasedCollator
See Also:   CollationKey
author:
   Syn Wee Quek

Inner Class :abstract public static class CollatorFactory
Inner Class :abstract static class ServiceShim

Field Summary
final public static  intCANONICAL_DECOMPOSITION
    

Decomposition mode value.

final public static  intFULL_DECOMPOSITION
     This is for backwards compatibility with Java APIs only.
final public static  intIDENTICAL
    

Smallest Collator strength value.

final public static  intNO_DECOMPOSITION
    

Decomposition mode value.

final public static  intPRIMARY
     Strongest collator strength value.
final public static  intQUATERNARY
     Fourth level collator strength value.
final public static  intSECONDARY
     Second level collator strength value.
final public static  intTERTIARY
     Third level collator strength value. Upper and lower case differences in characters are distinguished at this strength level.

Constructor Summary
protected  Collator()
    

Method Summary
public  Objectclone()
     Clone the collator.
public  intcompare(Object source, Object target)
    

Compares the source text String to the target text String according to this Collator's rules, strength and decomposition mode. Returns an integer less than, equal to or greater than zero depending on whether the source String is less than, equal to or greater than the target String.

abstract public  intcompare(String source, String target)
    

Compares the source text String to the target text String according to this Collator's rules, strength and decomposition mode. Returns an integer less than, equal to or greater than zero depending on whether the source String is less than, equal to or greater than the target String.

public  booleanequals(String source, String target)
     Convenience method for comparing the equality of two text Strings using this Collator's rules, strength and decomposition mode.
Parameters:
  source - the source string to be compared.
Parameters:
  target - the target string to be compared.
public static  Locale[]getAvailableLocales()
     Get the set of locales, as Locale objects, for which collators are installed.
final public static  ULocale[]getAvailableULocales()
     Get the set of locales, as ULocale objects, for which collators are installed.
abstract public  CollationKeygetCollationKey(String source)
    

Transforms the String into a CollationKey suitable for efficient repeated comparison.

public  intgetDecomposition()
    

Get the decomposition mode of this Collator.

public static  StringgetDisplayName(Locale objectLocale, Locale displayLocale)
     Get the name of the collator for the objectLocale, localized for the displayLocale.
public static  StringgetDisplayName(ULocale objectLocale, ULocale displayLocale)
     Get the name of the collator for the objectLocale, localized for the displayLocale.
public static  StringgetDisplayName(Locale objectLocale)
     Get the name of the collator for the objectLocale, localized for the current locale.
public static  StringgetDisplayName(ULocale objectLocale)
     Get the name of the collator for the objectLocale, localized for the current locale.
final public static  ULocalegetFunctionalEquivalent(String keyword, ULocale locID, boolean isAvailable)
     Return the functionally equivalent locale for the given requested locale, with respect to given keyword, for the collation service.
final public static  ULocalegetFunctionalEquivalent(String keyword, ULocale locID)
     Return the functionally equivalent locale for the given requested locale, with respect to given keyword, for the collation service.
final public static  CollatorgetInstance()
     Gets the Collator for the current default locale. The default locale is determined by java.util.Locale.getDefault(). the Collator for the default locale (for example, en_US) if itis created successfully.
final public static  CollatorgetInstance(ULocale locale)
     Gets the Collator for the desired locale.
Parameters:
  locale - the desired locale.
final public static  CollatorgetInstance(Locale locale)
     Gets the Collator for the desired locale.
Parameters:
  locale - the desired locale.
final public static  String[]getKeywordValues(String keyword)
     Given a keyword, return an array of all values for that keyword that are currently in use.
final public static  String[]getKeywords()
     Return an array of all possible keywords that are relevant to collation.
final public  ULocalegetLocale(ULocale.Type type)
     Return the locale that was used to create this object, or null. This may may differ from the locale requested at the time of this object's creation.
abstract public  RawCollationKeygetRawCollationKey(String source, RawCollationKey key)
     Gets the simpler form of a CollationKey for the String source following the rules of this Collator and stores the result into the user provided argument key.
public  intgetStrength()
    

Returns this Collator's strength property.

public  UnicodeSetgetTailoredSet()
     Get an UnicodeSet that contains all the characters and sequences tailored in this collator.
abstract public  VersionInfogetUCAVersion()
     Get the UCA version of this collator object.
abstract public  intgetVariableTop()
     Gets the variable top value of a Collator.
abstract public  VersionInfogetVersion()
     Get the version of this collator object.
final public static  ObjectregisterFactory(CollatorFactory factory)
     Register a collator factory.
final public static  ObjectregisterInstance(Collator collator, ULocale locale)
     Register a collator as the default collator for the provided locale.
public  voidsetDecomposition(int decomposition)
    

Set the decomposition mode of this Collator.

final  voidsetLocale(ULocale valid, ULocale actual)
     Set information about the locales that were used to create this object.
public  voidsetStrength(int newStrength)
    

Sets this Collator's strength property.

abstract public  intsetVariableTop(String varTop)
    

Variable top is a two byte primary value which causes all the codepoints with primary values that are less or equal than the variable top to be shifted when alternate handling is set to SHIFTED.

Sets the variable top to a collation element value of a string supplied.


Parameters:
  varTop - one or more (if contraction) characters to which the variable top should be set a int value containing the value of the variable top in upper 16bits.
abstract public  voidsetVariableTop(int varTop)
     Sets the variable top to a collation element value supplied. Variable top is set to the upper 16 bits.
final public static  booleanunregister(Object registryKey)
     Unregister a collator previously registered using registerInstance.
Parameters:
  registryKey - the object previously returned by registerInstance.

Field Detail
CANONICAL_DECOMPOSITION
final public static int CANONICAL_DECOMPOSITION(Code)

Decomposition mode value. With CANONICAL_DECOMPOSITION set, characters that are canonical variants according to the Unicode standard will be decomposed for collation.

CANONICAL_DECOMPOSITION corresponds to Normalization Form D as described in Unicode Technical Report #15.


See Also:   Collator.NO_DECOMPOSITION
See Also:   Collator.getDecomposition
See Also:   Collator.setDecomposition



FULL_DECOMPOSITION
final public static int FULL_DECOMPOSITION(Code)
This is for backwards compatibility with Java APIs only. It should not be used, IDENTICAL should be used instead. ICU's collation does not support Java's FULL_DECOMPOSITION mode.



IDENTICAL
final public static int IDENTICAL(Code)

Smallest Collator strength value. When all other strengths are equal, the IDENTICAL strength is used as a tiebreaker. The Unicode code point values of the NFD form of each string are compared, just in case there is no difference. See class documentation for more explanation.

Note this value is different from JDK's




NO_DECOMPOSITION
final public static int NO_DECOMPOSITION(Code)

Decomposition mode value. With NO_DECOMPOSITION set, Strings will not be decomposed for collation. This is the default decomposition setting unless otherwise specified by the locale used to create the Collator.

Note this value is different from the JDK's.


See Also:   Collator.CANONICAL_DECOMPOSITION
See Also:   Collator.getDecomposition
See Also:   Collator.setDecomposition



PRIMARY
final public static int PRIMARY(Code)
Strongest collator strength value. Typically used to denote differences between base characters. See class documentation for more explanation.
See Also:   Collator.setStrength
See Also:   Collator.getStrength



QUATERNARY
final public static int QUATERNARY(Code)
Fourth level collator strength value. When punctuation is ignored (see Ignoring Punctuations in the user guide) at PRIMARY to TERTIARY strength, an additional strength level can be used to distinguish words with and without punctuation. See class documentation for more explanation.
See Also:   Collator.setStrength
See Also:   Collator.getStrength



SECONDARY
final public static int SECONDARY(Code)
Second level collator strength value. Accents in the characters are considered secondary differences. Other differences between letters can also be considered secondary differences, depending on the language. See class documentation for more explanation.
See Also:   Collator.setStrength
See Also:   Collator.getStrength



TERTIARY
final public static int TERTIARY(Code)
Third level collator strength value. Upper and lower case differences in characters are distinguished at this strength level. In addition, a variant of a letter differs from the base form on the tertiary level. See class documentation for more explanation.
See Also:   Collator.setStrength
See Also:   Collator.getStrength




Constructor Detail
Collator
protected Collator()(Code)
Empty default constructor to make javadocs happy




Method Detail
clone
public Object clone() throws CloneNotSupportedException(Code)
Clone the collator. a clone of this collator.



compare
public int compare(Object source, Object target)(Code)

Compares the source text String to the target text String according to this Collator's rules, strength and decomposition mode. Returns an integer less than, equal to or greater than zero depending on whether the source String is less than, equal to or greater than the target String. See the Collator class description for an example of use.


Parameters:
  source - the source String.
Parameters:
  target - the target String. Returns an integer value. Value is less than zero if source isless than target, value is zero if source and target are equal,value is greater than zero if source is greater than target.
See Also:   CollationKey
See Also:   Collator.getCollationKey
exception:
  NullPointerException - thrown if either arguments is null.IllegalArgumentException thrown if either source or target isnot of the class String.



compare
abstract public int compare(String source, String target)(Code)

Compares the source text String to the target text String according to this Collator's rules, strength and decomposition mode. Returns an integer less than, equal to or greater than zero depending on whether the source String is less than, equal to or greater than the target String. See the Collator class description for an example of use.


Parameters:
  source - the source String.
Parameters:
  target - the target String. Returns an integer value. Value is less than zero if source isless than target, value is zero if source and target are equal,value is greater than zero if source is greater than target.
See Also:   CollationKey
See Also:   Collator.getCollationKey
exception:
  NullPointerException - thrown if either arguments is null.



equals
public boolean equals(String source, String target)(Code)
Convenience method for comparing the equality of two text Strings using this Collator's rules, strength and decomposition mode.
Parameters:
  source - the source string to be compared.
Parameters:
  target - the target string to be compared. true if the strings are equal according to the collationrules, otherwise false.
See Also:   Collator.compare
exception:
  NullPointerException - thrown if either arguments is null.



getAvailableLocales
public static Locale[] getAvailableLocales()(Code)
Get the set of locales, as Locale objects, for which collators are installed. Note that Locale objects do not support RFC 3066. the list of locales in which collators are installed.This list includes any that have been registered, in addition tothose that are installed with ICU4J.



getAvailableULocales
final public static ULocale[] getAvailableULocales()(Code)
Get the set of locales, as ULocale objects, for which collators are installed. ULocale objects support RFC 3066. the list of locales in which collators are installed.This list includes any that have been registered, in addition tothose that are installed with ICU4J.



getCollationKey
abstract public CollationKey getCollationKey(String source)(Code)

Transforms the String into a CollationKey suitable for efficient repeated comparison. The resulting key depends on the collator's rules, strength and decomposition mode.

See the CollationKey class documentation for more information.


Parameters:
  source - the string to be transformed into a CollationKey. the CollationKey for the given String based on this Collator'scollation rules. If the source String is null, a nullCollationKey is returned.
See Also:   CollationKey
See Also:   Collator.compare(String,String)
See Also:   Collator.getRawCollationKey



getDecomposition
public int getDecomposition()(Code)

Get the decomposition mode of this Collator. Decomposition mode determines how Unicode composed characters are handled.

See the Collator class description for more details.

the decomposition mode
See Also:   Collator.setDecomposition
See Also:   Collator.NO_DECOMPOSITION
See Also:   Collator.CANONICAL_DECOMPOSITION



getDisplayName
public static String getDisplayName(Locale objectLocale, Locale displayLocale)(Code)
Get the name of the collator for the objectLocale, localized for the displayLocale.
Parameters:
  objectLocale - the locale of the collator
Parameters:
  displayLocale - the locale for the collator's display name the display name



getDisplayName
public static String getDisplayName(ULocale objectLocale, ULocale displayLocale)(Code)
Get the name of the collator for the objectLocale, localized for the displayLocale.
Parameters:
  objectLocale - the locale of the collator
Parameters:
  displayLocale - the locale for the collator's display name the display name



getDisplayName
public static String getDisplayName(Locale objectLocale)(Code)
Get the name of the collator for the objectLocale, localized for the current locale.
Parameters:
  objectLocale - the locale of the collator the display name



getDisplayName
public static String getDisplayName(ULocale objectLocale)(Code)
Get the name of the collator for the objectLocale, localized for the current locale.
Parameters:
  objectLocale - the locale of the collator the display name



getFunctionalEquivalent
final public static ULocale getFunctionalEquivalent(String keyword, ULocale locID, boolean isAvailable)(Code)
Return the functionally equivalent locale for the given requested locale, with respect to given keyword, for the collation service. If two locales return the same result, then collators instantiated for these locales will behave equivalently. The converse is not always true; two collators may in fact be equivalent, but return different results, due to internal details. The return result has no other meaning than that stated above, and implies nothing as to the relationship between the two locales. This is intended for use by applications who wish to cache collators, or otherwise reuse collators when possible. The functional equivalent may change over time. For more information, please see the Locales and Services section of the ICU User Guide.
Parameters:
  keyword - a particular keyword as enumerated bygetKeywords.
Parameters:
  locID - The requested locale
Parameters:
  isAvailable - If non-null, isAvailable[0] will receive andoutput boolean that indicates whether the requested locale was'available' to the collation service. The locale is defined as'available' if it physically exists within the collation localedata. If non-null, isAvailable must have length >= 1. the locale



getFunctionalEquivalent
final public static ULocale getFunctionalEquivalent(String keyword, ULocale locID)(Code)
Return the functionally equivalent locale for the given requested locale, with respect to given keyword, for the collation service.
Parameters:
  keyword - a particular keyword as enumerated bygetKeywords.
Parameters:
  locID - The requested locale the locale
See Also:   Collator.getFunctionalEquivalent(String,ULocale,boolean[])



getInstance
final public static Collator getInstance()(Code)
Gets the Collator for the current default locale. The default locale is determined by java.util.Locale.getDefault(). the Collator for the default locale (for example, en_US) if itis created successfully. Otherwise if there is no Collatorassociated with the current locale, the default UCA collatorwill be returned.
See Also:   java.util.Locale.getDefault
See Also:   Collator.getInstance(Locale)



getInstance
final public static Collator getInstance(ULocale locale)(Code)
Gets the Collator for the desired locale.
Parameters:
  locale - the desired locale. Collator for the desired locale if it is created successfully.Otherwise if there is no Collatorassociated with the current locale, a default UCA collator willbe returned.
See Also:   java.util.Locale
See Also:   java.util.ResourceBundle
See Also:   Collator.getInstance(Locale)
See Also:   Collator.getInstance()



getInstance
final public static Collator getInstance(Locale locale)(Code)
Gets the Collator for the desired locale.
Parameters:
  locale - the desired locale. Collator for the desired locale if it is created successfully.Otherwise if there is no Collatorassociated with the current locale, a default UCA collator willbe returned.
See Also:   java.util.Locale
See Also:   java.util.ResourceBundle
See Also:   Collator.getInstance(ULocale)
See Also:   Collator.getInstance()



getKeywordValues
final public static String[] getKeywordValues(String keyword)(Code)
Given a keyword, return an array of all values for that keyword that are currently in use.
Parameters:
  keyword - one of the keywords returned by getKeywords.
See Also:   Collator.getKeywords



getKeywords
final public static String[] getKeywords()(Code)
Return an array of all possible keywords that are relevant to collation. At this point, the only recognized keyword for this service is "collation". an array of valid collation keywords.
See Also:   Collator.getKeywordValues



getLocale
final public ULocale getLocale(ULocale.Type type)(Code)
Return the locale that was used to create this object, or null. This may may differ from the locale requested at the time of this object's creation. For example, if an object is created for locale en_US_CALIFORNIA, the actual data may be drawn from en (the actual locale), and en_US may be the most specific locale that exists (the valid locale).

Note: This method will be implemented in ICU 3.0; ICU 2.8 contains a partial preview implementation. The * actual locale is returned correctly, but the valid locale is not, in most cases.
Parameters:
  type - type of information requested, either com.ibm.icu.util.ULocale.VALID_LOCALE or com.ibm.icu.util.ULocale.ACTUAL_LOCALE. the information specified by type, or null ifthis object was not constructed from locale data.
See Also:   com.ibm.icu.util.ULocale
See Also:   com.ibm.icu.util.ULocale.VALID_LOCALE
See Also:   com.ibm.icu.util.ULocale.ACTUAL_LOCALE




getRawCollationKey
abstract public RawCollationKey getRawCollationKey(String source, RawCollationKey key)(Code)
Gets the simpler form of a CollationKey for the String source following the rules of this Collator and stores the result into the user provided argument key. If key has a internal byte array of length that's too small for the result, the internal byte array will be grown to the exact required size.
Parameters:
  source - the text String to be transformed into a RawCollationKey If key is null, a new instance of RawCollationKey will be created and returned, otherwise the user provided key will be returned.
See Also:   Collator.compare(String,String)
See Also:   Collator.getCollationKey
See Also:   
See Also:   RawCollationKey



getStrength
public int getStrength()(Code)

Returns this Collator's strength property. The strength property determines the minimum level of difference considered significant.

See the Collator class description for more details.

this Collator's current strength property.
See Also:   Collator.setStrength
See Also:   Collator.PRIMARY
See Also:   Collator.SECONDARY
See Also:   Collator.TERTIARY
See Also:   Collator.QUATERNARY
See Also:   Collator.IDENTICAL



getTailoredSet
public UnicodeSet getTailoredSet()(Code)
Get an UnicodeSet that contains all the characters and sequences tailored in this collator. a pointer to a UnicodeSet object containing all thecode points and sequences that may sort differently thanin the UCA.



getUCAVersion
abstract public VersionInfo getUCAVersion()(Code)
Get the UCA version of this collator object. the version object associated with this collator



getVariableTop
abstract public int getVariableTop()(Code)
Gets the variable top value of a Collator. Lower 16 bits are undefined and should be ignored. the variable top value of a Collator.
See Also:   Collator.setVariableTop



getVersion
abstract public VersionInfo getVersion()(Code)
Get the version of this collator object. the version object associated with this collator



registerFactory
final public static Object registerFactory(CollatorFactory factory)(Code)
Register a collator factory.
Parameters:
  factory - the factory to register an object that can be used to unregister the registered factory.



registerInstance
final public static Object registerInstance(Collator collator, ULocale locale)(Code)
Register a collator as the default collator for the provided locale. The collator should not be modified after it is registered.
Parameters:
  collator - the collator to register
Parameters:
  locale - the locale for which this is the default collator an object that can be used to unregister the registered collator.



setDecomposition
public void setDecomposition(int decomposition)(Code)

Set the decomposition mode of this Collator. Setting this decomposition property with CANONICAL_DECOMPOSITION allows the Collator to handle un-normalized text properly, producing the same results as if the text were normalized. If NO_DECOMPOSITION is set, it is the user's responsibility to insure that all text is already in the appropriate form before a comparison or before getting a CollationKey. Adjusting decomposition mode allows the user to select between faster and more complete collation behavior.

Since a great many of the world's languages do not require text normalization, most locales set NO_DECOMPOSITION as the default decomposition mode.

The default decompositon mode for the Collator is NO_DECOMPOSITON, unless specified otherwise by the locale used to create the Collator.

See getDecomposition for a description of decomposition mode.


Parameters:
  decomposition - the new decomposition mode
See Also:   Collator.getDecomposition
See Also:   Collator.NO_DECOMPOSITION
See Also:   Collator.CANONICAL_DECOMPOSITION
exception:
  IllegalArgumentException - If the given value is not a validdecomposition mode.



setLocale
final void setLocale(ULocale valid, ULocale actual)(Code)
Set information about the locales that were used to create this object. If the object was not constructed from locale data, both arguments should be set to null. Otherwise, neither should be null. The actual locale must be at the same level or less specific than the valid locale. This method is intended for use by factories or other entities that create objects of this class.
Parameters:
  valid - the most specific locale containing any resourcedata, or null
Parameters:
  actual - the locale containing data used to construct thisobject, or null
See Also:   com.ibm.icu.util.ULocale
See Also:   com.ibm.icu.util.ULocale.VALID_LOCALE
See Also:   com.ibm.icu.util.ULocale.ACTUAL_LOCALE



setStrength
public void setStrength(int newStrength)(Code)

Sets this Collator's strength property. The strength property determines the minimum level of difference considered significant during comparison.

The default strength for the Collator is TERTIARY, unless specified otherwise by the locale used to create the Collator.

See the Collator class description for an example of use.


Parameters:
  newStrength - the new strength value.
See Also:   Collator.getStrength
See Also:   Collator.PRIMARY
See Also:   Collator.SECONDARY
See Also:   Collator.TERTIARY
See Also:   Collator.QUATERNARY
See Also:   Collator.IDENTICAL
exception:
  IllegalArgumentException - if the new strength value is not oneof PRIMARY, SECONDARY, TERTIARY, QUATERNARY or IDENTICAL.



setVariableTop
abstract public int setVariableTop(String varTop)(Code)

Variable top is a two byte primary value which causes all the codepoints with primary values that are less or equal than the variable top to be shifted when alternate handling is set to SHIFTED.

Sets the variable top to a collation element value of a string supplied.


Parameters:
  varTop - one or more (if contraction) characters to which the variable top should be set a int value containing the value of the variable top in upper 16bits. Lower 16 bits are undefined.
exception:
  IllegalArgumentException - is thrown if varTop argument is not a valid variable top element. A variable top element is invalid when it is a contraction that does not exist in theCollation order or when the PRIMARY strength collation element for the variable top has more than two bytes
See Also:   Collator.getVariableTop
See Also:   RuleBasedCollator.setAlternateHandlingShifted



setVariableTop
abstract public void setVariableTop(int varTop)(Code)
Sets the variable top to a collation element value supplied. Variable top is set to the upper 16 bits. Lower 16 bits are ignored.
Parameters:
  varTop - Collation element value, as returned by setVariableTop or getVariableTop
See Also:   Collator.getVariableTop
See Also:   Collator.setVariableTop



unregister
final public static boolean unregister(Object registryKey)(Code)
Unregister a collator previously registered using registerInstance.
Parameters:
  registryKey - the object previously returned by registerInstance. true if the collator was successfully unregistered.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.