Record Class HousingPolicy

java.lang.Object
java.lang.Record
forgottentowns.mod.api.HousingPolicy
Record Components:
zoneIds - exact zone definition IDs affected by the policy
householdOnly - whether additional occupants must share a nonempty household identity
allowSoldiers - whether affected homes may admit soldiers; household-only policies also require household membership

public record HousingPolicy(Set<String> zoneIds, boolean householdOnly, boolean allowSoldiers) extends Record
Optional expansion of ordinary single-occupant housing, bounded by usable beds. Multiple policies compose additively; an unrestricted policy may also admit unrelated residents.
  • Constructor Details

    • HousingPolicy

      public HousingPolicy(Set<String> zoneIds, boolean householdOnly, boolean allowSoldiers)
      Copies and validates the affected zone IDs. The constructor checks nonblank spelling; the registration context separately restricts these IDs to the host's supported housing categories.
      Parameters:
      zoneIds - nonempty set of stable zone IDs
      householdOnly - require a shared household for additional occupants
      allowSoldiers - admit soldiers, requiring household membership only for household-only policies
      Throws:
      NullPointerException - if zoneIds or an element is null
      IllegalArgumentException - if the set is empty or contains a blank ID
  • Method Details

    • 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.
    • zoneIds

      public Set<String> zoneIds()
      Returns the value of the zoneIds record component.
      Returns:
      the value of the zoneIds record component
    • householdOnly

      public boolean householdOnly()
      Returns the value of the householdOnly record component.
      Returns:
      the value of the householdOnly record component
    • allowSoldiers

      public boolean allowSoldiers()
      Returns the value of the allowSoldiers record component.
      Returns:
      the value of the allowSoldiers record component