Class FlightReportComparator
java.lang.Object
org.deltava.comparators.AbstractComparator<FlightReport>
org.deltava.comparators.FlightReportComparator
- All Implemented Interfaces:
Serializable, Comparator<FlightReport>
A comparator to sort Flight Reports.
- Since:
- 1.0
- Version:
- 10.0
- Author:
- Luke
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intFields 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
ConstructorsConstructorDescriptionFlightReportComparator(int comparisonType) Creates a new FlightReport comparator with a particular comparison type code.FlightReportComparator(String typeName) Creates a new FlightReport comparator with a particular comparison type name. -
Method Summary
Modifier and TypeMethodDescriptionprotected intcompareImpl(FlightReport f1, FlightReport f2) Compares two Flight Reports by the designated criterial.Methods inherited from class AbstractComparator
compare, getComparisonType, getTypeNames, setComparisonType, setComparisonTypeModifier and TypeMethodDescriptionfinal intcompare(FlightReport o1, FlightReport o2) Return 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:
-
LENGTH
public static final int LENGTH- See Also:
-
DISTANCE
public static final int DISTANCE- See Also:
-
EQUIPMENT
public static final int EQUIPMENT- See Also:
-
ORIGIN
public static final int ORIGIN- See Also:
-
DESTINATION
public static final int DESTINATION- See Also:
-
FLIGHTCODE
public static final int FLIGHTCODE- See Also:
-
SUBMISSION
public static final int SUBMISSION- See Also:
-
-
Constructor Details
-
FlightReportComparator
public FlightReportComparator(int comparisonType) Creates a new FlightReport comparator with a particular comparison type code.- Parameters:
comparisonType- The criteria by which to compare- Throws:
IllegalArgumentException- if the type is invalid- See Also:
-
FlightReportComparator
Creates a new FlightReport comparator with a particular comparison type name.- Parameters:
typeName- The criteria type name by which to compare- Throws:
IllegalArgumentException- if the type name is invalid- See Also:
-
-
Method Details
-
compareImpl
Compares two Flight Reports by the designated criterial.- Specified by:
compareImplin classAbstractComparator<FlightReport>- Parameters:
f1- The first object to comparef2- 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 FlightReport bean- See Also:
-