public interface CQComparator
extends java.util.Comparator
CalendarQueue
,
Comparator
Yellow (liuj) |
Green (eal) |
Modifier and Type | Method and Description |
---|---|
long |
getVirtualBinNumber(java.lang.Object entry)
Given an entry, return a virtual bin number for the entry.
|
void |
setBinWidth(java.lang.Object[] entryArray)
Given an array of entries, set an appropriate bin width for a
calendar queue to hold these entries.
|
void |
setZeroReference(java.lang.Object zeroReference)
Set the zero reference, to be used in calculating the virtual
bin number.
|
compare, comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
long getVirtualBinNumber(java.lang.Object entry)
(entry - zeroReference) / binWidth,
with the result cast to long.Because of the way this is used by CalendarQueue, it is OK to return the low order 64 bits of the result if the result does not fit in 64 bits. The result will be masked anyway to get fewer low order bits that represent the bin number. As a net result, time stamps that differ by exactly 2^64 times the time resolution will appear in the event queue to be occurring at the same time.
Classes that implement this interface will in general need to perform a downcast on the arguments (of type Object) to the appropriate user defined classes. If the arguments are not of appropriate type, the implementation should throw a ClassCastException.
entry
- An object that can be inserted in a calendar queue.void setBinWidth(java.lang.Object[] entryArray)
entryArray
- An array of entries.void setZeroReference(java.lang.Object zeroReference)
zeroReference
- The starting point for bins.