public class JAMonArrayComparator extends Object implements Comparator, Serializable
Note I took this code from fdsapi.com, and would like to eventually merge these 2 projects, so this class will eventually be replaced by the one in FDS.
Constructor and Description |
---|
JAMonArrayComparator() |
JAMonArrayComparator(int sortCol,
boolean naturalOrder)
Sort/compare the passed in col number starting at 0 in natural (true) or reverse (false)
order based on the columns Compareable interface being called.
|
Modifier and Type | Method and Description |
---|---|
void |
addCompareCol(int sortCol)
Compare the passed in col in natural order
|
void |
addCompareCol(int sortCol,
boolean naturalOrder)
Compare the passed in col in natural or reverse order
|
void |
addCompareCol(int sortCol,
Comparator comparator)
Compare the passed in col based on the passed in Comparator
|
int |
compare(Object o1,
Object o2)
Method used by the comparator interface.
|
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 JAMonArrayComparator()
public JAMonArrayComparator(int sortCol, boolean naturalOrder)
sortCol
- naturalOrder
- public void addCompareCol(int sortCol)
public void addCompareCol(int sortCol, boolean naturalOrder)
public void addCompareCol(int sortCol, Comparator comparator)
public int compare(Object o1, Object o2)
o1 < o2 - returns a negative integer o1 == o2 - returns zero o1 > o2 - returns a postitive integer
Iterate through all columns that should be compared (in the proper order) and call the Comparator for each of the column elements.
compare
in interface Comparator
Copyright © 2015. All rights reserved.