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 heat
totalHeat - 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 Details

    • HeatContribution

      public HeatContribution(int count, int totalHeat)
      Creates an instance of a HeatContribution record class.
      Parameters:
      count - the value for the count record component
      totalHeat - the value for the totalHeat record component
  • Method Details

    • plus

      public HeatBreakdown.HeatContribution plus(int heat)
      Parameters:
      heat - additional heat from one more application of this source
      Returns:
      a new contribution with the count incremented and the heat added
    • 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 '=='.
      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.
    • count

      public int count()
      Returns the value of the count record component.
      Returns:
      the value of the count record component
    • totalHeat

      public int totalHeat()
      Returns the value of the totalHeat record component.
      Returns:
      the value of the totalHeat record component