Class PersonComparator<T extends Person>
java.lang.Object
org.deltava.comparators.AbstractComparator<T>
org.deltava.comparators.PersonComparator<T>
- Type Parameters:
T
- the Person subclass
- All Implemented Interfaces:
Serializable
,Comparator<T>
- Direct Known Subclasses:
PilotComparator
A comparator for sorting Pilot and Applicant objects.
- Since:
- 1.0
- Version:
- 8.0
- Author:
- Luke
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final String[]
Fields inherited from class org.deltava.comparators.AbstractComparator
_comparisonType, _typeNames
-
Constructor Summary
ConstructorsModifierConstructorDescriptionPersonComparator
(int comparisonType) Initializes the comparator.PersonComparator
(String comparisonType) Initializes the comparator.protected
PersonComparator
(String[] typeNames) Initializes the comparator. -
Method Summary
Modifier and TypeMethodDescriptionprotected int
compareImpl
(T p1, T p2) This method does the actual comparison.Methods inherited from class org.deltava.comparators.AbstractComparator
compare, getComparisonType, getTypeNames, setComparisonType, setComparisonType
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Field Details
-
FIRSTNAME
public static final int FIRSTNAME- See Also:
-
LASTNAME
public static final int LASTNAME- See Also:
-
LASTLOGIN
public static final int LASTLOGIN- See Also:
-
CREATED
public static final int CREATED- See Also:
-
TYPES
-
-
Constructor Details
-
PersonComparator
public PersonComparator(int comparisonType) Initializes the comparator.- Parameters:
comparisonType
- the comparison type code- Throws:
IllegalArgumentException
- if an invalide code is specified- See Also:
-
PersonComparator
Initializes the comparator.- Parameters:
comparisonType
- the comparison type label- Throws:
IllegalArgumentException
- if an invalid label is specified- See Also:
-
PersonComparator
Initializes the comparator.- Parameters:
typeNames
- an array of type names
-
-
Method Details
-
compareImpl
Description copied from class:AbstractComparator
This method does the actual comparison. It is called and then we modify the result if we are performing a reverse sort.- Specified by:
compareImpl
in classAbstractComparator<T extends Person>
- Parameters:
p1
- The first object to comparep2
- The second object to compare- Returns:
- -1, 0, 1 as defined by the compareTo(Object, Object) interface
- See Also:
-