Package megamek.common.units
Record Class HeatBreakdown.HeatContribution
java.lang.Object
java.lang.Record
megamek.common.units.HeatBreakdown.HeatContribution
- Record Components:
count- the number of times this source applied heattotalHeat- the signed total heat this source added
- All Implemented Interfaces:
Serializable
- Enclosing class:
HeatBreakdown
public static record HeatBreakdown.HeatContribution(int count, int totalHeat)
extends Record
implements Serializable
One labelled heat-buildup contribution: how many times the source applied heat this turn (e.g. the number of
weapons of that type that fired) and the signed total it added.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionHeatContribution(int count, int totalHeat) Creates an instance of aHeatContributionrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintcount()Returns the value of thecountrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.plus(int heat) final StringtoString()Returns a string representation of this record class.intReturns the value of thetotalHeatrecord component.
-
Constructor Details
-
Method Details
-
plus
- Parameters:
heat- additional heat from one more application of this source- Returns:
- a new contribution with the count incremented and the heat added
-
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 '=='. -
count
public int count()Returns the value of thecountrecord component.- Returns:
- the value of the
countrecord component
-
totalHeat
public int totalHeat()Returns the value of thetotalHeatrecord component.- Returns:
- the value of the
totalHeatrecord component
-