edu.nps.moves.examples
Class TimestampComparator
java.lang.Object
edu.nps.moves.examples.TimestampComparator
public class TimestampComparator
- extends java.lang.Object
Uses the comparator interface to allow sorting PDUs in a collection by timestamp.
An example of use:
Colletions.sort(pduList, new TimestampComparator());
- Author:
- DMcG
Method Summary |
int |
compare(java.lang.Object object1,
java.lang.Object object2)
Returns a number less than, equal to, or greater than zero,
depending on whether the object's timestamp less than, equal to,
or greater than the other object. |
boolean |
equals(java.lang.Object obj)
Returns true if this comparator is the same class as the comparator passed in. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TimestampComparator
public TimestampComparator()
compare
public int compare(java.lang.Object object1,
java.lang.Object object2)
- Returns a number less than, equal to, or greater than zero,
depending on whether the object's timestamp less than, equal to,
or greater than the other object. The objects passed in must
inherit from PDU.
equals
public boolean equals(java.lang.Object obj)
- Returns true if this comparator is the same class as the comparator passed in.
- Overrides:
equals
in class java.lang.Object
- Parameters:
obj
-