Class TechAdvancement

java.lang.Object
megamek.common.TechAdvancement
All Implemented Interfaces:
ITechnology

public class TechAdvancement extends Object implements ITechnology
Handles the progression of technology through prototype, production, extinction and reintroduction phases. Calculates current rules level for IS or Clan.
  • Field Details

  • Constructor Details

    • TechAdvancement

      public TechAdvancement()
    • TechAdvancement

      public TechAdvancement(TechBase techBase)
    • TechAdvancement

      public TechAdvancement(TechAdvancement ta)
      Copy constructor
  • Method Details

    • setTechBase

      public TechAdvancement setTechBase(TechBase base)
    • getTechBase

      public TechBase getTechBase()
      Specified by:
      getTechBase in interface ITechnology
    • setISAdvancement

      Provide years for prototype, production, common, extinction, and reintroduction for IS factions.
      Parameters:
      prog - A map of tech progression years.
      Returns:
      a reference to this object
    • setISAdvancement

      public TechAdvancement setISAdvancement(int... prog)
      Provide years for prototype, production, common, extinction, and reintroduction for IS factions.
      Parameters:
      prog - Up to five tech progression years. Missing levels should be marked by DATE_NONE.
      Returns:
      a reference to this object
    • setISAdvancement

      public TechAdvancement setISAdvancement(TechAdvancement.AdvancementPhase phase, int prog)
    • setClanAdvancement

      public TechAdvancement setClanAdvancement(TechAdvancement.AdvancementPhase phase, int prog)
    • setISApproximate

      public TechAdvancement setISApproximate(TechAdvancement.AdvancementPhase phase, boolean approximate)
    • setClanApproximate

      public TechAdvancement setClanApproximate(TechAdvancement.AdvancementPhase phase, boolean approximate)
    • setISApproximate

      public TechAdvancement setISApproximate(Map<TechAdvancement.AdvancementPhase,Boolean> approx)
      Indicate whether the years for prototype, production, common, extinction, and reintroduction for IS factions should be considered approximate.
      Parameters:
      approx - A map of tech progression years.
      Returns:
      a reference to this object
    • setISApproximate

      public TechAdvancement setISApproximate(boolean... approx)
      Indicate whether the years for prototype, production, common, extinction, and reintroduction for IS factions should be considered approximate.
      Parameters:
      approx - Up to five tech progression years.
      Returns:
      a reference to this object
    • setISApproximate

      public TechAdvancement setISApproximate(TechAdvancement.AdvancementPhase... phases)
      Indicate whether the years for prototype, production, common, extinction, and reintroduction for IS factions should be considered approximate.
      Parameters:
      phases - the phases to set as approximate
      Returns:
      a reference to this object
    • setClanAdvancement

      public TechAdvancement setClanAdvancement(Map<TechAdvancement.AdvancementPhase,Integer> prog)
      Provide years for prototype, production, common, extinction, and reintroduction for Clan factions.
      Parameters:
      prog - A map of tech progression years.
      Returns:
      a reference to this object
    • setClanAdvancement

      public TechAdvancement setClanAdvancement(int... prog)
      Provide years for prototype, production, common, extinction, and reintroduction for Clan factions.
      Parameters:
      prog - Up to five tech progression years. Missing levels should be marked by DATE_NONE.
      Returns:
      a reference to this object
    • setClanApproximate

      public TechAdvancement setClanApproximate(Map<TechAdvancement.AdvancementPhase,Boolean> approx)
      Indicate whether the years for prototype, production, common, extinction, and reintroduction for Clan factions should be considered approximate.
      Parameters:
      approx - A map of tech progression years.
      Returns:
      a reference to this object
    • setClanApproximate

      public TechAdvancement setClanApproximate(boolean... approx)
      Indicate whether the years for prototype, production, common, extinction, and reintroduction for Clan factions should be considered approximate.
      Parameters:
      approx - Up to five tech progression years.
      Returns:
      a reference to this object
    • setClanApproximate

      public TechAdvancement setClanApproximate(TechAdvancement.AdvancementPhase... phases)
      Indicate whether the years for prototype, production, common, extinction, and reintroduction for Clan factions should be considered approximate.
      Parameters:
      phases - the phases to set as approximate
      Returns:
      a reference to this object
    • setAdvancement

      A convenience method that will set identical values for IS and Clan factions. Prototype, Production, Common, Extinct, Reintroduced
      Parameters:
      prog - A map of tech progression years.
    • setAdvancement

      public TechAdvancement setAdvancement(int... prog)
      A convenience method that will set identical values for IS and Clan factions. Prototype, Production, Common, Extinct, Reintroduced
    • getISAdvancement

      public Integer getISAdvancement(TechAdvancement.AdvancementPhase phase)
    • getClanAdvancement

      public Integer getClanAdvancement(TechAdvancement.AdvancementPhase phase)
    • getISApproximate

      public boolean getISApproximate(TechAdvancement.AdvancementPhase phase)
    • getClanApproximate

      public boolean getClanApproximate(TechAdvancement.AdvancementPhase phase)
    • setApproximate

      A convenience method that will set identical values for IS and Clan factions.
      Parameters:
      approx - A map of tech progression years.
    • setApproximate

      public TechAdvancement setApproximate(boolean... approx)
      A convenience method that will set identical values for IS and Clan factions.
    • setApproximate

      public TechAdvancement setApproximate(TechAdvancement.AdvancementPhase... phases)
      A convenience method that will set identical values for IS and Clan factions.
      Parameters:
      phases - the phases to set as approximate
    • setPrototypeFactions

      public TechAdvancement setPrototypeFactions(Faction... factions)
      Sets which factions developed a prototype.
      Parameters:
      factions - A list of Faction enums
    • getPrototypeFactions

      public Set<Faction> getPrototypeFactions()
      Returns:
      A set of Faction enums that indicate which factions started prototype development.
    • setProductionFactions

      public TechAdvancement setProductionFactions(Faction... factions)
      Sets which factions started production before the technology was commonly available.
      Parameters:
      factions - A list of Faction enums
      Returns:
      A reference to this object.
    • getProductionFactions

      public Set<Faction> getProductionFactions()
      Returns:
      A set of Faction enums that indicate which factions started production before the technology was commonly available.
    • setExtinctionFactions

      public TechAdvancement setExtinctionFactions(Faction... factions)
      Sets the factions for which the technology became extinct.
      Parameters:
      factions - A list of Faction enums
      Returns:
      A reference to this object.
    • getExtinctionFactions

      public Set<Faction> getExtinctionFactions()
      Returns:
      A set of Faction enums that indicate the factions for which the technology became extinct.
    • setReintroductionFactions

      public TechAdvancement setReintroductionFactions(Faction... factions)
      Sets the factions which reintroduced technology that had been extinct.
      Parameters:
      factions - A list of Faction enums
      Returns:
      A reference to this object.
    • getReintroductionFactions

      public Set<Faction> getReintroductionFactions()
      Returns:
      A set of Faction enums that indicate the factions that reintroduced extinct technology. became extinct.
    • getPrototypeDate

      public int getPrototypeDate(boolean clan)
      The prototype date for either Clan or IS factions. If the date is flagged as approximate, the date returned will be earlier by the value of APPROXIMATE_MARGIN.
      Specified by:
      getPrototypeDate in interface ITechnology
    • getPrototypeDate

      public int getPrototypeDate(boolean clan, Faction faction)
      The prototype date for a particular faction. If there are prototype factions and the given faction is not among them, the prototype date is DATE_NONE.
      Specified by:
      getPrototypeDate in interface ITechnology
      Parameters:
      clan - Whether to use Clan or IS progression dates
      faction - The index of the faction (F_* constant). If < 0, the prototype factions are ignored.
    • getProductionDate

      public int getProductionDate(boolean clan)
      The production date for either Clan or IS factions. If the date is flagged as approximate, the date returned will be earlier by the value of APPROXIMATE_MARGIN.
      Specified by:
      getProductionDate in interface ITechnology
    • getProductionDate

      public int getProductionDate(boolean clan, Faction faction)
      The production date for a particular faction. If there are production factions and the given faction is not among them, the production date is DATE_NONE.
      Specified by:
      getProductionDate in interface ITechnology
      Parameters:
      clan - Whether to use Clan or IS progression dates
      faction - The index of the faction (F_* constant). If < 0, the production factions are ignored.
    • getCommonDate

      public int getCommonDate(boolean clan)
      The common date for either Clan or IS factions. If the date is flagged as approximate, the date returned will be earlier by the value of APPROXIMATE_MARGIN.
      Specified by:
      getCommonDate in interface ITechnology
    • getExtinctionDate

      public int getExtinctionDate(boolean clan)
      The extinction date for either Clan or IS factions. If the date is flagged as approximate, the date returned will be later by the value of APPROXIMATE_MARGIN.
      Specified by:
      getExtinctionDate in interface ITechnology
    • getExtinctionDate

      public int getExtinctionDate(boolean clan, Faction faction)
      The extinction date for a particular faction. If there are extinction factions and the given faction is not among them, the extinction date is DATE_NONE.
      Specified by:
      getExtinctionDate in interface ITechnology
      Parameters:
      clan - Whether to use Clan or IS progression dates
      faction - The index of the faction (F_* constant). If < 0, the extinction factions are ignored.
    • getReintroductionDate

      public int getReintroductionDate(boolean clan)
      The reintroduction date for either Clan or IS factions. If the date is flagged as approximate, the date returned will be earlier by the value of APPROXIMATE_MARGIN.
      Specified by:
      getReintroductionDate in interface ITechnology
    • getReintroductionDate

      public int getReintroductionDate(boolean clan, Faction faction)
      The reintroduction date for a particular faction. If there are reintroduction factions and the given faction is not among them, the reintroduction date is DATE_NONE.
      Specified by:
      getReintroductionDate in interface ITechnology
      Parameters:
      clan - Whether to use Clan or IS progression dates
      faction - The Faction. If null the reintroduction factions are ignored.
    • getIntroductionDate

      public int getIntroductionDate(boolean clan)
      The year the technology first became available for Clan or IS factions, regardless of production level, or APPROXIMATE_MARGIN years earlier if marked as approximate.
      Specified by:
      getIntroductionDate in interface ITechnology
    • getIntroductionDate

      public int getIntroductionDate(boolean clan, Faction faction)
      The year the technology first became available for the given faction, regardless of production level, or APPROXIMATE_MARGIN years earlier if marked as approximate.
      Specified by:
      getIntroductionDate in interface ITechnology
    • getPrototypeDate

      public int getPrototypeDate()
      Specified by:
      getPrototypeDate in interface ITechnology
    • getProductionDate

      public int getProductionDate()
      Specified by:
      getProductionDate in interface ITechnology
    • getCommonDate

      public int getCommonDate()
      Specified by:
      getCommonDate in interface ITechnology
    • getExtinctionDate

      public int getExtinctionDate()
      If the tech base is IS or Clan, returns the extinction date that matches the tech base. Otherwise, returns the latter of the IS and Clan dates, or DATE_NONE if the tech has not gone extinct for both.
      Specified by:
      getExtinctionDate in interface ITechnology
      Returns:
      Universe-wide extinction date.
    • getReintroductionDate

      public int getReintroductionDate()
      Specified by:
      getReintroductionDate in interface ITechnology
    • getIntroductionDate

      public int getIntroductionDate()
      Specified by:
      getIntroductionDate in interface ITechnology
    • getIntroductionDateName

      public String getIntroductionDateName()
      Formats introduction date indicating approximate when appropriate, and prototype faction if any for either IS or Clan use tech base.
    • getPrototypeDateName

      public String getPrototypeDateName(boolean clan)
      Formats prototype date indicating approximate when appropriate, and prototype faction if any for either IS or Clan use tech base.
    • getPrototypeDateName

      public String getPrototypeDateName()
      Formats earliest of Clan or IS prototype date indicating approximate when appropriate, and prototype faction if any for mixed tech.
    • getProductionDateName

      public String getProductionDateName(boolean clan)
      Formats production date indicating approximate when appropriate, and production faction if any for either IS or Clan use tech base.
    • getProductionDateName

      public String getProductionDateName()
      Formats earliest of Clan or IS production date indicating approximate when appropriate, and production faction if any for mixed tech.
    • getCommonDateName

      public String getCommonDateName(boolean clan)
      Formats common date indicating approximate when appropriate.
    • getCommonDateName

      public String getCommonDateName()
      Formats earliest of Clan or IS common date indicating approximate when appropriate for mixed tech.
    • getExtinctionDateName

      public String getExtinctionDateName(boolean clan)
      Formats extinction date indicating approximate when appropriate, and extinction faction if any for either IS or Clan use tech base.
    • getExtinctionDateName

      public String getExtinctionDateName()
      Formats latest of Clan or IS extinction date indicating approximate when appropriate, and extinction faction if any for mixed tech.
    • getReintroductionDateName

      public String getReintroductionDateName(boolean clan)
      Formats reintroduction date indicating approximate when appropriate, and reintroduction faction if any for either IS or Clan use tech base.
    • getReintroductionDateName

      public String getReintroductionDateName()
      Formats earliest of Clan or IS reintroduction date indicating approximate when appropriate, and reintroduction faction if any for mixed tech.
    • earliestDate

      public static int earliestDate(int d1, int d2)
      Finds the earliest of two dates, ignoring DATE_NA unless both values are set to DATE_NA
    • getStaticTechLevel

      public SimpleTechLevel getStaticTechLevel()
      Description copied from interface: ITechnology
      For non-era-based usage, provide a single tech level that does not vary with date.
      Specified by:
      getStaticTechLevel in interface ITechnology
      Returns:
      The base rules level of the equipment or unit.
    • setStaticTechLevel

      public TechAdvancement setStaticTechLevel(SimpleTechLevel level)
      Set RULES LEVEL
      Parameters:
      level - can be any of SimpleTechLevel
      Returns:
      itself
    • guessStaticTechLevel

      public SimpleTechLevel guessStaticTechLevel(Collection<RulesRef> rulesRefs)
    • setTechRating

      public TechAdvancement setTechRating(TechRating rating)
    • getTechRating

      public TechRating getTechRating()
      Specified by:
      getTechRating in interface ITechnology
    • setAvailability

    • setAvailability

      public TechAdvancement setAvailability(Era era, AvailabilityValue av)
    • getBaseAvailability

      public AvailabilityValue getBaseAvailability(Era era)
      Specified by:
      getBaseAvailability in interface ITechnology
    • isClan

      public boolean isClan()
      Specified by:
      isClan in interface ITechnology
    • isMixedTech

      public boolean isMixedTech()
      Specified by:
      isMixedTech in interface ITechnology