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.time
Class IHasDurationComparator

java.lang.Object
  extended by org.torweg.pulse.util.time.IHasDurationComparator
All Implemented Interfaces:
java.io.Serializable, java.util.Comparator<IHasDuration>

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

A Comparator&lt;IHasDuration&gt; compares two given IHasDurations.

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

Nested Class Summary
static class IHasDurationComparator.Mode
          The values for the mode of the IHasDurationComparator.
static class IHasDurationComparator.Order
          The values for the duration order of the IHasDurationComparator.
 
Constructor Summary
IHasDurationComparator()
          Creates a new IHasDurationComparator with: default order: IHasDurationComparator.Order.ASC default mode: IHasDurationComparator.Mode.START .
IHasDurationComparator(IHasDurationComparator.Mode mode)
          Creates a new IHasDurationComparator with the given mode and the default order: IHasDurationComparator.Order.ASC.
IHasDurationComparator(IHasDurationComparator.Order order)
          Creates a new IHasDurationComparator with the given order and the default mode: IHasDurationComparator.Mode.START.
IHasDurationComparator(IHasDurationComparator.Order order, IHasDurationComparator.Mode mode)
          Creates a new IHasDurationComparator with and the given mode.
 
Method Summary
 int compare(IHasDuration o1, IHasDuration o2)
          Compares the given IHasDurations according to the internal compare mode 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

IHasDurationComparator

public IHasDurationComparator()
Creates a new IHasDurationComparator with: .


IHasDurationComparator

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

Parameters:
order - the IHasDurationComparator.Order

IHasDurationComparator

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

Parameters:
mode - the IHasDurationComparator.Mode

IHasDurationComparator

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

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

compare

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

Specified by:
compare in interface java.util.Comparator<IHasDuration>
Parameters:
o1 - a IHasDuration
o2 - a IHasDuration
Returns:
-1/0/1 according to the internal orderMode
Throws:
java.lang.IllegalStateException - if internal compareMode is not set (this should never happen)
See Also:
Comparator.compare(java.lang.Object, java.lang.Object)