Class TestComparator
- All Implemented Interfaces:
Serializable, Comparator<Test>
A comparator for sorting Examination and Check Ride objects.
- Since:
- 1.0
- Version:
- 8.0
- Author:
- Luke
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final String[]Fields 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
ConstructorsConstructorDescriptionTestComparator(int comparisonType) Creates a new TestComparator with a given comparison type.TestComparator(String comparisonType) Creates a new TestComparator with a given comparison type. -
Method Summary
Modifier and TypeMethodDescriptionprotected intcompareImpl(Test t1, Test t2) Compares two examinations/checkrides by the designated criteria.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
-
DATE
public static final int DATE- See Also:
-
SCORE
public static final int SCORE- See Also:
-
PERCENT
public static final int PERCENT- See Also:
-
TYPE
public static final int TYPE- See Also:
-
TYPES
-
-
Constructor Details
-
TestComparator
public TestComparator(int comparisonType) Creates a new TestComparator with a given comparison type.- Parameters:
comparisonType- The criteria by which to compare- Throws:
IllegalArgumentException- if the type is invalid- See Also:
-
TestComparator
Creates a new TestComparator with a given comparison type.- Parameters:
comparisonType- The criteria type name by which to compare- Throws:
IllegalArgumentException- if the type name is invalid- See Also:
-
-
Method Details
-
compareImpl
Compares two examinations/checkrides by the designated criteria.- Specified by:
compareImplin classAbstractComparator<Test>- Parameters:
t1- The first object to comparet2- The second object to compare- Returns:
- -1, 0, 1 as defined by the compareTo(Object, Object) interface
- See Also:
-