live.dto
Class Thread.ComparatorByTimeEnded

java.lang.Object
  extended bylive.dto.Thread.ThreadComparator
      extended bylive.dto.Thread.ComparatorByTimeEnded
All Implemented Interfaces:
Comparator
Enclosing class:
Thread

public static class Thread.ComparatorByTimeEnded
extends Thread.ThreadComparator

This comparator orders threads by the ending value. Because not all threads have an ending value (because they haven't ended and we can't yet see into the future), will sort all threads that are still ongoing as less than all threads that have ended. It breaks ties with the time started. (In other words, sorting with this puts all ongoing threads before all complete threads, with the ongoing threads sorted by time started and complete threads by time ended.)


Field Summary
 
Fields inherited from class live.dto.Thread.ThreadComparator
 
Constructor Summary
Thread.ComparatorByTimeEnded()
           
 
Method Summary
 int compare(Thread t1, Thread t2)
          Compares two threads by subtracting the time ended for each
 
Methods inherited from class live.dto.Thread.ThreadComparator
compare, setReverse
 
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

Thread.ComparatorByTimeEnded

public Thread.ComparatorByTimeEnded()
Method Detail

compare

public int compare(Thread t1,
                   Thread t2)
Compares two threads by subtracting the time ended for each

Specified by:
compare in class Thread.ThreadComparator
Parameters:
t1 - First thread
t2 - Second thread
Returns:
int Difference in starting times between the two threads, returns -1 if thread1 isn't ended and 1 if thread2 isn' ended
See Also:
Comparator.compare(java.lang.Object, java.lang.Object)


Copyright © 2005