Record Class Minesweeper.RevealResult

java.lang.Object
java.lang.Record
net.flectone.pulse.module.command.minesweeper.model.Minesweeper.RevealResult
Record Components:
state - the game state after the move
cellsOpened - how many cells opened
hitMine - whether the move hit a mine
Enclosing class:
Minesweeper

public static record Minesweeper.RevealResult(Minesweeper.GameState state, int cellsOpened, boolean hitMine) extends Record
What one reveal did to the board.
  • Constructor Details

    • RevealResult

      public RevealResult(Minesweeper.GameState state, int cellsOpened, boolean hitMine)
      Creates an instance of a RevealResult record class.
      Parameters:
      state - the value for the state record component
      cellsOpened - the value for the cellsOpened record component
      hitMine - the value for the hitMine record component
  • Method Details

    • 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 the compare method from their corresponding wrapper classes.
      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.
    • state

      public Minesweeper.GameState state()
      Returns the value of the state record component.
      Returns:
      the value of the state record component
    • cellsOpened

      public int cellsOpened()
      Returns the value of the cellsOpened record component.
      Returns:
      the value of the cellsOpened record component
    • hitMine

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