Record Class WarriorsAlmanacEntry

java.lang.Object
java.lang.Record
mekhq.campaign.universe.warriorsAlmanac.WarriorsAlmanacEntry
Record Components:
name - the display name of the part or unit
techBase - the tech base of the part or unit, used for faction gating and the tech-base column
categoryOrder - the canonical ordinal of the category, used only to order the tabs
categoryLabel - the localized category name, used as the tab title
categoryIntro - the localized introductory blurb shown above the category's table
phase - the development phase that occurred this year

public record WarriorsAlmanacEntry(String name, megamek.common.enums.TechBase techBase, int categoryOrder, String categoryLabel, String categoryIntro, AlmanacTechAdvancementPhase phase) extends Record
A single Warrior's Almanac development event: one part or unit reaching a particular AlmanacTechAdvancementPhase (prototype, production, common, extinct, or reintroduced) in a given year.

Entries are grouped by the year the event occurred (see buildAlmanacPartsData(mekhq.campaign.market.PartsStore, boolean) and buildAlmanacUnitsData()), then presented per-category (Warehouse part category / unit type) in the WarriorsAlmanacDialog. categoryOrder preserves the canonical ordering used to lay out the tabs, while categoryLabel is the localized tab title.

Since:
0.50.07
  • Constructor Details

    • WarriorsAlmanacEntry

      public WarriorsAlmanacEntry(String name, megamek.common.enums.TechBase techBase, int categoryOrder, String categoryLabel, String categoryIntro, AlmanacTechAdvancementPhase phase)
      Creates an instance of a WarriorsAlmanacEntry record class.
      Parameters:
      name - the value for the name record component
      techBase - the value for the techBase record component
      categoryOrder - the value for the categoryOrder record component
      categoryLabel - the value for the categoryLabel record component
      categoryIntro - the value for the categoryIntro record component
      phase - the value for the phase record component
  • Method Details

    • buildAlmanacPartsData

      public static Map<Integer,List<WarriorsAlmanacEntry>> buildAlmanacPartsData(PartsStore partsStore, boolean isClan)
      Builds the parts almanac, keyed by the year each development event occurred.

      Omni-podded parts are skipped. The supplied isClan flag selects the Inner Sphere or Clan tech-date perspective for the part, and should reflect the player force (see Force#isClanForce).

      Parameters:
      partsStore - the parts store to enumerate
      isClan - whether to use Clan tech dates (true) or Inner Sphere tech dates (false)
      Returns:
      a map of year to the development events that occurred that year
    • buildAlmanacUnitsData

      public static Map<Integer,List<WarriorsAlmanacEntry>> buildAlmanacUnitsData()
      Builds the units almanac, keyed by the year each development event occurred.

      Unit tech dates are tech-base agnostic (they are precomputed on the MekSummary), so no perspective flag is required.

      Returns:
      a map of year to the development events that occurred that year
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • techBase

      public megamek.common.enums.TechBase techBase()
      Returns the value of the techBase record component.
      Returns:
      the value of the techBase record component
    • categoryOrder

      public int categoryOrder()
      Returns the value of the categoryOrder record component.
      Returns:
      the value of the categoryOrder record component
    • categoryLabel

      public String categoryLabel()
      Returns the value of the categoryLabel record component.
      Returns:
      the value of the categoryLabel record component
    • categoryIntro

      public String categoryIntro()
      Returns the value of the categoryIntro record component.
      Returns:
      the value of the categoryIntro record component
    • phase

      Returns the value of the phase record component.
      Returns:
      the value of the phase record component