Class ArgumentValidator
java.lang.Object
edu.ntnu.idi.idatt.model.validator.ArgumentValidator
Validator class for arguments passed to model constructors and methods.
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
boardAddTileValidator
(Tile tile) Validates the arguments for the addTile method in Board class.static void
boardGameCreateDiceValidator
(int diceCount) Validates the arguments for the createDice method in BoardGame class.static void
boardGameSetBoardValidator
(Board board) Validates the arguments for the setBoard method in BoardGame class.static void
Validates the arguments for the setCurrentPlayer method in BoardGame class.static void
boardGameSetPlayersValidator
(List<Player> players) Validates the arguments for the setPlayers method in the BoardGame class.static void
boardGetTileValidator
(int tileId, int tileCount) Validates the argument for the getTile method in Board class.static void
boardSetBackgroundValidator
(String background) Validates the arguments for the setBackground method in LadderGameBoard class.static void
boardSetDescriptionValidator
(String description) Validates the arguments for the setDescription method in Board class.static void
boardSetnameValidator
(String name) Validates the arguments for the setName method in Board class.static void
diceAddDiceValidator
(int numberOfDice) Validates the arguments for the addDice method in Dice class.static void
diceGetDieValueValidator
(int dieNumber, int dieCount) Validates the arguments for the getDieValue method in Dice class.static void
diceRollSingleDieValidator
(int dieNumber, int dieCount) Validates the arguments for the rollSingleDie method in Dice class.static void
dieSetValueValidator
(int value) Validates the arguments for the setValue method in Die class.static void
ladderGameBoardCreateTilesValidator
(int rows, int columns) Validates the arguments for the createTiles method in LadderGameBoard class.static void
ladderGameBoardSetPatternValidator
(String pattern) Validates the arguments for the setPattern method in LadderGameBoard class.static void
ladderGameBoardSetRowsAndColumnsValidator
(int[] rowsAndColumns) Validates the arguments for the setRowsAndColumns method in LadderGameBoard class.static void
Validates the arguments for the placeOnTile method in Player class.static void
ludoGameBoardCreateTilesValidator
(int rows, int columns) Validates the arguments for the populateTiles method in Board class.static void
ludoGameBoardSetBoardSizeValidator
(int boardSize) Validates the arguments for the setBoardSize method in LudoGameBoard class.static void
ludoGameBoardSetColorsValidator
(javafx.scene.paint.Color[] colors) Validates the arguments for the setColors method in LudoGameBoard class.static void
ludoGameBoardSetRowsAndColumnsValidator
(int[] rowsAndColumns) Validates the arguments for the setRowsAndColumns method in LudoGameBoard class.static void
ludoPlayerMoveTokenValidator
(int pieceId, Tile tile, LudoToken.TokenStatus status) Validates arguments for the moveToken method in LudoPlayer class.static void
playerSetColorHexValidator
(String colorHex) Validates the arguments for the setColorHex method in Player class.static void
playerSetNameValidator
(String name) Validates the arguments for the setName method in Player class.static void
playerSetPlayerTokenTypeValidator
(PlayerTokenType playerTokenType) Validates the arguments for the setPlayerTokenType method in Player class.static void
tileActionPerformValidator
(Player player, Board board) Validates the arguments for the perform method in LadderAction class.static void
tileActionSetDescriptionValidator
(String description) Validates the arguments for the setDescription method in TileAction class.static void
tileActionSetDestinationTileIdValidator
(int destinationTileId) Validates the arguments for the setDestinationTileId method in TileAction class.static void
tileActionSetIdentifierValidator
(String identifier) Validates the arguments for the setIdentifier method in TileAction class.static void
tileSetCoordinatesValidator
(int[] coordinates) Validates the arguments for the setCoordinates method in Tile class.static void
tileSetLandActionValidator
(TileAction landAction) Validates the arguments for the setLandAction method in Tile class.static void
tileSetNextTileIdValidator
(int currentTileId, int nextTileId) Validates the arguments for the setNextTileId method in Tile class.static void
tileSetTileIdValidator
(int tileId) Validates the arguments for the setTileId method in Tile class.
-
Method Details
-
dieSetValueValidator
public static void dieSetValueValidator(int value) Validates the arguments for the setValue method in Die class.- Parameters:
value
- the value to set- Throws:
IllegalArgumentException
- if value is less than 1 or greater than 6
-
diceGetDieValueValidator
public static void diceGetDieValueValidator(int dieNumber, int dieCount) Validates the arguments for the getDieValue method in Dice class.- Parameters:
dieNumber
- the number of the die to get the value ofdieCount
- the total number of dice- Throws:
IllegalArgumentException
- if dieNumber is less than 1 or greater than the given dieCount
-
diceAddDiceValidator
public static void diceAddDiceValidator(int numberOfDice) Validates the arguments for the addDice method in Dice class.- Parameters:
numberOfDice
- the number of dice to add- Throws:
IllegalArgumentException
- if numberOfDice is less than 1
-
diceRollSingleDieValidator
public static void diceRollSingleDieValidator(int dieNumber, int dieCount) Validates the arguments for the rollSingleDie method in Dice class.- Parameters:
dieNumber
- the number of the die to rolldieCount
- the total number of dice- Throws:
IllegalArgumentException
- if dieNumber is less than 1 or greater than the given dieCount
-
boardGetTileValidator
public static void boardGetTileValidator(int tileId, int tileCount) Validates the argument for the getTile method in Board class.- Parameters:
tileId
- the id of the tile to get- Throws:
IllegalArgumentException
- if tileId is less than 0 or greater than or equal to the number of tiles on the board
-
boardSetnameValidator
Validates the arguments for the setName method in Board class.- Parameters:
name
- the name to set- Throws:
IllegalArgumentException
- if name is null or blank
-
boardSetDescriptionValidator
Validates the arguments for the setDescription method in Board class.- Parameters:
description
- the description to set- Throws:
IllegalArgumentException
- if description is null or blank
-
boardSetBackgroundValidator
Validates the arguments for the setBackground method in LadderGameBoard class.- Parameters:
background
- the background to set- Throws:
IllegalArgumentException
- if background is null or blank
-
ludoGameBoardCreateTilesValidator
public static void ludoGameBoardCreateTilesValidator(int rows, int columns) Validates the arguments for the populateTiles method in Board class.- Parameters:
rows
- the number of rowscolumns
- the number of columns- Throws:
IllegalArgumentException
- if rows or columns is less than 1
-
boardAddTileValidator
Validates the arguments for the addTile method in Board class.- Parameters:
tile
- the tile to add- Throws:
IllegalArgumentException
- if tile is null or tile id is less than 0
-
ladderGameBoardSetRowsAndColumnsValidator
public static void ladderGameBoardSetRowsAndColumnsValidator(int[] rowsAndColumns) Validates the arguments for the setRowsAndColumns method in LadderGameBoard class.- Parameters:
rowsAndColumns
- the rows and columns to set- Throws:
IllegalArgumentException
- if rowsAndColumns is null
-
ladderGameBoardCreateTilesValidator
public static void ladderGameBoardCreateTilesValidator(int rows, int columns) Validates the arguments for the createTiles method in LadderGameBoard class.- Parameters:
rows
- the number of rowscolumns
- the number of columns- Throws:
IllegalArgumentException
- if rows or columns is less than 1
-
ladderGameBoardSetPatternValidator
Validates the arguments for the setPattern method in LadderGameBoard class.- Parameters:
pattern
- the pattern to set- Throws:
IllegalArgumentException
- if pattern is null or blank
-
ludoGameBoardSetRowsAndColumnsValidator
public static void ludoGameBoardSetRowsAndColumnsValidator(int[] rowsAndColumns) Validates the arguments for the setRowsAndColumns method in LudoGameBoard class.- Parameters:
rowsAndColumns
- the rows and columns to set- Throws:
IllegalArgumentException
- if rowsAndColumns is null or the rows and columns are not equal
-
ludoGameBoardSetColorsValidator
public static void ludoGameBoardSetColorsValidator(javafx.scene.paint.Color[] colors) Validates the arguments for the setColors method in LudoGameBoard class.- Parameters:
colors
- the colors to set- Throws:
IllegalArgumentException
- if colors is null
-
ludoGameBoardSetBoardSizeValidator
public static void ludoGameBoardSetBoardSizeValidator(int boardSize) Validates the arguments for the setBoardSize method in LudoGameBoard class.- Parameters:
boardSize
- the board size to set- Throws:
IllegalArgumentException
- if boardSize is less than 1
-
boardGameCreateDiceValidator
public static void boardGameCreateDiceValidator(int diceCount) Validates the arguments for the createDice method in BoardGame class.- Parameters:
diceCount
- the number of dice
-
boardGameSetCurrentPlayerValidator
Validates the arguments for the setCurrentPlayer method in BoardGame class.- Parameters:
player
- the player to set as current
-
boardGameSetBoardValidator
Validates the arguments for the setBoard method in BoardGame class.- Parameters:
board
- the board to set
-
boardGameSetPlayersValidator
Validates the arguments for the setPlayers method in the BoardGame class.- Parameters:
players
- the players to set.
-
tileActionSetDestinationTileIdValidator
public static void tileActionSetDestinationTileIdValidator(int destinationTileId) Validates the arguments for the setDestinationTileId method in TileAction class.- Parameters:
destinationTileId
- the id of the destination tile- Throws:
IllegalArgumentException
- if destinationTileId is less than 0
-
tileActionSetDescriptionValidator
Validates the arguments for the setDescription method in TileAction class.- Parameters:
description
- the description to set- Throws:
IllegalArgumentException
- if description is null or blank
-
tileActionSetIdentifierValidator
Validates the arguments for the setIdentifier method in TileAction class.- Parameters:
identifier
- the identifier to set- Throws:
IllegalArgumentException
- if identifier is null or blank
-
tileActionPerformValidator
Validates the arguments for the perform method in LadderAction class.- Parameters:
player
- the player to perform the action onboard
- the board to perform the action on- Throws:
IllegalArgumentException
- if player or board is null
-
playerSetNameValidator
Validates the arguments for the setName method in Player class.- Parameters:
name
- the name to set- Throws:
IllegalArgumentException
- if name is null or blank
-
playerSetColorHexValidator
Validates the arguments for the setColorHex method in Player class.- Parameters:
colorHex
- the color hex to set- Throws:
IllegalArgumentException
- if colorHex is null or blank
-
ladderGamePlayerPlaceOnTileValidator
Validates the arguments for the placeOnTile method in Player class.- Parameters:
tile
- the tile to place the player on- Throws:
IllegalArgumentException
- if tile is null
-
ludoPlayerMoveTokenValidator
public static void ludoPlayerMoveTokenValidator(int pieceId, Tile tile, LudoToken.TokenStatus status) Validates arguments for the moveToken method in LudoPlayer class.- Parameters:
pieceId
- The ID of the token/piece (1-4).tile
- The targetTile
(must not be null).status
- The newLudoToken.TokenStatus
(must not be null).- Throws:
IllegalArgumentException
- if any argument is invalid.
-
playerSetPlayerTokenTypeValidator
Validates the arguments for the setPlayerTokenType method in Player class.- Parameters:
playerTokenType
- the player token type to set- Throws:
IllegalArgumentException
- if playerTokenType is null
-
tileSetCoordinatesValidator
public static void tileSetCoordinatesValidator(int[] coordinates) Validates the arguments for the setCoordinates method in Tile class.- Parameters:
coordinates
- the coordinates to set- Throws:
IllegalArgumentException
- if coordinates is null
-
tileSetTileIdValidator
public static void tileSetTileIdValidator(int tileId) Validates the arguments for the setTileId method in Tile class.- Parameters:
tileId
- the id of the tile- Throws:
IllegalArgumentException
- if tileId is less than 0
-
tileSetNextTileIdValidator
public static void tileSetNextTileIdValidator(int currentTileId, int nextTileId) Validates the arguments for the setNextTileId method in Tile class.- Parameters:
currentTileId
- the tile id of the current tilenextTileId
- the tile id of the next tile- Throws:
IllegalArgumentException
- if nextTileId is less than 0
-
tileSetLandActionValidator
Validates the arguments for the setLandAction method in Tile class.- Parameters:
landAction
- the land action to set- Throws:
IllegalArgumentException
- if landAction is null
-