|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectsema.Element
sema.Agent
Basic agent, designed to easily model specific behaviours.
Extends Element and contains the fundamental nested Agent.Action class.
This Agent class is the basic shape for every agent able to undertake actions.
| Nested Class Summary | |
class |
Agent.Action
Basic action of an agent. |
| Nested classes inherited from class sema.Element |
Element.ElementEvent |
| Field Summary |
| Fields inherited from class sema.Element |
id, world |
| Constructor Summary | |
Agent(World world,
Area area,
float delay,
java.awt.Image image)
Creates a new agent in the specified world, and registers it to this world. |
|
| Method Summary | |
protected boolean |
acceptAction(Agent.Action action)
Global internal heuristic method of decision as to the actions to undertake. |
float |
getDelay()
Returns the caracteristic delay of the agent. |
protected void |
registerAction(Agent.Action a)
Registers an action. |
protected void |
setDelay(float delay)
Sets the caracteristic delay of the agent. |
protected void |
unregisterAction(Agent.Action a)
Unregisters an action. |
| Methods inherited from class sema.Element |
canTake, compareTo, death, draw, getArea, getDrawingPriority, getHeight, getIcon, getImage, getKind, getName, getProperties, highlight, highlight, isMarked, kill, setDrawingPriority, setHeight, setKind, setMarked, setProperties, toString, union |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public Agent(World world,
Area area,
float delay,
java.awt.Image image)
world - the world which it has to register to.area - the area of its body on the map.delay - the caracteristic delay.image - the main image of the element (also used as an identity icon).Area| Method Detail |
public float getDelay()
protected void setDelay(float delay)
delay - the caracteristic delay of the agent. (must be >=0)protected void registerAction(Agent.Action a)
acceptAction(Agent.Action).
a - the action to register.protected void unregisterAction(Agent.Action a)
a - the action to unregister.protected boolean acceptAction(Agent.Action action)
Agent.Action.whenRefused() method is called
and the action who called acceptAction is killed.
This method has an overwhelming power of decision on the action,
which cannot ignore this decision.
The default acceptAction method always returns true.
It's designed to provide an easy-to-use main decision function to manage actions.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||