Package megamek.common
Record Class WeatherRestriction
java.lang.Object
java.lang.Record
megamek.common.WeatherRestriction
This class contains data and logic for temperature restrictions.
TODO: Move the "data" out to user-configurable files?
-
Constructor Summary
ConstructorsConstructorDescriptionWeatherRestriction(Integer minAtmosphereLevel, Integer maxTemp) Creates an instance of aWeatherRestrictionrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.static booleanIsFogRestricted(int fogLevel, int atmosphereLevel, int temperature) Given a fog level and set of relevant planetary conditions, determine if the fog level is allowedstatic booleanIsRestricted(PlanetaryConditions conditions) Deprecated, for removal: This API element is subject to removal in a future version.static booleanIsWeatherRestricted(int weatherType, int atmosphereLevel, int temperature) Given a weather (precipitation) type and set of relevant planetary conditions, determine if it's allowedstatic booleanIsWindRestricted(int windLevel, int atmosphereLevel, int temperature) Given a wind level and set of relevant planetary conditions, determine if the wind level is allowedmaxTemp()Returns the value of themaxTemprecord component.Returns the value of theminAtmosphereLevelrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
WeatherRestriction
Creates an instance of aWeatherRestrictionrecord class.- Parameters:
minAtmosphereLevel- the value for theminAtmosphereLevelrecord componentmaxTemp- the value for themaxTemprecord 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
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. -
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. -
equals
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 withObjects::equals(Object,Object). -
minAtmosphereLevel
Returns the value of theminAtmosphereLevelrecord component.- Returns:
- the value of the
minAtmosphereLevelrecord component
-
maxTemp
Returns the value of themaxTemprecord component.- Returns:
- the value of the
maxTemprecord component
-