SudokuFX
Loading...
Searching...
No Matches
fr.softsf.sudokufx.model.Game Class Reference

Represents a Sudoku game instance stored in the database. More...

+ Collaboration diagram for fr.softsf.sudokufx.model.Game:

Classes

class  GameBuilder
 Builder class to create Game instances in a fluent style. More...
 

Public Member Functions

 Game (Long gameid, @Nonnull @NotNull Grid gridid, @Nonnull @NotNull Player playerid, @Nonnull @NotNull GameLevel levelid, boolean selected, @Nonnull @NotNull Instant createdat, @Nonnull @NotNull Instant updatedat)
 Full constructor initializing all fields of the game.
 
void detachFromPlayer ()
 Detaches this game from its current player.
 
boolean equals (Object o)
 Compares this game with another object for equality based on all fields.
 
Instant getCreatedat ()
 Returns the creation timestamp.
 
Long getGameid ()
 Returns the unique ID of the game.
 
Grid getGridid ()
 Returns the Grid associated with this game.
 
GameLevel getLevelid ()
 Returns the GameLevel of this game.
 
Player getPlayerid ()
 Returns the Player associated with this game.
 
boolean getSelected ()
 Returns whether the game is currently selected.
 
Instant getUpdatedat ()
 Returns the last update timestamp.
 
int hashCode ()
 Computes the hash code based on all fields.
 
void setPlayerid (@Nonnull Player playerid)
 Sets the player associated with this game.
 
void setSelected (boolean selected)
 Sets the selection state of this game.
 
void setUpdatedat (@Nonnull Instant updatedat)
 Updates the last modified timestamp.
 
String toString ()
 Returns a string representation of the game.
 

Static Public Member Functions

static GameBuilder builder ()
 Creates a new GameBuilder for fluent construction.
 

Protected Member Functions

 Game ()
 Protected default constructor for JPA.
 

Static Private Member Functions

static Instant validateCreatedAt (Instant createdat)
 Ensures that the creation timestamp is not null.
 
static Grid validateGrid (Grid grid)
 Ensures that the Grid is not null.
 
static GameLevel validateLevel (GameLevel level)
 Ensures that the GameLevel is not null.
 
static Player validatePlayer (Player player)
 Ensures that the Player is not null.
 
static Instant validateUpdatedAt (Instant updatedat)
 Ensures that the update timestamp is not null.
 

Private Attributes

Instant createdat = Instant.now()
 Timestamp when this game was created.
 
Long gameid
 Unique identifier of the game (primary key).
 
Grid gridid
 The grid associated with this game.
 
GameLevel levelid
 The difficulty level of this game.
 
Player playerid
 The player who owns this game.
 
boolean selected = false
 Whether this game is currently selected.
 
Instant updatedat = Instant.now()
 Timestamp when this game was last updated.
 

Static Private Attributes

static final String CREATEDAT_MUST_NOT_BE_NULL = "createdat must not be null"
 
static final String GRIDID_MUST_NOT_BE_NULL = "gridid must not be null"
 
static final String LEVELID_MUST_NOT_BE_NULL = "levelid must not be null"
 
static final String PLAYERID_MUST_NOT_BE_NULL = "playerid must not be null"
 
static final String UPDATEDAT_MUST_NOT_BE_NULL = "updatedat must not be null"
 

Detailed Description

Represents a Sudoku game instance stored in the database.

Contains references to the Grid, Player, and GameLevel. Tracks creation and update timestamps, selection state, and provides builders and validation methods.

Constructor & Destructor Documentation

◆ Game() [1/2]

fr.softsf.sudokufx.model.Game.Game ( )
protected

Protected default constructor for JPA.

+ Here is the call graph for this function:

◆ Game() [2/2]

fr.softsf.sudokufx.model.Game.Game ( Long gameid,
@Nonnull @NotNull Grid gridid,
@Nonnull @NotNull Player playerid,
@Nonnull @NotNull GameLevel levelid,
boolean selected,
@Nonnull @NotNull Instant createdat,
@Nonnull @NotNull Instant updatedat )

Full constructor initializing all fields of the game.

Parameters
gameidthe unique game ID
grididthe grid associated with this game
playeridthe player associated with this game
levelidthe game level
selectedwhether the game is selected
createdatcreation timestamp
updatedatlast update timestamp
+ Here is the call graph for this function:

Member Function Documentation

◆ builder()

static GameBuilder fr.softsf.sudokufx.model.Game.builder ( )
static

Creates a new GameBuilder for fluent construction.

◆ detachFromPlayer()

void fr.softsf.sudokufx.model.Game.detachFromPlayer ( )

Detaches this game from its current player.

◆ equals()

