|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--Grid
|
+--AppletGrid
| Field Summary | |
(package private) static int |
BLANK
value for the blank character |
(package private) static int |
BLOCKAGE
value for a blockage character |
static java.awt.Color |
blockColor
Color used in applet to draw blockage |
protected int |
cols
the number of columns of the Grid |
(package private) static int |
DESCbody
value for the DESC body character (used in a07) |
static java.awt.Color |
DESCbodyColor
Color used in applet to draw DESC body |
static java.awt.Color |
DESCendColor
Color used in applet to draw DESC end |
(package private) static int |
DESChead
value for the DESC head character (used in a07) |
static java.awt.Color |
gridColor
Color used in applet to draw Grid |
protected int |
rows
the number of rows of the Grid |
(package private) static int |
SPAM
value for the spam character |
static java.awt.Color |
spamColor
Color used in applet to draw spam |
protected Square[][] |
square
the Squares of the Grid |
| Constructor Summary | |
AppletGrid(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) void |
draw(java.awt.Graphics graphics,
int xOffset,
int yOffset,
int size)
Draw the grid in the Graphics, at a specified pair offsets and with a certain feature size. |
(package private) void |
drawBlockage(java.awt.Graphics graphics,
int x,
int y,
int size)
Draw blockage at the specified position. |
(package private) void |
drawDESCbodyCell(java.awt.Graphics graphics,
int x,
int y,
int size)
Draw a body cell of a DESC. |
(package private) void |
drawDESCendCell(java.awt.Graphics graphics,
int x,
int y,
int size)
Draw a end (head or tail) cell of a DESC. |
(package private) void |
drawSpam(java.awt.Graphics graphics,
int x,
int y,
int size)
Draw spam at the specified position. |
(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 |
public static java.awt.Color gridColor
public static java.awt.Color spamColor
public static java.awt.Color DESCendColor
public static java.awt.Color DESCbodyColor
public static java.awt.Color blockColor
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 |
public AppletGrid(Sample sample)
sample - the Sample specifying Grid size and contents| Method Detail |
void draw(java.awt.Graphics graphics,
int xOffset,
int yOffset,
int size)
void drawSpam(java.awt.Graphics graphics,
int x,
int y,
int size)
void drawBlockage(java.awt.Graphics graphics,
int x,
int y,
int size)
void drawDESCendCell(java.awt.Graphics graphics,
int x,
int y,
int size)
void drawDESCbodyCell(java.awt.Graphics graphics,
int x,
int y,
int size)
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 | |||||||||