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.component.statistics.model.aggregation
Class ICountComparator

java.lang.Object
  extended by org.torweg.pulse.component.statistics.model.aggregation.ICountComparator
All Implemented Interfaces:
java.io.Serializable, java.util.Comparator<ICount>

public final class ICountComparator
extends java.lang.Object
implements java.util.Comparator<ICount>, java.io.Serializable

A Comparator<ICount>.

Version:
$Revision: 1933 $
Author:
Daniel Dietz
See Also:
Serialized Form

Nested Class Summary
static class ICountComparator.Mode
          The values for the mode of the ICountComparator which apply during internal compare.
static class ICountComparator.Order
          The values for the order of the ICountComparator.
 
Constructor Summary
ICountComparator()
          Creates a new ICountComparator with: default order: ICountComparator.Order.ASC default mode: ICountComparator.Mode.SOFT .
ICountComparator(ICountComparator.Mode mode)
          Creates a new ICountComparator with the given mode and the default order: ICountComparator.Order.ASC.
ICountComparator(ICountComparator.Order order)
          Creates a new ICountComparator with the given order and the default mode: ICountComparator.Mode.SOFT.
ICountComparator(ICountComparator.Order order, ICountComparator.Mode mode)
          Creates a new ICountComparator with the given order and the given mode.
 
Method Summary
 int compare(ICount o1, ICount o2)
          Compares the given ICounts and returns the comparison result according to the internal order.
 
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

ICountComparator

public ICountComparator()
Creates a new ICountComparator with: .


ICountComparator

public ICountComparator(ICountComparator.Order order)
Creates a new ICountComparator with the given order and the default mode: ICountComparator.Mode.SOFT.

Parameters:
order - the ICountComparator.Order

ICountComparator

public ICountComparator(ICountComparator.Mode mode)
Creates a new ICountComparator with the given mode and the default order: ICountComparator.Order.ASC.

Parameters:
mode - the ICountComparator.Mode

ICountComparator

public ICountComparator(ICountComparator.Order order, ICountComparator.Mode mode)
Creates a new ICountComparator with the given order and the given mode.

Parameters:
order - the ICountComparator.Order
mode - the ICountComparator.Mode
Method Detail

compare

public int compare(ICount o1, ICount o2)
Compares the given ICounts and returns the comparison result according to the internal order.

NOTE: If the given ICounts are also instanceof INamed and the compare mode is ICountComparator.Mode.SOFT the names of the given INameds will be compared if their counts match.

Specified by:
compare in interface java.util.Comparator<ICount>
Parameters:
o1 - a ICount
o2 - a ICount
Returns:
-1/0/1 according to the internal orderMode
See Also:
Comparator.compare(java.lang.Object, java.lang.Object)