cz.cuni.amis.pogamut.base3d.worldview.impl
Class VisionWorldView

java.lang.Object
  extended by cz.cuni.amis.pogamut.base.communication.worldview.impl.AbstractWorldView
      extended by cz.cuni.amis.pogamut.base.communication.worldview.impl.EventDrivenWorldView
          extended by cz.cuni.amis.pogamut.base3d.worldview.impl.VisionWorldView
All Implemented Interfaces:
IWorldChangeEventInput, IWorldView, IComponent, IVisionWorldView
Direct Known Subclasses:
BatchAwareWorldView

public class VisionWorldView
extends EventDrivenWorldView
implements IVisionWorldView


Field Summary
static java.lang.String WORLDVIEW_DEPENDENCY
           
 
Fields inherited from class cz.cuni.amis.pogamut.base.communication.worldview.impl.EventDrivenWorldView
notifyEventsList, receiveEventProcessing
 
Fields inherited from class cz.cuni.amis.pogamut.base.communication.worldview.impl.AbstractWorldView
COMPONENT_ID, control, controller, eventBus, log
 
Constructor Summary
VisionWorldView(ComponentDependencies dependencies, IComponentBus bus, IAgentLogger log)
           
 
Method Summary
protected  void addVisibleObject(IViewable worldObject)
          Method that adds a world object to the visible object maps.
protected  void cleanUp()
          Cleans up internal data structures, called from start/stop/kill/reset methods.
 java.util.Map<java.lang.Class,java.util.Map<WorldObjectId,IViewable>> getAllVisible()
          Returns map of all visible objects (IViewable instances} - those that the agent can currently see.
<T extends IViewable>
java.util.Map<WorldObjectId,T>
getAllVisible(java.lang.Class<T> type)
          Returns map of all visible objects (IViewable instances} - those that the agent can currently see.
 java.util.Map<WorldObjectId,IViewable> getVisible()
          Returns map of all visible objects (IViewable instances} organized according to their WorldObjectId - those that the agent can currently see.
 IViewable getVisible(WorldObjectId id)
          Returns a visible world object of the specific id (if exists inside the world view and is visible).
protected  void objectAppeared(IViewable obj)
          Called whenever the object appears in the agent's FOV.
protected  void objectCreated(IWorldObject obj)
          Additionally, it provides handling of IViewable objects raising WorldObjectAppearedEvent automatically (if object is visible).
protected  void objectDestroyed(IWorldObject obj)
          Additionally it handles IViewable objects automatically raising WorldObjectDisappearedEvent if object was visible before it was destroyed.
protected  void objectDisappeared(IViewable obj)
          Called whenever the object disappears from the agent's FOV.
protected  void objectUpdatedEvent(IWorldObjectUpdatedEvent updateEvent)
          It additionally handles IViewable objects automatically raising WorldObjectAppearedEvent and WorldObjectDisappearedEvent.
protected  void removeVisibleObject(IViewable worldObject)
          Removes world object from the visible world maps.
 
Methods inherited from class cz.cuni.amis.pogamut.base.communication.worldview.impl.EventDrivenWorldView
innerNotify, notify, notifyImmediately, objectUpdated, raiseEvent
 
Methods inherited from class cz.cuni.amis.pogamut.base.communication.worldview.impl.AbstractWorldView
addEventListener, addObjectListener, addObjectListener, addObjectListener, addObjectListener, addWorldObject, get, get, getAll, getAll, getComponentId, getEventBus, getLog, getSingle, isListening, isListening, isListening, isListening, isListening, isListening, isPaused, isRunning, kill, pause, prePause, preStop, removeEventListener, removeListener, removeObjectListener, removeObjectListener, removeObjectListener, removeObjectListener, removeWorldObject, reset, resume, start, stop, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface cz.cuni.amis.pogamut.base.communication.worldview.IWorldView
addEventListener, addObjectListener, addObjectListener, addObjectListener, addObjectListener, get, get, getAll, getAll, getEventBus, getSingle, isListening, isListening, isListening, isListening, isListening, isListening, removeEventListener, removeListener, removeObjectListener, removeObjectListener, removeObjectListener, removeObjectListener
 
