Record Class Minesweeper.CellView
java.lang.Object
java.lang.Record
net.flectone.pulse.module.command.minesweeper.model.Minesweeper.CellView
- Record Components:
row- the rowcolumn- the columnrevealed- whether it has been openedflagged- whether the player flagged itmine- whether it holds a mineadjacentMines- how many mines touch it
- Enclosing class:
Minesweeper
public static record Minesweeper.CellView(int row, int column, boolean revealed, boolean flagged, boolean mine, int adjacentMines)
extends Record
One cell as the renderer sees it.
-
Constructor Summary
ConstructorsConstructorDescriptionCellView(int row, int column, boolean revealed, boolean flagged, boolean mine, int adjacentMines) Creates an instance of aCellViewrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the value of theadjacentMinesrecord component.intcolumn()Returns the value of thecolumnrecord component.final booleanIndicates whether some other object is "equal to" this one.booleanflagged()Returns the value of theflaggedrecord component.final inthashCode()Returns a hash code value for this object.booleanisEmpty()Whether nothing has been revealed yet, which means the mines are not laid.booleanmine()Returns the value of theminerecord component.booleanrevealed()Returns the value of therevealedrecord component.introw()Returns the value of therowrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
CellView
public CellView(int row, int column, boolean revealed, boolean flagged, boolean mine, int adjacentMines) Creates an instance of aCellViewrecord class.- Parameters:
row- the value for therowrecord componentcolumn- the value for thecolumnrecord componentrevealed- the value for therevealedrecord componentflagged- the value for theflaggedrecord componentmine- the value for theminerecord componentadjacentMines- the value for theadjacentMinesrecord component
-
-
Method Details
-
isEmpty
public boolean isEmpty()Whether nothing has been revealed yet, which means the mines are not laid.- Returns:
- true if the board is untouched
-
toString
-
hashCode
-
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 thecomparemethod from their corresponding wrapper classes. -
row
-
column
-
revealed
-
flagged
-
mine
-
adjacentMines
public int adjacentMines()Returns the value of theadjacentMinesrecord component.- Returns:
- the value of the
adjacentMinesrecord component
-