Record Class BFSRange
java.lang.Object
java.lang.Record
megamek.common.battlefieldSupport.BFSRange
- Record Components:
shortRange- the short-range band in hexes, or-1for a keyword rangemediumRange- the medium-range band in hexes, or-1for a keyword rangelongRange- the long-range band in hexes, or-1for a keyword range
- All Implemented Interfaces:
Serializable
public record BFSRange(int shortRange, int mediumRange, int longRange)
extends Record
implements Serializable
The Short/Medium/Long range of a Battlefield Support Asset, in hexes. The Asset card shows this as
short/medium/long (for example 3/6/9).
Assets whose single attack is not a standard ranged attack - for example Artillery or Arrow assets, or Assets with
no ranged attack at all - use KEYWORD (all three values set to -1). In that case the display form is
a keyword label (such as Artillery or Arrow) derived from the Asset's Specials, or an em dash when
no keyword applies.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionBFSRange(int shortRange, int mediumRange, int longRange) Creates an instance of aBFSRangerecord class. -
Method Summary
Modifier and TypeMethodDescriptiondisplayString(String keywordLabel) Returns the card display form of this range.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanintReturns the value of thelongRangerecord component.intReturns the value of themediumRangerecord component.intReturns the value of theshortRangerecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
KEYWORD
A non-standard range represented by a keyword (Artillery, Arrow, or none).
-
-
Constructor Details
-
BFSRange
public BFSRange(int shortRange, int mediumRange, int longRange) Creates an instance of aBFSRangerecord class.- Parameters:
shortRange- the value for theshortRangerecord componentmediumRange- the value for themediumRangerecord componentlongRange- the value for thelongRangerecord component
-
-
Method Details
-
isKeyword
public boolean isKeyword()- Returns:
- true if this is a keyword range (all three bands negative) rather than a numeric S/M/L range
-
displayString
Returns the card display form of this range. For a numeric range this isshort/medium/long. For a keyword range (seeisKeyword()) the givenkeywordLabelis returned, or an em dash when it isnull/blank.- Parameters:
keywordLabel- the label to show for a keyword range (for exampleArtillery)- Returns:
- the display form
-
displayString
- Returns:
- the numeric display form, or an em dash for a keyword range with no label
-
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 with '=='. -
shortRange
public int shortRange()Returns the value of theshortRangerecord component.- Returns:
- the value of the
shortRangerecord component
-
mediumRange
public int mediumRange()Returns the value of themediumRangerecord component.- Returns:
- the value of the
mediumRangerecord component
-
longRange
public int longRange()Returns the value of thelongRangerecord component.- Returns:
- the value of the
longRangerecord component
-