Methods inherited from interface cz.cuni.amis.pogamut.base.communication.worldview.IWorldChangeEventInput
notify, notifyImmediately
 
Methods inherited from interface cz.cuni.amis.pogamut.base.component.IComponent
getComponentId
 

Field Detail

WORLDVIEW_DEPENDENCY

public static final java.lang.String WORLDVIEW_DEPENDENCY
See Also:
Constant Field Values
Constructor Detail

VisionWorldView

public VisionWorldView(ComponentDependencies dependencies,
                       IComponentBus bus,
                       IAgentLogger log)
Method Detail

cleanUp

protected void cleanUp()
Description copied from class: AbstractWorldView
Cleans up internal data structures, called from start/stop/kill/reset methods.

If you override this method, do not forget to call super.cleanUp().

Overrides:
cleanUp in class AbstractWorldView

getAllVisible

public java.util.Map<java.lang.Class,java.util.Map<WorldObjectId,IViewable>> getAllVisible()
Description copied from interface: IVisionWorldView
Returns map of all visible objects (IViewable instances} - those that the agent can currently see.

WARNING: If you will do iteration over the map, you must synchronize on it.

Specified by:
getAllVisible in interface IVisionWorldView

getAllVisible

public <T extends IViewable> java.util.Map<WorldObjectId,T> getAllVisible(java.lang.Class<T> type)
Description copied from interface: IVisionWorldView
Returns map of all visible objects (IViewable instances} - those that the agent can currently see.

WARNING: If you will do iteration over the map, you must synchronize on it.

Specified by:
getAllVisible in interface IVisionWorldView
Returns:

getVisible

public java.util.Map<WorldObjectId,IViewable> getVisible()
Description copied from interface: IVisionWorldView
Returns map of all visible objects (IViewable instances} organized according to their WorldObjectId - those that the agent can currently see.

WARNING: If you will do iteration over the map, you must synchronize on it.

Specified by:
getVisible in interface IVisionWorldView
Returns:

getVisible

public IViewable getVisible(WorldObjectId id)
Description copied from interface: IVisionWorldView
Returns a visible world object of the specific id (if exists inside the world view and is visible).

Otherwise, null is returned.

Specified by:
getVisible in interface IVisionWorldView
Parameters:
id - objects's id
Returns:

addVisibleObject

protected void addVisibleObject(IViewable worldObject)
Method that adds a world object to the visible object maps.

Synchronized!

Parameters:
worldObject -

removeVisibleObject

protected void removeVisibleObject(IViewable worldObject)
Removes world object from the visible world maps.

Synchronized!

Parameters:
worldObject -

objectUpdatedEvent

protected void objectUpdatedEvent(IWorldObjectUpdatedEvent updateEvent)
It additionally handles IViewable objects automatically raising WorldObjectAppearedEvent and WorldObjectDisappearedEvent.

Overrides:
objectUpdatedEvent in class EventDrivenWorldView

objectCreated

protected void objectCreated(IWorldObject obj)
Additionally, it provides handling of IViewable objects raising WorldObjectAppearedEvent automatically (if object is visible).

Overrides:
objectCreated in class EventDrivenWorldView

objectAppeared

protected void objectAppeared(IViewable obj)
Called whenever the object appears in the agent's FOV.

Parameters:
obj -

objectDisappeared

protected void objectDisappeared(IViewable obj)
Called whenever the object disappears from the agent's FOV.

Parameters:
obj -

objectDestroyed

protected void objectDestroyed(IWorldObject obj)
Additionally it handles IViewable objects automatically raising WorldObjectDisappearedEvent if object was visible before it was destroyed.

Overrides:
objectDestroyed in class EventDrivenWorldView
Parameters:
obj -