public class NExtremeBufferHolder extends Object implements BufferHolder, Comparator
Constructor and Description |
---|
NExtremeBufferHolder(boolean naturalOrder) |
NExtremeBufferHolder(Comparator comparator) |
Modifier and Type | Method and Description |
---|---|
void |
add(Object replaceWithObj)
Add the passed object to the array if BufferList is not full or shouldReplaceWith returns true
|
int |
compare(Object newObj,
Object existingObj)
Method used by the comparator interface.
|
BufferHolder |
copy()
return a usable copy of the BufferHolder
|
List |
getCollection()
Get the underlying collection
|
Comparator |
getComparator() |
List |
getOrderedCollection()
Get the Collection in sorted order
|
void |
remove(Object replaceWithObj)
Remove the smallest element from the BufferList if the buffer is full and shouldReplaceWith(...)
returns true.
|
void |
setCollection(List list) |
void |
setComparator(Comparator comparator) |
boolean |
shouldReplaceWith(Object replaceWithObj)
Returns true if this object is greater than the smallest value in the buffer
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
public NExtremeBufferHolder(Comparator comparator)
public NExtremeBufferHolder(boolean naturalOrder)
public List getCollection()
BufferHolder
getCollection
in interface BufferHolder
public void setComparator(Comparator comparator)
public Comparator getComparator()
public int compare(Object newObj, Object existingObj)
o1 < o2 - returns a negative integer o1 == o2 - returns zero o1 > o2 - returns a postitive integerIterate through all columns that should be compared (in the proper order) and call the Comparator for each of the column elements. Note the column value is always the first argument and the comparison value is always the second Returns
this object is less than - returns a negative integer, this object equal to - retutns zero this object greater than - return positive integer
compare
in interface Comparator
public void add(Object replaceWithObj)
BufferHolder
add
in interface BufferHolder
public void remove(Object replaceWithObj)
BufferHolder
remove
in interface BufferHolder
public boolean shouldReplaceWith(Object replaceWithObj)
BufferHolder
shouldReplaceWith
in interface BufferHolder
public List getOrderedCollection()
BufferHolder
getOrderedCollection
in interface BufferHolder
public void setCollection(List list)
setCollection
in interface BufferHolder
public BufferHolder copy()
BufferHolder
copy
in interface BufferHolder
Copyright © 2015. All rights reserved.