SudokuFX
Loading...
Searching...
No Matches
Package fr.softsf.sudokufx.common.util.sudoku

Classes

interface  GridConverter
 Component providing conversions between different Sudoku grid representations: More...
class  GridConverterUTest
interface  GridMaster
 Fournit les fonctionnalités essentielles pour générer et résoudre des grilles de Sudoku. More...
class  GridMasterUTest
class  GridViewModelUTest

Functions

record GrilleResolue (boolean solved, @Nonnull @NotNull(message="solvedGrid must not be null") @Size(min=CASES_NUMBER, max=CASES_NUMBER, message="solvedGrid must contain exactly 81 elements") int[] solvedGrid, @Min(value=0, message="possibilityPercentage must be >= 0") @Max(value=100, message="possibilityPercentage must be <= 100") int possibilityPercentage)
 Immutable record representing a Sudoku grid resolution result.
record GrillesCrees ( @Nonnull @NotNull(message="grilleResolue must not be null") @Size(min=81, max=81) int[] grilleResolue, @Nonnull @NotNull(message="grilleAResoudre must not be null") @Size(min=81, max=81) int[] grilleAResoudre, @Min(value=-1, message="possibilityPercentage must be >= -1") @Max(value=100, message="possibilityPercentage must be <= 100") int pourcentageDesPossibilites)
 Immutable record representing the dual output of a Sudoku grid generation.
record LevelPossibilityBounds (int min, int max)
 Immutable container for level-specific possibility boundaries.

Function Documentation

◆ GrilleResolue()

record fr.softsf.sudokufx.common.util.sudoku.GrilleResolue ( boolean solved,
@Nonnull @NotNull(message="solvedGrid must not be null") @Size(min=CASES_NUMBER, max=CASES_NUMBER, message="solvedGrid must contain exactly 81 elements") int[] solvedGrid,
@Min(value=0, message="possibilityPercentage must be >= 0") @Max(value=100, message="possibilityPercentage must be <= 100") int possibilityPercentage )

Immutable record representing a Sudoku grid resolution result.

Ensures data integrity through a fail-fast canonical constructor and defensive cloning to prevent representation exposure (SpotBugs EI_EXPOSE_REP).

Parameters
solvedTrue if the resolution was successful.
solvedGridNon-null array of {@value #CASES_NUMBER} elements [0-9].
possibilityPercentageResolution progress estimate (0-100).

Canonical constructor with deep validation and defensive cloning.

Performs a fail-fast check on solvedGrid integrity. Any violation (nullity, length, or range) is logged with a "██" marker before throwing an IllegalArgumentException.

Parameters
solvedResolution status.
solvedGridThe grid array to be cloned.
possibilityPercentageProgress percentage (0-100).
Exceptions
IllegalArgumentExceptionif solvedGrid is null, has an invalid length, or contains values outside the [0-9] range.

Returns a defensive copy of the solved grid.

Returns
A clone of solvedGrid.

Compares equality based on components and array content via Arrays#equals.

Parameters
oThe object to compare.
Returns
True if all components and grid contents are equal.

Returns a hash code based on all components and array content.

Returns
Content-based hash code.

Returns a string representation of the record, including the content of the grid.

Returns
String representation with array contents.
Here is the call graph for this function:

◆ GrillesCrees()

record fr.softsf.sudokufx.common.util.sudoku.GrillesCrees ( @Nonnull @NotNull(message="grilleResolue must not be null") @Size(min=81, max=81) int[] grilleResolue,
@Nonnull @NotNull(message="grilleAResoudre must not be null") @Size(min=81, max=81) int[] grilleAResoudre,
@Min(value=-1, message="possibilityPercentage must be >= -1") @Max(value=100, message="possibilityPercentage must be <= 100") int pourcentageDesPossibilites )

Immutable record representing the dual output of a Sudoku grid generation.

Holds both the complete solution and the initial puzzle state. Ensures state integrity through a fail-fast canonical constructor and defensive cloning of internal arrays to prevent representation exposure (SpotBugs EI_EXPOSE_REP).

Parameters
grilleResolueThe fully solved Sudoku grid (81 elements, values 0-9).
grilleAResoudreThe initial puzzle grid with holes (81 elements, values 0-9).
pourcentageDesPossibilitesResolution progress or difficulty estimate (0-100), or -1 if the grid generation failed (e.g., watchdog timeout).

Canonical constructor with deep validation and defensive cloning.

Validates both grids for nullity, length, and value ranges. Logs failures with a "██" marker before throwing IllegalArgumentException.

Parameters
grilleResolueThe solved grid to be cloned.
grilleAResoudreThe puzzle grid to be cloned.
pourcentageDesPossibilitesProgress percentage.
Exceptions
IllegalArgumentExceptionif any grid validation fails.

Performs fail-fast validation on a grid array.

Parameters
gridThe array to validate.
fieldNameName of the field for error reporting.

Returns a defensive copy of the solved grid.

Returns
A clone of grilleResolue.

Returns a defensive copy of the puzzle grid.

Returns
A clone of grilleAResoudre.

Compares equality based on components and array contents via Arrays#equals.

Parameters
oThe object to compare with this instance.
Returns
true if both records hold equivalent data and array contents.

Returns a hash code based on all components and array contents.

Returns
Content-based hash code.

Returns a string representation including array contents via Arrays#toString.

Returns
Formatted string containing all fields and grid values.
Here is the call graph for this function:

◆ LevelPossibilityBounds()

record fr.softsf.sudokufx.common.util.sudoku.LevelPossibilityBounds ( int min,
int max )

Immutable container for level-specific possibility boundaries.

Parameters
minthe lower bound of the current level
maxthe upper bound of the current level