public class VLBoundedEnv extends UnboundedEnv { private int numberOfRows; private int numberOfCols; public VLBoundedEnv(int rows, int cols) { // Construct and initialize the inherited attributes super(); numberOfRows = rows; numberOfCols = cols; } public int numRows() { return numberOfRows; } public int numCols() { return numberOfCols; } public boolean isValid(Location loc) { if ( loc == null ) return false; return (0 <= loc.row() && loc.row() < numRows()) && (0 <= loc.col() && loc.col() < numCols()); } }