Class StaffComparator
- All Implemented Interfaces:
Serializable, Comparator<Staff>
A Comparator for Staff Profiles.
- Since:
- 1.0
- Version:
- 8.0
- Author:
- Luke
- See Also:
-
Field Summary
FieldsFields inherited from class AbstractComparator
_comparisonType, _typeNamesModifier and TypeFieldDescriptionprotected intThe criteria by which to compare objects.protected String[]Text descriptions of the different comparison types. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected intcompareImpl(Staff o1, Staff o2) Compares two Staff Profiles by the designated criteria.booleanhasAreas()Returns whether functional areas have been loaded.voidsetAreas(Collection<String> areas) Initializes the functional areas.Methods inherited from class AbstractComparator
compare, getComparisonType, getTypeNames, setComparisonType, setComparisonTypeModifier and TypeMethodDescriptionfinal intReturn the result by interrogating the implementation and applying a reverse sort if requred.intReturn the comparison type.String[]Return the list of comparison type names.voidsetComparisonType(int type) Sets the comparison type.voidsetComparisonType(String type) Sets the comparison type.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Comparator
equals, max, min, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Field Details
-
AREA
public static final int AREA- See Also:
-
LASTNAME
public static final int LASTNAME- See Also:
-
TYPES
-
-
Constructor Details
-
StaffComparator
public StaffComparator(int comparisonType) Initializes the comparator.- Parameters:
comparisonType- the comparison type code- Throws:
IllegalArgumentException- if an invalide code is specified
-
-
Method Details
-
hasAreas
public boolean hasAreas()Returns whether functional areas have been loaded.- Returns:
- TRUE if areas are present, otherwise FALSE
-
setAreas
Initializes the functional areas.- Parameters:
areas- an ordered Collection of area names- See Also:
-
compareImpl
Compares two Staff Profiles by the designated criteria.- Specified by:
compareImplin classAbstractComparator<Staff>- Parameters:
o1- The first object to compareo2- The second object to compare- Returns:
- -1, 0, 1 as defined by the compareTo(Object, Object) interface
- Throws:
ClassCastException- if either object is not a Staff- See Also:
-