|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.holub.life.Resident
public final class Resident
The Resident class implements a single cell---a "resident" of a block.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface com.holub.life.Cell |
---|
Cell.Memento |
Field Summary |
---|
Fields inherited from interface com.holub.life.Cell |
---|
DUMMY, LOAD, STORE |
Constructor Summary | |
---|---|
Resident()
|
Method Summary | |
---|---|
void |
clear()
Set the cell and all subcells into a "dead" state. |
Cell |
create()
Return a fresh (newly created) object identical to yourself in content. |
Storable |
createMemento()
Mementos must be created by Neighborhood objects. |
Cell |
edge(int row,
int column)
This cell is monetary, so it's at every edge of itself. |
boolean |
figureNextState(Cell north,
Cell south,
Cell east,
Cell west,
Cell northeast,
Cell northwest,
Cell southeast,
Cell southwest)
figure the next state. |
boolean |
isAlive()
Return true if this cell or any subcells are alive. |
Direction |
isDisruptiveTo()
Returns a Direction indicated the directions of the cells that have changed state. |
void |
redraw(Graphics g,
Rectangle here,
boolean drawAll)
Redraw yourself in the indicated rectangle on the indicated Graphics object if ncessary. |
boolean |
transfer(Storable blob,
Point upperLeft,
boolean doLoad)
This method is used internally to save or restore the state of a cell from a memento. |
boolean |
transition()
Transition to the state computed by the most recent call to Cell.figureNextState(com.holub.life.Cell, com.holub.life.Cell, com.holub.life.Cell, com.holub.life.Cell, com.holub.life.Cell, com.holub.life.Cell, com.holub.life.Cell, com.holub.life.Cell) |
void |
userClicked(Point here,
Rectangle surface)
A user has clicked somewhere within you. |
int |
widthInCells()
Return the specified width plus the current cell's width |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Resident()
Method Detail |
---|
public boolean figureNextState(Cell north, Cell south, Cell east, Cell west, Cell northeast, Cell northwest, Cell southeast, Cell southwest)
figureNextState
in interface Cell
public Cell edge(int row, int column)
edge
in interface Cell
row
- The requested row. Must be on the edge of
the block.column
- The requested column. Must be on the edge
of the block.
public boolean transition()
Cell
Cell.figureNextState(com.holub.life.Cell, com.holub.life.Cell, com.holub.life.Cell, com.holub.life.Cell, com.holub.life.Cell, com.holub.life.Cell, com.holub.life.Cell, com.holub.life.Cell)
transition
in interface Cell
public void redraw(Graphics g, Rectangle here, boolean drawAll)
Cell
redraw
in interface Cell
g
- redraw using this graphics,here
- a rectangle that describes the bounds of the
current cell.drawAll
- if true, draw an entire compound cell;
otherwise, draw only the subcells that need to be redrawn.public void userClicked(Point here, Rectangle surface)
Cell
userClicked
in interface Cell
here
- The position of the click relative to the bounding
rectangle of the current Cell.public void clear()
Cell
clear
in interface Cell
public boolean isAlive()
Cell
isAlive
in interface Cell
public Cell create()
Cell
create
in interface Cell
public int widthInCells()
Cell
widthInCells
in interface Cell
public Direction isDisruptiveTo()
Cell
isDisruptiveTo
in interface Cell
public boolean transfer(Storable blob, Point upperLeft, boolean doLoad)
Cell
transfer
in interface Cell
public Storable createMemento()
createMemento
in interface Cell
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |