Class YearlyTotal

java.lang.Object
org.deltava.beans.DatabaseBean
org.deltava.beans.econ.YearlyTotal
All Implemented Interfaces:
Serializable, Cloneable, Comparable<Object>, EliteTotals, IDBean, Cacheable
Direct Known Subclasses:
RolloverYearlyTotal

public class YearlyTotal extends DatabaseBean implements EliteTotals, Cloneable
A bean to store yearly Pilot Elite status totals.
Since:
9.2
Version:
11.5
Author:
Luke
See Also:
  • Constructor Details

    • YearlyTotal

      public YearlyTotal(int year, int pilotID)
      Creates the bean.
      Parameters:
      year - the program year
      pilotID - the Pilot's Database ID
  • Method Details

    • getLegs

      public int getLegs()
      Description copied from interface: EliteTotals
      Returns the number of flight legs.
      Specified by:
      getLegs in interface EliteTotals
      Returns:
      the number of legs
    • getDistance

      public int getDistance()
      Description copied from interface: EliteTotals
      Returns the distance flown.
      Specified by:
      getDistance in interface EliteTotals
      Returns:
      the distance in miles
    • getPoints

      public int getPoints()
      Description copied from interface: EliteTotals
      Returns the number of Elite points.
      Specified by:
      getPoints in interface EliteTotals
      Returns:
      the number of points
    • getYear

      public int getYear()
      Returns the program year.
      Returns:
      the year
    • reset

      public void reset(int year)
      Resets the totals.
      Parameters:
      year - the new program year
    • add

      public void add(FlightEliteScore sc)
      Adds a Flight's totals.
      Parameters:
      sc - a FlightEliteScore
    • addLegs

      public void addLegs(int legs, int distance, int pts)
      Adds aggregated totals.
      Parameters:
      legs - the number of flight legs
      distance - the distance in miles
      pts - the flight score
    • adjust

      public YearlyTotal adjust(LocalDate ld)
      Projects year to date totals over a full year. This will have no effect on totals for a prior year.
      Parameters:
      ld - the date to project from
      Returns:
      a YearlyTotal bean
    • matches

      public boolean matches(EliteTotals el)
      Returns whether these totals match the requirements for a given Elite level.
      Parameters:
      el - the EliteLevel
      Returns:
      TRUE if the legs, distance and points all exceed the requirements
    • matches

      public EliteLevel matches(Collection<EliteLevel> lvls)
      Returns the highest level whose requirements match this total.
      Parameters:
      lvls - a Collection of EliteLevels
      Returns:
      an EliteLevel, or the first level if none match
    • delta

      public YearlyTotal delta(EliteLevel el)
      Returns the prerequisites required to achieve a particular Elite level.
      Parameters:
      el - the EliteLevel
      Returns:
      a YearlyTotal with the amounts required
    • wouldMatch

      public UpgradeReason wouldMatch(EliteTotals el, FlightEliteScore sc)
      Returns whether a specific flight leg would trigger a given Elite Level.
      Parameters:
      el - the EliteLevel
      sc - the FlightEliteScore for that leg
      Returns:
      an UpgradeReason
    • cacheKey

      public Object cacheKey()
      Description copied from interface: Cacheable
      Returns the cache key for this object. Caches call this method when adding the object.
      Specified by:
      cacheKey in interface Cacheable
      Overrides:
      cacheKey in class DatabaseBean
      Returns:
      the cache key for the object
    • toString

      public String toString()
      Overrides:
      toString in class Object