Package it.polimi.ingsw.model
Class DFSHelper
java.lang.Object
it.polimi.ingsw.model.DFSHelper
helper class for the Depth First Search algorithm. Immutable
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
isIndexValid
(int x, int y) check if the index is in the matrixstatic boolean
isVisited
(int x, int y, int[][] mat) check if the node was already visited, otherwise visit the nodestatic void
resetVisitedMatrix
(int[][] mat) reset the matrix of the nodes visited in the DFS
-
Constructor Details
-
DFSHelper
public DFSHelper()
-
-
Method Details
-
resetVisitedMatrix
public static void resetVisitedMatrix(int[][] mat) reset the matrix of the nodes visited in the DFS- Parameters:
mat
- the matrix
-
isIndexValid
public static boolean isIndexValid(int x, int y) check if the index is in the matrix- Parameters:
x
- position xy
- posizione y- Returns:
- true iff the index is in the matrix
-
isVisited
public static boolean isVisited(int x, int y, int[][] mat) check if the node was already visited, otherwise visit the node- Parameters:
x
- position xy
- position ymat
- matrix of visited nodes- Returns:
- true iff the node was visited
-