Package megamek.common
Record Class RulesRef
java.lang.Object
java.lang.Record
megamek.common.RulesRef
A structured reference to one page in a sourcebook. The page is
null when the source has no page reference.-
Constructor Summary
ConstructorsConstructorDescriptionRulesRef(SourceBookCode book, Integer page) Creates an instance of aRulesRefrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbook()Returns the value of thebookrecord component.final booleanIndicates whether some other object is "equal to" this one.static StringformatForDisplay(Collection<RulesRef> references) Formats references for display, separated by semicolons.final inthashCode()Returns a hash code value for this object.page()Returns the value of thepagerecord component.toString()Returns a string representation of this record class.
-
Constructor Details
-
RulesRef
Creates an instance of aRulesRefrecord class.- Parameters:
book- the value for thebookrecord componentpage- the value for thepagerecord component
-
-
Method Details
-
toDisplayString
- Returns:
- this reference formatted for display as
abbrev, page, or onlyabbrevwhen its page is unknown.
-
formatForDisplay
Formats references for display, separated by semicolons. -
toYamlData
- Returns:
- serializer-independent structured export data using the sourcebook abbreviation, not the enum name.
-
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). -
book
Returns the value of thebookrecord component.- Returns:
- the value of the
bookrecord component
-
page
Returns the value of thepagerecord component.- Returns:
- the value of the
pagerecord component
-