|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--Grid
| Field Summary | |
(package private) static int |
BLANK
value for the blank character |
(package private) static int |
BLOCKAGE
value for a blockage character |
protected int |
cols
the number of columns of the Grid |
(package private) static int |
DESCbody
value for the DESC body character (used in a07) |
(package private) static int |
DESChead
value for the DESC head character (used in a07) |
protected int |
rows
the number of rows of the Grid |
(package private) static int |
SPAM
value for the spam character |
protected Square[][] |
square
the Squares of the Grid |
| Constructor Summary | |
(package private) |
Grid(int rows,
int cols)
Construct a grid of a given size. |
(package private) |
Grid(Sample sample)
Construct a grid from a Sample, which includes the relevant size information and spam settins. |
| Method Summary | |
(package private) boolean |
clear(Pair pair)
Set the contents of a Square to blank |
(package private) void |
clearParents()
Clear all parents in preparation for a search. |
(package private) boolean |
contains(int row,
int col,
int v)
Determine whether a Square contains specified contents. |
(package private) int |
get(int row,
int col)
Get the contents of a Square |
(package private) Pair |
getParent(Pair pair)
Get the parent of a Square located at a particular Pair of coordinates. |
(package private) Square |
getSquare(Pair pair)
Get the Square located at a particular Pair of coordinates. |
boolean |
hasDESC(int row,
int col)
Check whether a Square has a DESC end or body cell. |
boolean |
hasDESCbody(int row,
int col)
Check whether a Square has a DESC body cell. |
boolean |
hasDESCend(int row,
int col)
Check whether a Square has a DESC end cell. |
boolean |
hasSpam(int row,
int col)
Indicate whether a particular Square has spam. |
(package private) void |
initialize()
Construct the Squares of the Grid and initialize them. |
(package private) boolean |
inRange(int row,
int col)
Check whether a Square is within the Grid. |
boolean |
isBlank(int row,
int col)
Indicate whether a particular Square is blank. |
(package private) boolean |
isBlocked(int row,
int col)
Determine whether a Square has a blockage |
(package private) boolean |
isMarked(int row,
int col)
Determine whether a Square has been visited during a search |
(package private) boolean |
set(int row,
int col,
int v)
Set the contents of a Square, after first checking that it is in range. |
(package private) boolean |
set(Pair pair,
int v)
Set the contents of a Square, after first checking that it is in range. |
boolean |
setBlank(int row,
int col)
Make a Square of the grid blank. |
void |
setList(java.util.Enumeration pairs,
int value)
Set value on squares indexed by Pairs from an enumeration. |
(package private) void |
setParent(int row,
int col,
Pair parent)
Set coordinates of the parent of a Square |
(package private) void |
setParent(Pair current,
Pair parent)
Set coordinates of the parent of a Square |
boolean |
setToBody(Pair pair)
Set a Square of show a DESC body. |
boolean |
setToEnd(Pair pair)
Set a Square of show a DESC end. |
java.lang.String |
toString()
Return a String representation of this Grid. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
static final int BLANK
static final int SPAM
static final int BLOCKAGE
static final int DESChead
static final int DESCbody
protected int rows
protected int cols
protected Square[][] square
| Constructor Detail |
Grid(int rows,
int cols)
rows - the number of rowscols - the number of columnsGrid(Sample sample)
sample - the Sample specifying Grid size and contents| Method Detail |
public void setList(java.util.Enumeration pairs,
int value)
pairs - the enumeration of Pairs given
public boolean hasSpam(int row,
int col)
row - row to be checkedcol - column to be checked
public boolean setBlank(int row,
int col)
row - row of the Squarecol - column of the Squarepublic boolean setToEnd(Pair pair)
public boolean setToBody(Pair pair)
boolean inRange(int row,
int col)
row - row of the Squarecol - column of the Square
public boolean hasDESC(int row,
int col)
row - row of the Squarecol - column of the Square
public boolean hasDESCend(int row,
int col)
row - row of the Squarecol - column of the Square
public boolean hasDESCbody(int row,
int col)
row - row of the Squarecol - column of the Square
public boolean isBlank(int row,
int col)
row - row to be checkedcol - column to be checked
int get(int row,
int col)
row - row of the Squarecol - column of the Square
boolean set(int row,
int col,
int v)
row - row of the Squarecol - column of the Square
boolean set(Pair pair,
int v)
pair - coordinate pair of the Square
void setParent(Pair current,
Pair parent)
current - coordinates pair of the Squareparent - coordinates of the parent of the Square
void setParent(int row,
int col,
Pair parent)
row - row of the squarecol - column of the squareparent - coordinates of the parent of the Squareboolean clear(Pair pair)
boolean contains(int row,
int col,
int v)
row - the row of the squarecol - the column of the square
boolean isMarked(int row,
int col)
row - the row of the squarecol - the column of the square
boolean isBlocked(int row,
int col)
row - the row of the squarecol - the column of the square
void initialize()
void clearParents()
public java.lang.String toString()
toString in class java.lang.ObjectSquare getSquare(Pair pair)
Pair getParent(Pair pair)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||