public class DoubleCQComparator extends java.lang.Object implements CQComparator
CQComparator
,
CalendarQueue
Constructor and Description |
---|
DoubleCQComparator() |
Modifier and Type | Method and Description |
---|---|
int |
compare(java.lang.Object object1,
java.lang.Object object2)
Compare the two argument.
|
long |
getVirtualBinNumber(java.lang.Object entry)
Given an entry, a zero reference, and a bin width, return a
virtual bin number for the entry.
|
void |
setBinWidth(java.lang.Object[] entryArray)
Given an array of Double objects, find the appropriate bin
width.
|
void |
setZeroReference(java.lang.Object zeroReference)
Set the zero reference, to be used in calculating the virtual
bin number.
|
public DoubleCQComparator()
public int compare(java.lang.Object object1, java.lang.Object object2)
compare
in interface java.util.Comparator
object1
- The first Double.object2
- The second Double.java.lang.ClassCastException
- If either argument is not an instance
of Double.public long getVirtualBinNumber(java.lang.Object entry)
(entry - zeroReference) / binWidth,
with the result cast to long. If the arguments are not instances of Double, then a ClassCastException will be thrown.getVirtualBinNumber
in interface CQComparator
entry
- The entry.java.lang.ClassCastException
- If the arguments are not instances of
Double.public void setBinWidth(java.lang.Object[] entryArray)
setBinWidth
in interface CQComparator
entryArray
- An array of Double objects.java.lang.ClassCastException
- If one of the array elements is not
an instance of Double.public void setZeroReference(java.lang.Object zeroReference)
setZeroReference
in interface CQComparator
zeroReference
- The starting point for bins.java.lang.ClassCastException
- If the argument is not an instance
of Double.