pulse - the web application framework Get pulse at SourceForge.net. Fast, secure and Free Open Source software downloads Ohloh project report for pulse-java

org.torweg.pulse.util
Class NamedComparator

java.lang.Object
  extended by org.torweg.pulse.util.NamedComparator
All Implemented Interfaces:
java.util.Comparator<INamed>

public class NamedComparator
extends java.lang.Object
implements java.util.Comparator<INamed>

a flexible Comparator for INamed, internally using a Collator.

Version:
$Revision: 1405 $
Author:
Thomas Weber
See Also:
Collator

Constructor Summary
NamedComparator()
          creates a NamedComparator in the default locale with secondary strength (Collator.SECONDARY) and canonical decomposition (Collator.CANONICAL_DECOMPOSITION).
NamedComparator(java.util.Locale locale)
          creates a NamedComparator in the given locale with secondary strength (Collator.SECONDARY) and canonical decomposition ( Collator.CANONICAL_DECOMPOSITION).
NamedComparator(java.util.Locale locale, int strength, int decompositionMode)
          creates a NamedComparator in the given locale, strength and decomposition mode.
 
Method Summary
 int compare(INamed o1, INamed o2)
          compares the two named objects.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

NamedComparator

public NamedComparator()
creates a NamedComparator in the default locale with secondary strength (Collator.SECONDARY) and canonical decomposition (Collator.CANONICAL_DECOMPOSITION).


NamedComparator

public NamedComparator(java.util.Locale locale)
creates a NamedComparator in the given locale with secondary strength (Collator.SECONDARY) and canonical decomposition ( Collator.CANONICAL_DECOMPOSITION).

Parameters:
locale - the locale for the Collator

NamedComparator

public NamedComparator(java.util.Locale locale,
                       int strength,
                       int decompositionMode)
creates a NamedComparator in the given locale, strength and decomposition mode.

Parameters:
locale - the locale for the Collator
strength - the strength for the Collator
decompositionMode - the decomposition mode for the Collator
Method Detail

compare

public final int compare(INamed o1, INamed o2)
compares the two named objects.

Specified by:
compare in interface java.util.Comparator<INamed>
Parameters:
o1 - the first object to be compared.
o2 - the second object to be compared.
Returns:
a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second
See Also:
Comparator.compare(java.lang.Object, java.lang.Object)