public abstract class AbstractAttributeComparator extends Object implements Comparator, Comparable
The AbstractAttributeComparator has the capability to chain comparators, facilitating a generic sort based on various attributes.
| Modifier and Type | Field and Description |
|---|---|
static int |
ASCENDING
Constant denoting the sort direction.
|
static int |
DESCENDING
Constant denoting the sort direction.
|
| Constructor and Description |
|---|
AbstractAttributeComparator(String attributeName,
int column,
int priority,
int direction)
Creates a new instance of this comparator.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
chainComparators(List comparators)
Chains this comparator to first comparator in the list, and then calls
that comparators chain method.
|
int |
compareTo(AbstractAttributeComparator another)
Compares this object to another instance of AbstractAttributeComparator.
|
int |
compareTo(Object o)
Compares this object with the specified object for order.
|
String |
getAttributeName()
Returns the attribute name this comparator compares.
|
int |
getColumn()
Internal use.
|
static AbstractAttributeComparator |
getComparator(List comparators,
int column)
Get the comparator with the given column number
|
int |
getDirection()
Gets the sort direction of this comparator.
|
AbstractAttributeComparator |
getNextComparator()
Gets the next comparator in line.
|
int |
getPriority()
Gets the priority of this comparator.
|
void |
setAttributeName(String attributeName)
Sets the name of the attribute this comparator compares.
|
void |
setColumn(int column)
Internal use.
|
void |
setDirection(int direction)
Sets the sort direction of this comparator.
|
void |
setNextComparator(AbstractAttributeComparator nextComparator)
Sets the next comparator.
|
void |
setPriority(int priority)
Sets the priority of this comparator.
|
void |
toggleDirection()
Toggles the sort direction of this comparator.
|
String |
toString()
Mainly for debugging purposes.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcompare, comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLongpublic static final int ASCENDING
public static final int DESCENDING
public AbstractAttributeComparator(String attributeName, int column, int priority, int direction)
attributeName - the name of the attribute this comparator compares.column - the column number for this comparatorpriority - the priority of this comparatordirection - the sort direction of this comparator, either ASCENDING
or DESCENDING.public int compareTo(Object o)
compareTo in interface Comparableo - the Object to be compared.public int compareTo(AbstractAttributeComparator another)
another - the AbstractAttributeComparator to compare with.public static void chainComparators(List comparators)
comparators - (missing javadoc)public static AbstractAttributeComparator getComparator(List comparators, int column)
comparators - the list of comparatorscolumn - the column numberpublic AbstractAttributeComparator getNextComparator()
public void setNextComparator(AbstractAttributeComparator nextComparator)
nextComparator - the next comparator in line.public String getAttributeName()
public void setAttributeName(String attributeName)
attributeName - the attributeName to setpublic int getDirection()
public void setDirection(int direction)
direction - the direction to setpublic void toggleDirection()
public int getPriority()
public void setPriority(int priority)
priority - the priority to setpublic String toString()
public int getColumn()
public void setColumn(int column)
column - the column to setCopyright © 2006–2018 Esito AS. All rights reserved.