org.jscience.computing.ai.cellularautomaton
Class CAAgent

java.lang.Object
  extended by org.jscience.computing.ai.cellularautomaton.CAAgent
Direct Known Subclasses:
DirectedCAAgent

public class CAAgent
extends java.lang.Object

Implements a simple CA agent to be used with CellularAutomataLayered, where the CA agent is an embodied entity within the CA world.


Field Summary
 int dataInteger
          An integer to be used at programmer's discretion.
protected  int pos_x
          The x-position.
protected  int pos_y
          The y-position.
protected  int state
          The agent state.
 
Constructor Summary
CAAgent()
          Default constructor.
CAAgent(int x, int y)
          Creates a CA2DInfo instance with positional information.
CAAgent(int x, int y, int s)
          Creates a CA2DInfo instance with positional and state information.
 
Method Summary
 int getState()
          DOCUMENT ME!
 int getX()
          DOCUMENT ME!
 int getY()
          DOCUMENT ME!
 void setPosition(int x, int y)
          Set the position of this CA.
 void setState(int s)
          Set the state of this CA.
 void setX(int x)
          Set only the X-position.
 void setY(int y)
          Set only the Y-position.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dataInteger

public int dataInteger
An integer to be used at programmer's discretion.


pos_x

protected int pos_x
The x-position.


pos_y

protected int pos_y
The y-position.


state

protected int state
The agent state.

Constructor Detail

CAAgent

public CAAgent()
Default constructor. Positional and state variables are initialized to -1.


CAAgent

public CAAgent(int x,
               int y)
Creates a CA2DInfo instance with positional information.

Parameters:
x - X-position.
y - Y-position.

CAAgent

public CAAgent(int x,
               int y,
               int s)
Creates a CA2DInfo instance with positional and state information.

Parameters:
x - X-position.
y - Y-position.
s - cell state.
Method Detail

setPosition

public void setPosition(int x,
                        int y)
Set the position of this CA.

Parameters:
x - X-position to set.
y - Y-position to set.

setState

public void setState(int s)
Set the state of this CA.

Parameters:
s - this cell state.

setX

public void setX(int x)
Set only the X-position.

Parameters:
x - this cell's new X-position.

setY

public void setY(int y)
Set only the Y-position.

Parameters:
y - this cell's new Y-position.

getX

public int getX()
DOCUMENT ME!

Returns:
retrieve the X-position of the cell.

getY

public int getY()
DOCUMENT ME!

Returns:
retrieve the Y-position of the cell.

getState

public int getState()
DOCUMENT ME!

Returns:
retrieve the state of the cell.