Class CompositeTechLevel

java.lang.Object
megamek.common.CompositeTechLevel
All Implemented Interfaces:
Serializable, ITechnology
Direct Known Subclasses:
RecordingCompositeTechLevel

public class CompositeTechLevel extends Object implements ITechnology, Serializable
Determines tech level dates based on tech progression of components.
See Also:
  • Constructor Details

    • CompositeTechLevel

      public CompositeTechLevel(TechAdvancement initialTA, boolean clan, boolean mixed, int introYear, Faction techFaction)
      Parameters:
      initialTA - - the base tech advancement for the composite equipment
      clan - - whether the equipment tech base is Clan
      mixed - - whether the equipment contains a mix of Clan and IS equipment
      introYear - - the year the composite equipment is first available - Prototype production common extinction reintroduction They want to use eras - this unit is prototype - new availability type - TN to find a prototype table -
    • CompositeTechLevel

      public CompositeTechLevel(Entity entity, Faction techFaction)
      Parameters:
      entity - Entity to check.
  • Method Details

    • getExperimentalRange

      @Deprecated(since="0.51.0", forRemoval=true) public String getExperimentalRange()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      getExperimentalRange in interface ITechnology
      Returns:
      - the experimental tech date range, formatted as a string
    • getAdvancedRange

      @Deprecated(since="0.51.0", forRemoval=true) public String getAdvancedRange()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      getAdvancedRange in interface ITechnology
      Returns:
      - the advanced tech date range, formatted as a string
    • getStandardRange

      @Deprecated(since="0.51.0", forRemoval=true) public String getStandardRange()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      getStandardRange in interface ITechnology
      Returns:
      - the standard tech date range, formatted as a string
    • getExtinctionRange

      public String getExtinctionRange()
      Specified by:
      getExtinctionRange in interface ITechnology
      Returns:
      - the range(s) of dates when the tech is extinct
    • addComponent

      public void addComponent(ITechnology tech)
      Adjust the dates for various tech levels to account for the tech advancement of a new component.
      Parameters:
      tech - - the advancement for the new component
    • addComponent

      public void addComponent(ITechnology tech, @Nullable String componentName)
      Adjust the dates for various tech levels to account for the tech advancement of a new component, giving the component a name for reporting purposes.

      Most components can name themselves (EquipmentType and Engine), but system components such as the armor, the internal structure or a gyro are passed as bare TechAdvancement objects that carry no name. Those call sites supply one here so that a tech level report can identify every row.

      Parameters:
      tech - - the advancement for the new component
      componentName - - the name to report this component under, or null to derive the name from the component itself
    • recordComponent

      protected void recordComponent(ITechnology tech, @Nullable String componentName)
      Called after every component has been folded into this composite. Does nothing by default; subclasses may override it to record the components that make up the composite. See RecordingCompositeTechLevel.
      Parameters:
      tech - - the advancement of the component that was just added
      componentName - - the name supplied for the component, or null if none was given
    • getTechLevel

      public int getTechLevel(int year)
      Specified by:
      getTechLevel in interface ITechnology
      Parameters:
      year - Year to check Tech Level for.
      Returns:
      the TechConstants tech level for a particular year
    • setObsoleteYear

      public void setObsoleteYear(int obsoleteYear)
      Sets the obsolete year for this unit, adding an extinction range from that year onwards. This should be called after quirks are loaded if the unit has the Obsolete quirk.
      Parameters:
      obsoleteYear - - the year when production of this obsolete unit ceased
    • setObsoleteYears

      public void setObsoleteYears(List<Integer> years)
      Sets multiple obsolete/reintroduction cycles for this unit based on the Obsolete quirk. The years list should be in pairs: obsoleteYear, reintroYear, obsoleteYear2, reintroYear2, ... An odd number of years means the final obsolete period extends indefinitely.
      Parameters:
      years - - list of years in order: obsolete, reintro, obsolete, reintro, ...
    • firstAvailableYearFrom

      public int firstAvailableYearFrom(int year)
      Returns the first year at or after the given year in which the unit is actually available: no earlier than its first advancement phase, and not inside an extinction period. When the given year falls inside an extinction period, this is the year the unit returns.
      Parameters:
      year - The year to check from
      Returns:
      The first year at or after year in which the unit is available, or ITechnology.DATE_NONE when the unit has gone extinct by then and is never reintroduced
    • getTechBase

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

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

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

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

      public int getEarliestTechDate()
    • getPrototypeDateRange

      public String getPrototypeDateRange()
      Returns the prototype/experimental date ranges, accounting for extinction periods
      Returns:
      List of DateRange objects representing when the unit is in prototype phase
    • getProductionDateRange

      public String getProductionDateRange()
      Returns the production/advanced date ranges, accounting for extinction periods
      Returns:
      List of DateRange objects representing when the unit is in production phase
    • getCommonDateRange

      public String getCommonDateRange()
      Returns the common/standard date ranges, accounting for extinction periods
      Returns:
      List of DateRange objects representing when the unit is in common phase
    • formatDateRanges

      public String formatDateRanges(List<CompositeTechLevel.DateRange> ranges)
      Formats a list of DateRange objects as a string for display, including era information
      Parameters:
      ranges - List of DateRange objects
      Returns:
      Formatted string representation with era metadata
    • 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()
      Specified by:
      getExtinctionDate in interface ITechnology
    • getReintroductionDate

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

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

      public AvailabilityValue getBaseAvailability(Era era)
      Specified by:
      getBaseAvailability in interface ITechnology
    • 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.
    • getIntroductionDate

      public int getIntroductionDate(boolean clan, Faction faction)
      Specified by:
      getIntroductionDate in interface ITechnology
    • getPrototypeDate

      public int getPrototypeDate(boolean clan, Faction faction)
      Specified by:
      getPrototypeDate in interface ITechnology
    • getProductionDate

      public int getProductionDate(boolean clan, Faction faction)
      Specified by:
      getProductionDate in interface ITechnology
    • getExtinctionDate

      public int getExtinctionDate(boolean clan, Faction faction)
      Specified by:
      getExtinctionDate in interface ITechnology
    • getReintroductionDate

      public int getReintroductionDate(boolean clan, Faction faction)
      Specified by:
      getReintroductionDate in interface ITechnology