Class EliteScorer

java.lang.Object
org.deltava.beans.econ.EliteScorer
Direct Known Subclasses:
SkyMilesScorer

public abstract class EliteScorer extends Object
An interface for classes that calculate elite level point scores to Flight Reports.
Since:
9.2
Version:
11.4
Author:
Luke
  • Field Details

  • Constructor Details

    • EliteScorer

      public EliteScorer()
  • Method Details

    • getInstance

      public static EliteScorer getInstance()
      Creates a PointScorer implementation.
      Returns:
      a PointScorer implementation
    • add

      public void add(FlightReport fr)
      Adds a Flight Report to the Pilot's flight history for first equipment/airport types.
      Parameters:
      fr - the FlightReport
    • score

      public abstract FlightEliteScore score(ScorePackage pkg, EliteLevel lvl)
      Scores a Flight Report.
      Parameters:
      pkg - the ScorePackage
      lvl - the Pilot's current EliteLevel
      Returns:
      the number of status points earned
    • score

      public abstract FlightEliteScore score(FlightReport fr, EliteLevel lvl)
      Scores a non-ACARS Flight Report.
      Parameters:
      fr - the FlightReport
      lvl - the Pilot's current EliteLevel
      Returns:
      the number of status points earned
    • getStatsYear

      public static final int getStatsYear(Instant dt)
      Returns what Elite program year flight statistics should be assigned to.
      Parameters:
      dt - a date/time
      Returns:
      the Elite program year
    • getStatusYear

      public static final int getStatusYear(Instant dt)
      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

      public FlightEliteScore getScore()
      Returns the score bundle.
      Returns:
      a FlightEliteScore, or null
    • setBase

      protected void setBase(int pts, String msg)
      Adds a conditional entry to the flight score.
      Parameters:
      pts - the number of points
      msg - the entry message
    • addBonus

      protected void addBonus(int pts, String msg, boolean condition)
      Adds a conditional bonus entry to the flight score.
      Parameters:
      pts - the number of points
      msg - the entry message
      condition - the condition
    • reset

      protected void reset(int id, EliteLevel lvl)
      Resets the flight score. The list of previous Airports, Countries and equipment types are unchanged.
      Parameters:
      id - the Flight Report database ID
      lvl - the Pilot's current EliteLevel
    • canScore

      protected static boolean canScore(FlightReport fr)
      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

      protected boolean isNewEquipment(String eqType, Instant dt)
      Returns if an equipment type has been used before a particular date.
      Parameters:
      eqType - the equipment type
      dt - the date/time
      Returns:
      TRUE if the equipment type has not been used before this date, otherwise FALSE
    • isNewAirport

      protected boolean isNewAirport(String iata, Instant dt)
      Returns if an Airport has been visited before a particular date.
      Parameters:
      iata - the Airport's IATA code
      dt - the date/time
      Returns:
      TRUE if the Airport has not been visited before this date, otherwise FALSE
    • isNewCountry

      protected boolean isNewCountry(String code, Instant dt)
      Returns if a Country has been visited before a particular date.
      Parameters:
      code - the ISO-3166 country code
      dt - the date/time
      Returns:
      TRUE if the Country has not been visited before this date, otherwise FALSE