Class EliteScorer
java.lang.Object
org.deltava.beans.econ.EliteScorer
- Direct Known Subclasses:
SkyMilesScorer
An interface for classes that calculate elite level point scores to Flight Reports.
- Since:
- 9.2
- Version:
- 11.4
- Author:
- Luke
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(FlightReport fr) Adds a Flight Report to the Pilot's flight history for first equipment/airport types.protected void
Adds a conditional bonus entry to the flight score.protected static boolean
canScore
(FlightReport fr) Checks whether a flight report can be scored.static EliteScorer
Creates a PointScorer implementation.getScore()
Returns the score bundle.static final int
getStatsYear
(Instant dt) Returns what Elite program year flight statistics should be assigned to.static final int
getStatusYear
(Instant dt) Returns what Elite program year status should be looked up for.protected boolean
isNewAirport
(String iata, Instant dt) Returns if an Airport has been visited before a particular date.protected boolean
isNewCountry
(String code, Instant dt) Returns if a Country has been visited before a particular date.protected boolean
isNewEquipment
(String eqType, Instant dt) Returns if an equipment type has been used before a particular date.static final boolean
Returns whether we are in the rollover period before the start of the new status year.protected void
reset
(int id, EliteLevel lvl) Resets the flight score.abstract FlightEliteScore
score
(FlightReport fr, EliteLevel lvl) Scores a non-ACARS Flight Report.abstract FlightEliteScore
score
(ScorePackage pkg, EliteLevel lvl) Scores a Flight Report.protected void
Adds a conditional entry to the flight score.
-
Field Details
-
_score
The elite score.
-
-
Constructor Details
-
EliteScorer
public EliteScorer()
-
-
Method Details
-
getInstance
Creates a PointScorer implementation.- Returns:
- a PointScorer implementation
-
add
Adds a Flight Report to the Pilot's flight history for first equipment/airport types.- Parameters:
fr
- the FlightReport
-
score
Scores a Flight Report.- Parameters:
pkg
- the ScorePackagelvl
- the Pilot's current EliteLevel- Returns:
- the number of status points earned
-
score
Scores a non-ACARS Flight Report.- Parameters:
fr
- the FlightReportlvl
- the Pilot's current EliteLevel- Returns:
- the number of status points earned
-
getStatsYear
Returns what Elite program year flight statistics should be assigned to.- Parameters:
dt
- a date/time- Returns:
- the Elite program year
-
getStatusYear
Returns what Elite program year status should be looked up for.- Parameters:
dt
- a date/time- Returns:
- the Elite program year
-
isRollover
public static final boolean isRollover()Returns whether we are in the rollover period before the start of the new status year.- Returns:
- TRUE if the statistics year is greater than the status year, otherwise FALSE
-
getScore
-
setBase
Adds a conditional entry to the flight score.- Parameters:
pts
- the number of pointsmsg
- the entry message
-
addBonus
Adds a conditional bonus entry to the flight score.- Parameters:
pts
- the number of pointsmsg
- the entry messagecondition
- the condition
-
reset
Resets the flight score. The list of previous Airports, Countries and equipment types are unchanged.- Parameters:
id
- the Flight Report database IDlvl
- the Pilot's current EliteLevel
-
canScore
Checks whether a flight report can be scored.- Parameters:
fr
- the FlightReport- Returns:
- TRUE if the flight report is non-null and neither draft nor rejected, otherwise FALSE
-
isNewEquipment
-
isNewAirport
-
isNewCountry
-