Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## uchicago.src.repastdemos.life
Class LifeAgent

    java.lang.Object
      uchicago.src.repastdemos.life.LifeAgent

All Implemented Interfaces:
  Drawable

    public class LifeAgent

extends java.lang.Object
implements Drawable

The agent in this implementation of Life. Its sole behavoir is to check if the number of its neighbors is > 3 or < 2 and die if so. Dying here is the removal of the agent from the Space. Note that this removal doesn't actually occur until every agent has performed this check. See LifeModel for more.

Constructor Summary
`LifeAgent(int x, int y, Space space)` Creates this LifeAgent with the specified coordinates and space.

Method Summary
`void` | `draw(SimGraphics g)` Invoked when the object should draw itself
`int` | `getX()` Gets the x coordinate of this drawable.
`int` | `getY()` Gets the y coordinate of the this drawable.
`void` | `step()` Check if the number of neighbors is > 3 or < 2 and die if so.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### LifeAgent

    public LifeAgent(int x,
                     int y,
                     Space space)

  Creates this LifeAgent with the specified coordinates and space.

Method Detail

### step

    public void step()

  Check if the number of neighbors is > 3 or < 2 and die if so. Die = remove from the space.

### getX

    public int getX()

  Description copied from interface: `Drawable`
  Gets the x coordinate of this drawable. Note that this should return the x coordinate in some space, not necessarily a screen coordinate.

  Specified by:
    `getX` in interface `Drawable`

### getY

    public int getY()

  Description copied from interface: `Drawable`
  Gets the y coordinate of the this drawable. Note that this should return the y coordinate in some space, not necessarily a screen coordinate.

  Specified by:
    `getY` in interface `Drawable`

### draw

    public void draw(SimGraphics g)

  Description copied from interface: `Drawable`
  Invoked when the object should draw itself

  Specified by:
    `draw` in interface `Drawable`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD