modelling
Class SeeingAgent

java.lang.Object
  extended bysema.Element
      extended bysema.Agent
          extended bymodelling.SeeingAgent
All Implemented Interfaces:
java.lang.Comparable, Vision
Direct Known Subclasses:
AgentTestSeeing

public class SeeingAgent
extends Agent
implements Vision

Agent able to watch his environement.


Nested Class Summary
 
Nested classes inherited from class sema.Agent
Agent.Action
 
Nested classes inherited from class sema.Element
Element.ElementEvent
 
Field Summary
 
Fields inherited from class sema.Element
id, world
 
Constructor Summary
SeeingAgent(World world, Area area, float delay, java.awt.Image image, float visionRadius)
          Creates a new instance of seeing agent.
 
Method Summary
 boolean canSee(Element element)
          Determinates whether the given element can be seen by our agent, according to
protected  Area getAreaOfVision()
          Determinates the area where the element is watching.
protected  Area getLineVision(float angle)
           
 java.lang.String getName()
          Returns the name.
protected  float getVisionRadius()
          Returns the vision radius of the element.
 java.util.Vector watch()
          Returns the visible elements, with the restrictions of the vision ability.
 java.util.Vector watchFor(Selector sel)
          Returns the nearest element responding to the criterium induced by the given Selector
in the vision field of the agent.
 Element watchForNearest(Selector sel)
          Returns the nearest visible element fiting the given selector.
 Element watchNearest()
          Returns the nearest visible element
 
Methods inherited from class sema.Agent
acceptAction, getDelay, registerAction, setDelay, unregisterAction
 
Methods inherited from class sema.Element
canTake, compareTo, death, draw, getArea, getDrawingPriority, getHeight, getIcon, getImage, getKind, 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

SeeingAgent

public SeeingAgent(World world,
                   Area area,
                   float delay,
                   java.awt.Image image,
                   float visionRadius)
Creates a new instance of seeing agent.

Method Detail

getName

public java.lang.String getName()
Description copied from class: Element
Returns the name.

Overrides:
getName in class Element
Returns:
the name.

getVisionRadius

protected float getVisionRadius()
Returns the vision radius of the element.


getAreaOfVision

protected Area getAreaOfVision()
Determinates the area where the element is watching.


getLineVision

protected Area getLineVision(float angle)

canSee

public boolean canSee(Element element)
Determinates whether the given element can be seen by our agent, according to

Specified by:
canSee in interface Vision

watch

public java.util.Vector watch()
Returns the visible elements, with the restrictions of the vision ability.

Specified by:
watch in interface Vision

watchNearest

public Element watchNearest()
Returns the nearest visible element

Specified by:
watchNearest in interface Vision

watchFor

public java.util.Vector watchFor(Selector sel)
Returns the nearest element responding to the criterium induced by the given Selector
in the vision field of the agent.

Specified by:
watchFor in interface Vision

watchForNearest

public Element watchForNearest(Selector sel)
Returns the nearest visible element fiting the given selector.

Specified by:
watchForNearest in interface Vision