public class Animal extends java.lang.Object implements Agent
The expectation is that this would be extended, but it is left non-abstract incase wanted for early model development.
Each animal has an x and y coordinate, plus a neighbourhood which could, for example, represent a perceived area.
Modifier and Type | Field and Description |
---|---|
private int |
adj
Trig result used for laying out the hexagonal neighbourhood.
|
protected java.util.ArrayList<Agent> |
agents
Reference to the agent list set up in Model.
|
private int |
neighbourhoodRadius
Neighbourhood 'radius'.
|
private int |
opp
Trig result used for laying out the hexagonal neighbourhood.
|
protected Environment |
world
Reference to the environment set up in Model.
|
protected int |
x
Spatial x coordinate.
|
protected int |
y
Spatial y coordinate.
|
Constructor and Description |
---|
Animal(Environment worldIn,
java.util.ArrayList<Agent> agentsIn)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
java.awt.Polygon |
getNeighbourhood()
Gets the hexagonal neighbourhood around the current location.
|
java.awt.Polygon |
getNeighbourhood(int x,
int y)
Gets a hexagonal neighbourhood around an arbitrary location.
|
int |
getX()
Gets the x coordinate.
|
int |
getY()
Gets the y coordinate.
|
void |
run()
Empty run method.
|
protected Environment world
protected java.util.ArrayList<Agent> agents
protected int x
protected int y
private int neighbourhoodRadius
private int opp
private int adj
public Animal(Environment worldIn, java.util.ArrayList<Agent> agentsIn)
worldIn
- environment for the modelagentsIn
- list of all the agents in the modelpublic int getX()
public int getY()
public java.awt.Polygon getNeighbourhood()
public java.awt.Polygon getNeighbourhood(int x, int y)
x
- the x location in the global coordinate systemy
- the y location in the global coordinate system