Record Class WeatherRestriction

java.lang.Object
java.lang.Record
megamek.common.WeatherRestriction

public record WeatherRestriction(Integer minAtmosphereLevel, Integer maxTemp) extends Record
This class contains data and logic for temperature restrictions. TODO: Move the "data" out to user-configurable files?
  • Constructor Summary

    Constructors
    Constructor
    Description
    WeatherRestriction(Integer minAtmosphereLevel, Integer maxTemp)
    Creates an instance of a WeatherRestriction record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    static boolean
    IsFogRestricted(int fogLevel, int atmosphereLevel, int temperature)
    Given a fog level and set of relevant planetary conditions, determine if the fog level is allowed
    static boolean
    Deprecated, for removal: This API element is subject to removal in a future version.
    static boolean
    IsWeatherRestricted(int weatherType, int atmosphereLevel, int temperature)
    Given a weather (precipitation) type and set of relevant planetary conditions, determine if it's allowed
    static boolean
    IsWindRestricted(int windLevel, int atmosphereLevel, int temperature)
    Given a wind level and set of relevant planetary conditions, determine if the wind level is allowed
    Returns the value of the maxTemp record component.
    Returns the value of the minAtmosphereLevel record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • WeatherRestriction

      public WeatherRestriction(Integer minAtmosphereLevel, Integer maxTemp)
      Creates an instance of a WeatherRestriction record class.
      Parameters:
      minAtmosphereLevel - the value for the minAtmosphereLevel record component
      maxTemp - the value for the maxTemp record component
  • Method Details

    • IsRestricted

      @Deprecated(since="0.51.0", forRemoval=true) public static boolean IsRestricted(PlanetaryConditions conditions)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Given a set of planetary conditions, determine if they are valid for their current atmosphere/temperature Currently validates fog, weather (precipitation) and wind strength
    • IsFogRestricted

      public static boolean IsFogRestricted(int fogLevel, int atmosphereLevel, int temperature)
      Given a fog level and set of relevant planetary conditions, determine if the fog level is allowed
    • IsWeatherRestricted

      public static boolean IsWeatherRestricted(int weatherType, int atmosphereLevel, int temperature)
      Given a weather (precipitation) type and set of relevant planetary conditions, determine if it's allowed
    • IsWindRestricted

      public static boolean IsWindRestricted(int windLevel, int atmosphereLevel, int temperature)
      Given a wind level and set of relevant planetary conditions, determine if the wind level is allowed
    • 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.
    • minAtmosphereLevel

      public Integer minAtmosphereLevel()
      Returns the value of the minAtmosphereLevel record component.
      Returns:
      the value of the minAtmosphereLevel record component
    • maxTemp

      public Integer maxTemp()
      Returns the value of the maxTemp record component.
      Returns:
      the value of the maxTemp record component