Class EliteLevel

java.lang.Object
org.deltava.beans.econ.EliteLevel
All Implemented Interfaces:
Serializable, Cloneable, Comparable<EliteLevel>, Auditable, ComboAlias, EliteTotals, RGBColor, Cacheable

public class EliteLevel extends Object implements ComboAlias, EliteTotals, RGBColor, Auditable, Comparable<EliteLevel>, Cacheable
A bean to store Pilot loyalty status level definitions for a particular year.
Since:
9.2
Version:
11.5
Author:
Luke
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final EliteLevel
    A dummy, empty Elite level.
    static final int
    The first year of the Elite program.
  • Constructor Summary

    Constructors
    Constructor
    Description
    EliteLevel(int year, String name, String code)
    Creates the bean.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the cache key for this object.
    int
     
    boolean
     
    Returns the object ID for this auditable object.
    float
    Returns the bonus factor to be applied to points earned on a flight when the pilot is at this level.
    int
    Returns the RGB color.
    Returns the alias to use in the HTML <OPTION> element.
    Returns the visible name to use in the HTML <OPTION> element.
    int
    Returns the total flight distance required for this level.
    boolean
    Returns whether the level is visible.
    int
    Returns the number of flight legs required for this level.
    Returns the level name.
    Returns the owner of this Elite Level.
    int
    Returns the number of status points required for this level.
    Returns the last date of statistics used to generate thresholds.
    Returns the first date of statistics used to generate thresholds.
    int
    Returns this level's target Pilot percentile.
    int
    Returns the year these requirements were in effect.
    int
     
    boolean
    Utility method to compare names only between Elite Levels.
    static int
    round(float value, int rndTo)
    Rounds a leg or mileage number to the nearest factor.
    void
    setBonusFactor(float factor)
    Updates the bonus factor to be applied to points earned on a flight when the pilot is at this level.
    void
    setColor(int c)
    Updates the color used to display this level.
    void
    setDistance(int dst)
    Updates the total flight distance required for this level.
    void
    setLegs(int legs)
    Updates the number of flight legs required for this level.
    void
    Updates the owner of this level.
    void
    setPoints(int pts)
    Updates the number of status points required for this level.
    void
    Updates the first date of statistics used to generate thresholds.
    void
    Updates this level's target Pilot percentile.
    void
    setVisible(boolean isVisible)
    Updates whether the level is visible.
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.deltava.beans.Auditable

    getAuditType, isCrossApp

    Methods inherited from interface org.deltava.beans.econ.EliteTotals

    isZero

    Methods inherited from interface org.deltava.beans.RGBColor

    getHexColor
  • Field Details

    • EMPTY

      public static final EliteLevel EMPTY
      A dummy, empty Elite level.
    • MIN_YEAR

      public static final int MIN_YEAR
      The first year of the Elite program.
      See Also:
  • Constructor Details

    • EliteLevel

      public EliteLevel(int year, String name, String code)
      Creates the bean.
      Parameters:
      year - the year
      name - the level name
      code - the owner virtual airline code
  • Method Details

    • round

      public static int round(float value, int rndTo)
      Rounds a leg or mileage number to the nearest factor.
      Parameters:
      value - the value
      rndTo - the rounding factor
      Returns:
      the rounded number
    • getName

      public String getName()
      Returns the level name.
      Returns:
      the name
    • getYear

      public int getYear()
      Returns the year these requirements were in effect.
      Returns:
      the year
    • getOwner

      public String getOwner()
      Returns the owner of this Elite Level.
      Returns:
      the owner virtual airline code
    • getLegs

      public int getLegs()
      Returns the number of flight legs required for this level.
      Specified by:
      getLegs in interface EliteTotals
      Returns:
      the number of legs
    • getDistance

      public int getDistance()
      Returns the total flight distance required for this level.
      Specified by:
      getDistance in interface EliteTotals
      Returns:
      the number of miles
    • getPoints

      public int getPoints()
      Returns the number of status points required for this level.
      Specified by:
      getPoints in interface EliteTotals
      Returns:
      the number of points
    • getBonusFactor

      public float getBonusFactor()
      Returns the bonus factor to be applied to points earned on a flight when the pilot is at this level.
      Returns:
      the bonus factor
    • getColor

      public int getColor()
      Description copied from interface: RGBColor
      Returns the RGB color.
      Specified by:
      getColor in interface RGBColor
      Returns:
      a 24-bit RGB color value
    • getTargetPercentile

      public int getTargetPercentile()
      Returns this level's target Pilot percentile.
      Returns:
      the percentile
    • getIsVisible

      public boolean getIsVisible()
      Returns whether the level is visible.
      Returns:
      TRUE if visible, otherwise FALSE
    • getStatisticsStartDate

      public Instant getStatisticsStartDate()
      Returns the first date of statistics used to generate thresholds.
      Returns:
      the start date/time
    • getStatisticsEndDate

      public Instant getStatisticsEndDate()
      Returns the last date of statistics used to generate thresholds.
      Returns:
      the end date/time
    • setLegs

      public void setLegs(int legs)
      Updates the number of flight legs required for this level.
      Parameters:
      legs - the number of legs
    • setDistance

      public void setDistance(int dst)
      Updates the total flight distance required for this level.
      Parameters:
      dst - the distance in miles
    • setOwner

      public void setOwner(String code)
      Updates the owner of this level.
      Parameters:
      code - the owner virtual airline code
    • setPoints

      public void setPoints(int pts)
      Updates the number of status points required for this level.
      Parameters:
      pts - the number of points
    • setBonusFactor

      public void setBonusFactor(float factor)
      Updates the bonus factor to be applied to points earned on a flight when the pilot is at this level.
      Parameters:
      factor - the bonus factor
    • setColor

      public void setColor(int c)
      Updates the color used to display this level.
      Parameters:
      c - the RGB code
    • setTargetPercentile

      public void setTargetPercentile(int pct)
      Updates this level's target Pilot percentile.
      Parameters:
      pct - the percentile
    • setVisible

      public void setVisible(boolean isVisible)
      Updates whether the level is visible.
      Parameters:
      isVisible - TRUE if visible, otherwise FALSE
    • setStatisticsStartDate

      public void setStatisticsStartDate(Instant dt)
      Updates the first date of statistics used to generate thresholds.
      Parameters:
      dt - the start date/time
    • matches

      public boolean matches(EliteLevel el2)
      Utility method to compare names only between Elite Levels. This is a rough cross-year equality test.
      Parameters:
      el2 - the second EliteLevel
      Returns:
      TRUE if the names match, otherwise FALSE
    • getComboName

      public String getComboName()
      Description copied from interface: ComboAlias
      Returns the visible name to use in the HTML <OPTION> element.
      Specified by:
      getComboName in interface ComboAlias
      Returns:
      The visible name for this entry
    • getComboAlias

      public String getComboAlias()
      Description copied from interface: ComboAlias
      Returns the alias to use in the HTML <OPTION> element.
      Specified by:
      getComboAlias in interface ComboAlias
      Returns:
      The alias for this entry
    • getAuditID

      public String getAuditID()
      Description copied from interface: Auditable
      Returns the object ID for this auditable object.
      Specified by:
      getAuditID in interface Auditable
      Returns:
      the ID
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • 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
      Returns:
      the cache key for the object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • compareTo

      public int compareTo(EliteLevel el2)
      Specified by:
      compareTo in interface Comparable<EliteLevel>