Record Class FiringSolution

java.lang.Object
java.lang.Record
megamek.common.util.FiringSolution

public record FiringSolution(ToHitData toHit, boolean targetSpotted) extends Record
Used to track data for displaying "FiringSolution" data in the BoardView. This contains information about to-hit numbers and any other useful information for determining what units to are the best to shoot at.
  • Constructor Details

    • FiringSolution

      public FiringSolution(ToHitData toHit, boolean targetSpotted)
      Creates an instance of a FiringSolution record class.
      Parameters:
      toHit - the value for the toHit record component
      targetSpotted - the value for the targetSpotted record component
  • Method Details

    • getToHitData

      public ToHitData getToHitData()
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components 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.
    • toHit

      public ToHitData toHit()
      Returns the value of the toHit record component.
      Returns:
      the value of the toHit record component
    • targetSpotted

      public boolean targetSpotted()
      Returns the value of the targetSpotted record component.
      Returns:
      the value of the targetSpotted record component