org.mmbase.util
Class LocaleCollator
java.lang.Object
java.text.Collator
org.mmbase.util.LocaleCollator
- All Implemented Interfaces:
- Serializable, Cloneable, Comparator<Object>
public class LocaleCollator
- extends Collator
- implements Serializable
This class wraps a Collator and associates it with a Locale. Also, it is Serializable (mostly to help RMMCI).
An instance can be obtained with getInstance(String).
- Since:
- MMBase-1.9.2
- Version:
- $Id: LocaleCollator.java 41036 2010-02-15 22:30:54Z michiel $
- Author:
- Michiel Meeuwissen
- See Also:
- Serialized Form
LocaleCollator
public LocaleCollator(Locale loc,
Collator col)
getInstance
public static Collator getInstance()
- Gets the collator associated with
LocalizedString.getDefault().
getInstance
public static Collator getInstance(String s)
- Get a (fresh) Collator defined by
<locale>:<strength>:<decomposition>
Elements of these string can be left away from the right, or left away by leaving empty.
For example:
- "da_DK" The Collator associated with danish
- ":IDENTIY The case sensitive Collator associated with the default locale
- See Also:
LocaleCollator.Strength,
LocaleCollator.Decomposition
compare
public int compare(Object o1,
Object o2)
- Specified by:
compare in interface Comparator<Object>- Overrides:
compare in class Collator
compare
public int compare(String source,
String target)
- Specified by:
compare in class Collator
equals
public boolean equals(Object that)
- Specified by:
equals in interface Comparator<Object>- Overrides:
equals in class Collator
equals
public boolean equals(String source,
String target)
- Overrides:
equals in class Collator
getCollationKey
public CollationKey getCollationKey(String source)
- Specified by:
getCollationKey in class Collator
getDecomposition
public int getDecomposition()
- Overrides:
getDecomposition in class Collator
getStrength
public int getStrength()
- Overrides:
getStrength in class Collator
hashCode
public int hashCode()
- Specified by:
hashCode in class Collator
setDecomposition
public void setDecomposition(int decompositionMode)
- Overrides:
setDecomposition in class Collator
setStrength
public void setStrength(int newStrength)
- Overrides:
setStrength in class Collator
toString
public String toString()
- Overrides:
toString in class Object
matches
public boolean matches(String s)
- Wether a string matches this Collator. It's the same string as in
getInstance(String). Unspecified values never make the result false.
main
public static void main(String[] argv)
throws Exception
- Throws:
Exception
MMBase 2.0-SNAPSHOT - null