cgl.narada.service.buffering
Class NBEventComparator

java.lang.Object
  extended by cgl.narada.service.buffering.NBEventComparator
All Implemented Interfaces:
Comparator

public class NBEventComparator
extends Object
implements Comparator

Compares two NBEvent according to their timestamps.


Constructor Summary
NBEventComparator()
           
 
Method Summary
 int compare(Object pFirst, Object pSecond)
          Compares two NBEvent according to the timestamp values they carry.
 int signum(long diff)
          Maps positive numbers to 1, negative numbers to -1 and 0 to 0.
 
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

NBEventComparator

public NBEventComparator()
Method Detail

compare

public final int compare(Object pFirst,
                         Object pSecond)
Compares two NBEvent according to the timestamp values they carry.

Specified by:
compare in interface Comparator
Parameters:
pFirst - NBEvent
pSecond - NBEvent
Returns:
int - comparison result. -1, 0 or 1 is returned

signum

public final int signum(long diff)
Maps positive numbers to 1, negative numbers to -1 and 0 to 0.

Parameters:
diff - value to be mapped
Returns:
int - -1, 0, or 1


For comments and suggestions please send e-mail to The NaradaBrokering Project