Record Class FactionLeaderData

java.lang.Object
java.lang.Record
megamek.common.universe.FactionLeaderData
Record Components:
title - the leader's title (e.g., "Duke", "Commander")
firstName - the leader's given name
surname - the leader's surname; may be null
honorific - additional information following the leader's name (e.g., "III"); may be null
gender - the gender of the leader
startYear - the first year of the leader's tenure, or null if unknown
endYear - the last year of the leader's tenure, or null if unknown

public record FactionLeaderData(String title, String firstName, String surname, String honorific, Gender gender, Integer startYear, Integer endYear) extends Record
Stores details about a leader of a faction, including name, gender, and years of tenure.

This record encapsulates all relevant information about an individual who has led a given faction, such as their title, full name, gender, period in office, and any additional honorifics. It also provides utility methods for constructing full display titles and for validating the leader's tenure for a given year.

Since:
0.50.07
  • Constructor Details

    • FactionLeaderData

      public FactionLeaderData(String title, String firstName, @Nullable String surname, @Nullable String honorific, Gender gender, @Nullable Integer startYear, @Nullable Integer endYear)
      Compact constructor that replaces any null surname or honorific with empty strings, and sets missing years to NO_YEAR.
      Parameters:
      title - the leader's title
      firstName - the leader's given name
      surname - the leader's surname; may be null
      honorific - additional name information; may be null
      gender - the leader's gender
      startYear - the first year of the leader's tenure; may be null
      endYear - the last year of the leader's tenure; may be null
      Since:
      0.50.07
  • Method Details

    • getFullName

      public String getFullName()
      Returns the full name of the leader, constructed from the first name and surname.
      Returns:
      the full name (first name and surname separated by a space)
      Since:
      0.50.07
    • getFullTitle

      public String getFullTitle(boolean excludeFirstOfTheirName)
      Constructs and returns the full formal title of the leader.
      Parameters:
      excludeFirstOfTheirName - if true, omits the honorific "I" (used for the first of their name)
      Returns:
      the complete title line for the leader, including honorifics
      Since:
      0.50.07
    • isValidInYear

      public boolean isValidInYear(int year)
      Determines if this leader was in office during the specified year.
      Parameters:
      year - the year to check for validity
      Returns:
      true if the year is within the leader's tenure, false otherwise
      Since:
      0.50.07
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • title

      public String title()
      Returns the value of the title record component.
      Returns:
      the value of the title record component
    • firstName

      public String firstName()
      Returns the value of the firstName record component.
      Returns:
      the value of the firstName record component
    • surname

      @Nullable public String surname()
      Returns the value of the surname record component.
      Returns:
      the value of the surname record component
    • honorific

      @Nullable public String honorific()
      Returns the value of the honorific record component.
      Returns:
      the value of the honorific record component
    • gender

      public Gender gender()
      Returns the value of the gender record component.
      Returns:
      the value of the gender record component
    • startYear

      @Nullable public Integer startYear()
      Returns the value of the startYear record component.
      Returns:
      the value of the startYear record component
    • endYear

      @Nullable public Integer endYear()
      Returns the value of the endYear record component.
      Returns:
      the value of the endYear record component