public static class Grid.BoundedGridValidityChecker extends java.lang.Object implements Grid.ValidityChecker
BoundedGridValidityChecker
implements a strategy for
determining the validity of a location in a bounded grid.Constructor and Description |
---|
BoundedGridValidityChecker(int rows,
int cols)
Constructs a
BoundedGridValidityChecker object. |
Modifier and Type | Method and Description |
---|---|
boolean |
isValid(Location loc)
Verifies whether a location is valid.
|
public BoundedGridValidityChecker(int rows, int cols)
BoundedGridValidityChecker
object.
(Precondition: rows > 0
and cols > 0
.)rows
- number of rows in the gridcols
- number of columns in the gridpublic boolean isValid(Location loc)
isValid
in interface Grid.ValidityChecker
loc
- location to checktrue
if loc
is valid;
false
otherwise