boolean fr.softsf.sudokufx.model.Game.equals ( Object o)

Compares this game with another object for equality based on all fields.

+ Here is the call graph for this function:

◆ getCreatedat()

Instant fr.softsf.sudokufx.model.Game.getCreatedat ( )

Returns the creation timestamp.

◆ getGameid()

Long fr.softsf.sudokufx.model.Game.getGameid ( )

Returns the unique ID of the game.

◆ getGridid()

Grid fr.softsf.sudokufx.model.Game.getGridid ( )

Returns the Grid associated with this game.

◆ getLevelid()

GameLevel fr.softsf.sudokufx.model.Game.getLevelid ( )

Returns the GameLevel of this game.

◆ getPlayerid()

Player fr.softsf.sudokufx.model.Game.getPlayerid ( )

Returns the Player associated with this game.

◆ getSelected()

boolean fr.softsf.sudokufx.model.Game.getSelected ( )

Returns whether the game is currently selected.

◆ getUpdatedat()

Instant fr.softsf.sudokufx.model.Game.getUpdatedat ( )

Returns the last update timestamp.

◆ hashCode()

int fr.softsf.sudokufx.model.Game.hashCode ( )

Computes the hash code based on all fields.

◆ setPlayerid()

void fr.softsf.sudokufx.model.Game.setPlayerid ( @Nonnull Player playerid)

Sets the player associated with this game.

+ Here is the call graph for this function:

◆ setSelected()

void fr.softsf.sudokufx.model.Game.setSelected ( boolean selected)

Sets the selection state of this game.

◆ setUpdatedat()

void fr.softsf.sudokufx.model.Game.setUpdatedat ( @Nonnull Instant updatedat)

Updates the last modified timestamp.

+ Here is the call graph for this function:

◆ toString()

String fr.softsf.sudokufx.model.Game.toString ( )

Returns a string representation of the game.

◆ validateCreatedAt()

static Instant fr.softsf.sudokufx.model.Game.validateCreatedAt ( Instant createdat)
staticprivate

Ensures that the creation timestamp is not null.

◆ validateGrid()

static Grid fr.softsf.sudokufx.model.Game.validateGrid ( Grid grid)
staticprivate

Ensures that the Grid is not null.

◆ validateLevel()

static GameLevel fr.softsf.sudokufx.model.Game.validateLevel ( GameLevel level)
staticprivate

Ensures that the GameLevel is not null.

◆ validatePlayer()

static Player fr.softsf.sudokufx.model.Game.validatePlayer ( Player player)
staticprivate

Ensures that the Player is not null.

◆ validateUpdatedAt()

static Instant fr.softsf.sudokufx.model.Game.validateUpdatedAt ( Instant updatedat)
staticprivate

Ensures that the update timestamp is not null.

Member Data Documentation

◆ createdat

Instant fr.softsf.sudokufx.model.Game.createdat = Instant.now()
private

Timestamp when this game was created.

◆ CREATEDAT_MUST_NOT_BE_NULL

final String fr.softsf.sudokufx.model.Game.CREATEDAT_MUST_NOT_BE_NULL = "createdat must not be null"
staticprivate

◆ gameid

Long fr.softsf.sudokufx.model.Game.gameid
private

Unique identifier of the game (primary key).

◆ gridid

Grid fr.softsf.sudokufx.model.Game.gridid
private

The grid associated with this game.

◆ GRIDID_MUST_NOT_BE_NULL

final String fr.softsf.sudokufx.model.Game.GRIDID_MUST_NOT_BE_NULL = "gridid must not be null"
staticprivate

◆ levelid

GameLevel fr.softsf.sudokufx.model.Game.levelid
private

The difficulty level of this game.

◆ LEVELID_MUST_NOT_BE_NULL

final String fr.softsf.sudokufx.model.Game.LEVELID_MUST_NOT_BE_NULL = "levelid must not be null"
staticprivate

◆ playerid

Player fr.softsf.sudokufx.model.Game.playerid
private

The player who owns this game.

◆ PLAYERID_MUST_NOT_BE_NULL

final String fr.softsf.sudokufx.model.Game.PLAYERID_MUST_NOT_BE_NULL = "playerid must not be null"
staticprivate

◆ selected

boolean fr.softsf.sudokufx.model.Game.selected = false
private

Whether this game is currently selected.

◆ updatedat

Instant fr.softsf.sudokufx.model.Game.updatedat = Instant.now()
private

Timestamp when this game was last updated.

◆ UPDATEDAT_MUST_NOT_BE_NULL

final String fr.softsf.sudokufx.model.Game.UPDATEDAT_MUST_NOT_BE_NULL = "updatedat must not be null"
staticprivate

The documentation for this class was generated from the following file: