Package webb.shared.dtos.puzzle
Class PuzzleLevelDTO
java.lang.Object
webb.shared.dtos.puzzle.created.CreatePuzzleLevelDTO
webb.shared.dtos.puzzle.updated.UpdatePuzzleLevelDTO
webb.shared.dtos.puzzle.PuzzleLevelDTO
Represents a puzzle from the JSON file.
Modified from: https://cs.plu.edu/courses/protected/cs390/2023s/project/iteration2.html
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class webb.shared.dtos.puzzle.updated.UpdatePuzzleLevelDTO
getSolvedByNumPlayers, setSolvedByNumPlayersMethods inherited from class webb.shared.dtos.puzzle.created.CreatePuzzleLevelDTO
getGridSize, getNumStars, getRegions, getSolution, getTotalStars
-
Constructor Details
-
PuzzleLevelDTO
public PuzzleLevelDTO(int id, List<List<CellDTO>> regions, List<CellDTO> solution, int gridSize, int numStars, int solvedByNumPlayers) PuzzleLevelDTO constructor- Parameters:
id- the id of the puzzleregions- the regions of the puzzlesolution- the solution to the puzzlegridSize- the size of the gridnumStars- the number of stars per regionsolvedByNumPlayers- the number of players who have solved the puzzle
-
-
Method Details
-
getId
public int getId()- Returns:
- the id of the puzzle
-
fromJSON
Creates a PuzzleDTO from a JSON file- Parameters:
jsonFile- the JSON file- Returns:
- the PuzzleDTO object
- Throws:
IOException- if the file cannot be read
-
toString
- Overrides:
toStringin classUpdatePuzzleLevelDTO
-