org.mmbase.util
Class LocaleCollator

java.lang.Object
  extended by java.text.Collator
      extended by 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

Nested Class Summary
static class LocaleCollator.Decomposition
          An enum wrapping the 'decompositon' related constants of Collator.
static class LocaleCollator.Strength
          An enum wrapping the 'strength' related constants of Collator.
 
Field Summary
 
Fields inherited from class java.text.Collator
CANONICAL_DECOMPOSITION, FULL_DECOMPOSITION, IDENTICAL, NO_DECOMPOSITION, PRIMARY, SECONDARY, TERTIARY
 
Constructor Summary
LocaleCollator(Locale loc, Collator col)
           
 
Method Summary
 int compare(Object o1, Object o2)
           
 int compare(String source, String target)
           
 boolean equals(Object that)
           
 boolean equals(String source, String target)
           
 CollationKey getCollationKey(String source)
           
 int getDecomposition()
           
static Collator getInstance()
          Gets the collator associated with LocalizedString.getDefault().
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.
 int getStrength()
           
 int hashCode()
           
static void main(String[] argv)
           
 boolean matches(String s)
          Wether a string matches this Collator.
 void setDecomposition(int decompositionMode)
           
 void setStrength(int newStrength)
           
 String toString()
           
 
Methods inherited from class java.text.Collator
clone, getAvailableLocales, getInstance
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LocaleCollator

public LocaleCollator(Locale loc,
                      Collator col)
Method Detail

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:

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