public class Vision extends Object implements IWorldObjectListener<IViewable>
Constructor and Description |
---|
Vision(IWorldView worldView,
IAgentLogger logger) |
Modifier and Type | Method and Description |
---|---|
protected <T> Map<WorldObjectId,T> |
addNewObjectCategory(Class<T> cls)
Used to introduce new object category into worldObjects and immutableWorldObjects.
|
protected void |
addSeeObject(IWorldObject seeObject)
Method that adds a new world object to the object maps.
|
Map<Class,Map<WorldObjectId,IWorldObject>> |
getSee()
Returns map of all objects the agent can currently see.
|
<T> Map<WorldObjectId,T> |
getSee(Class<T> type)
Returns map map of all objects of a certain type the agent can currently see.
|
IWorldObject |
getSee(WorldObjectId id)
If agents sees item of 'id' it returns it instances, otherwise it returns null.
|
protected IWorldObject |
getSeeObject(WorldObjectId objectId)
Returns world object of the given id or null if the object is not yet in the world view.
|
void |
notify(IWorldObjectEvent<IViewable> event) |
protected void |
removeSeeObject(IWorldObject worldObject)
Removes world object from the world view - this will be called from the descendants
of the AbstractWorldView whenever world object should disappear from the world view.
|
@Inject public Vision(IWorldView worldView, IAgentLogger logger)
public void notify(IWorldObjectEvent<IViewable> event)
notify
in interface cz.cuni.amis.utils.listener.IListener<IWorldObjectEvent<IViewable>>
protected <T> Map<WorldObjectId,T> addNewObjectCategory(Class<T> cls)
It will create new synchronized Map<IWorldViewObjectId, T> in the worldObjects and it's immutable counterpart in immutableWorldObjects under key of 'cls'.
Returns modifiable version of created map.
T
- cls
- protected void addSeeObject(IWorldObject seeObject)
worldObject
- protected IWorldObject getSeeObject(WorldObjectId objectId)
objectId
- protected void removeSeeObject(IWorldObject worldObject)
worldObject
- public Map<Class,Map<WorldObjectId,IWorldObject>> getSee()
WARNING: returns immutable map!
public <T> Map<WorldObjectId,T> getSee(Class<T> type)
WARNING: returns immutable map!
type
- public IWorldObject getSee(WorldObjectId id)
id
- Copyright © 2012 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.