|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Polygon | +--Contest1.Cell
Cell is a class that represents a triangular cell on the game board.
Inner classes inherited from class java.awt.Polygon |
Polygon.PolygonPathIterator |
Field Summary | |
private boolean |
isalive
The state of this cell. |
private int[][] |
neighbors
Triangles have 12 neighbors. |
(package private) boolean |
point_up
Tells whether this triangle is situated on baord with its point up or down. |
private byte[] |
pointDownNeighborCol
The offset column indicies for "point down" neighbors. |
private byte[] |
pointDownNeighborRow
The offset row indicies for "point down" neighbors. |
private byte[] |
pointUpNeighborCol
The offset column indicies for "point up" neighbors. |
private byte[] |
pointUpNeighborRow
The offset row indicies for "point up" neighbors. |
Fields inherited from class java.awt.Polygon |
bounds,
npoints,
serialVersionUID,
xpoints,
ypoints |
Constructor Summary | |
(package private) |
Cell(int row_index,
int col_index,
Point p,
Dimension d,
boolean point_up)
Constructor for a triangularly shaped cell. |
Method Summary | |
private void |
assignNeighbors(int row,
int col)
Assigns the neighbors of this cell. |
(package private) void |
changeState()
Switch the boolean state of cell's isalive value. |
(package private) void |
die()
Sets the value of cell's isalive variable to false . |
(package private) int[][] |
getNeighbors()
Gets the cell's neighbors. |
(package private) boolean |
isAlive()
Returns value of isalive variable. |
(package private) void |
live()
Sets value of cell's isalive variable to true, . |
Methods inherited from class java.awt.Polygon |
addPoint,
calculateBounds,
contains,
contains,
contains,
contains,
contains,
contains,
getBoundingBox,
getBounds,
getBounds2D,
getPathIterator,
getPathIterator,
inside,
intersects,
intersects,
translate,
updateBounds |
Methods inherited from class java.lang.Object |
|
Field Detail |
private boolean isalive
boolean point_up
private int[][] neighbors
private byte[] pointUpNeighborRow
private byte[] pointUpNeighborCol
private byte[] pointDownNeighborRow
private byte[] pointDownNeighborCol
Constructor Detail |
Cell(int row_index, int col_index, Point p, Dimension d, boolean point_up)
row_index
- row index of the boardcol_index
- column index of the boardp
- Point object specifying first vertext of triangled
- Dimesnion object specifying width and height of cellpoint_up
- true
if this triangle cell should point "up"
false
if should point down.Point
,
Dimension
Method Detail |
boolean isAlive()
true
if cell is alive, false
otherwisevoid die()
false
.void live()
true,
.void changeState()
int[][] getNeighbors()
private void assignNeighbors(int row, int col)
row
- row index of the cell for which to determine neighbors.col
- column index of the cell for which to determine neighbors.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |