public class RowComparator extends Object implements Comparator<Object>, Serializable
Row
, if not live data,
or the data themselves, if live data.Constructor and Description |
---|
RowComparator()
Compares with
Label.getValue() . |
RowComparator(Column header,
boolean ascending,
boolean ignoreCase,
boolean nullAsMax)
Compares with the column.
|
RowComparator(int index)
Compares with the column of the specified index.
|
RowComparator(int index,
boolean ascending,
boolean ignoreCase)
Compares with the column of the specified index.
|
RowComparator(int index,
boolean ascending,
boolean ignoreCase,
boolean nullAsMax)
Compares with the column of the specified index.
|
Modifier and Type | Method and Description |
---|---|
int |
compare(Object o1,
Object o2) |
boolean |
equals(Object o) |
Column |
getColumn()
Returns the column that this comparator is associated with, or null
if not available.
|
int |
hashCode() |
boolean |
isAscending()
Returns whether the order is ascending.
|
boolean |
shallIgnoreCase()
Returns whether to ignore case.
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
comparing, comparing, comparingDouble, comparingInt, comparingLong, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
public RowComparator()
Label.getValue()
.
It assumes the value returned by the label indexing in AbstractComponent.getChildren()
.
Note: It assumes the ascending order and case-insensitive.
If not, use RowComparator(int, boolean, boolean)
instead.
public RowComparator(int index)
0 for the first column, 1 for the second and so on
Note: -1 for Row.getValue()
and it assumes
the value implements Comparable.
Note: It assumes the ascending order, case-insensitive and
comparing the returned values of Label.getValue()
.
If not, use RowComparator(int, boolean, boolean, boolean)
instead.
A null value is considered as the minimum value.
index
- which column to compare. If -1, Row.getValue()
is used.public RowComparator(int index, boolean ascending, boolean ignoreCase)
0 for the first column, 1 for the second and so on
Note: -1 for Row.getValue()
and it assumes
the value implements Comparable.
A null value is considered as the minimum value.
index
- which column to compare. If -1, Label.getValue()
is used.ascending
- whether to sort as ascending (or descending).ignoreCase
- whether to sort case-insensitivepublic RowComparator(int index, boolean ascending, boolean ignoreCase, boolean nullAsMax)
0 for the first column, 1 for the second and so on
Note: -1 for Row.getValue()
and it assumes
the value implements Comparable.
index
- which column to compare. If -1, Row.getValue()
is used.ascending
- whether to sort as ascending (or descending).ignoreCase
- whether to sort case-insensitivenullAsMax
- whether to consider null as the maximum value.
If false, null is considered as the minimum value.public RowComparator(Column header, boolean ascending, boolean ignoreCase, boolean nullAsMax)
ascending
- whether to sort as ascending (or descending).ignoreCase
- whether to sort case-insensitivenullAsMax
- whether to consider null as the maximum value.
If false, null is considered as the minimum value.public Column getColumn()
public boolean isAscending()
public boolean shallIgnoreCase()
public int compare(Object o1, Object o2)
compare
in interface Comparator<Object>
public boolean equals(Object o)
equals
in interface Comparator<Object>
equals
in class Object
Copyright © 2019. All rights reserved.