|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.ObjectsimuLCS.Entity
simuLCS.Agent
A basic Agent, placed randomly inside the Arena and moving randomly (no specific behaviour). It provides basic functions such as painting the Agent, erasing it,...
| Field Summary | |
protected Arena |
arena
Link to the Arena where the agent is placed. |
protected double |
heading
Angle which determines where the agent is heading |
protected java.awt.geom.Point2D |
oldcoord
Old coordinates (of the previous position). |
| Fields inherited from class simuLCS.Entity |
color_ext, color_int, coord, generator, name, paintName, size |
| Constructor Summary | |
Agent(java.util.Random gen,
Arena a)
Constructs an Agent placed randomly inside the Arena. |
|
Agent(java.util.Random gen,
Arena a,
java.lang.String name)
Constructs an Agent placed randomly inside the Arena with the name name. |
|
| Method Summary | |
void |
clear(java.awt.Graphics2D g)
Clear the drawing of the agent at the current coordinates. |
void |
clear(java.awt.Graphics2D g,
java.awt.geom.Point2D c)
Clear the drawing of the agent at the indicated coordinates (Basically, a white circle is drawn) |
Arena |
getArena()
Returns a pointer to the Arena where the Agent is placed. |
ClassifierSet |
getBehaviour()
For compatibility reasons, subclasses might implement an Agent whose behaviour is described by a ClassifierSet. |
ClassifierSet |
getBehaviour(int i)
Get the classifier set representing the behaviour of the Agent. |
java.awt.geom.Point2D |
getCoordNearTo(Entity otherEntity)
Return the closest point of the Agent to another Entity |
double |
getRadius()
Get the radius of the agent (which is a circle). |
boolean |
isDangerous()
By default, an Agent is not dangerous. |
boolean |
isMoving()
By default, an Agent is a moving entity. |
void |
move()
Move the agent randomly. |
void |
move(Arena a,
Entity[] others,
int nbagents,
java.awt.Graphics2D g)
Move the Agent by modifying its coordinates. |
void |
paint(java.awt.Graphics2D g)
Remove the drawing of the agent for the old coordinates and repaint the agent at its new coordinates (This avoids a blinking effect) |
java.lang.String |
toString()
Creates a String describing the Agent |
| Methods inherited from class simuLCS.Entity |
collideWithMe, distanceTo, getColor_ext, getColor_int, getCoord, getId, getName, getRadiusBody, getSize, isPaintName, setColor_ext, setColor_int, setName, setPaintName, setSize |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected double heading
protected Arena arena
protected java.awt.geom.Point2D oldcoord
paint(Graphics2D)| Constructor Detail |
public Agent(java.util.Random gen,
Arena a)
gen - The generator for the random numbersa - the Arena where to put the agentArena.isInside(double, double, double)
public Agent(java.util.Random gen,
Arena a,
java.lang.String name)
name.
gen - a - name - | Method Detail |
public double getRadius()
Entity.sizepublic void paint(java.awt.Graphics2D g)
paint in class EntityEntity#paint()
public void clear(java.awt.Graphics2D g,
java.awt.geom.Point2D c)
clear in class Entityg - Graphicsc - The coordinates where to clear the drawing of the agent.public void clear(java.awt.Graphics2D g)
g - Graphicsclear(Graphics2D, Point2D)public void move()
public void move(Arena a,
Entity[] others,
int nbagents,
java.awt.Graphics2D g)
move in class Entitya - The Arena inside which to moveg - GraphicsEntity.move(Arena, Entity[], int, Graphics2D)public Arena getArena()
public boolean isDangerous()
isDangerous in class Entitypublic boolean isMoving()
isMoving in class Entitypublic ClassifierSet getBehaviour()
AgentClassifier.behaviour,
ClassifierSetpublic ClassifierSet getBehaviour(int i)
i -
public java.awt.geom.Point2D getCoordNearTo(Entity otherEntity)
getCoordNearTo in class EntityEntity.getCoordNearTo(Entity)public java.lang.String toString()
toString in class Entity
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||