org.hackystat.dailyprojectdata.resource.snapshot
Class SensorDataRefComparator

java.lang.Object
  extended by org.hackystat.dailyprojectdata.resource.snapshot.SensorDataRefComparator
All Implemented Interfaces:
java.io.Serializable, java.util.Comparator<org.hackystat.sensorbase.resource.sensordata.jaxb.SensorDataRef>

public class SensorDataRefComparator
extends java.lang.Object
implements java.util.Comparator<org.hackystat.sensorbase.resource.sensordata.jaxb.SensorDataRef>, java.io.Serializable

Comparator that allows SensorDataRefs to be sorted by their timestamp.

Author:
jsakuda
See Also:
Serialized Form

Constructor Summary
SensorDataRefComparator(boolean ascending)
          Creates a new comparator.
 
Method Summary
 int compare(org.hackystat.sensorbase.resource.sensordata.jaxb.SensorDataRef o1, org.hackystat.sensorbase.resource.sensordata.jaxb.SensorDataRef o2)
          Compares two SensorDataRefs.
 
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

SensorDataRefComparator

public SensorDataRefComparator(boolean ascending)
Creates a new comparator.

Parameters:
ascending - True if the SensorDataRefs are being sorted in ascending order, otherwise false for descending.
Method Detail

compare

public int compare(org.hackystat.sensorbase.resource.sensordata.jaxb.SensorDataRef o1,
                   org.hackystat.sensorbase.resource.sensordata.jaxb.SensorDataRef o2)
Compares two SensorDataRefs.

Specified by:
compare in interface java.util.Comparator<org.hackystat.sensorbase.resource.sensordata.jaxb.SensorDataRef>
Parameters:
o1 - The first ref.
o2 - The second ref.
Returns:
Returns -1, 0, or 1 if the first argument is less than, equal to, or greater than the second.