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

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
              extended by cz.cuni.amis.pogamut.base3d.worldview.impl.BatchAwareWorldView
All Implemented Interfaces:
IWorldChangeEventInput, IWorldView, IComponent, IVisionWorldView
Direct Known Subclasses:
LockableBatchAwareWorldView, SyncLockableBatchAwareWorldView, UT2004WorldView

public abstract class BatchAwareWorldView
extends VisionWorldView

World view that is updated by protocol utilizing concept of batches. Each batch is separated by some message. After receiving this message additional events may be raised (eg. visibility update etc.).


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
BatchAwareWorldView(ComponentDependencies dependencies, IComponentBus bus, IAgentLogger log)
           
 
Method Summary
protected  void batchAwareWorldViewNotify(IWorldChangeEvent event)
           
 boolean hasObjectsToProcess()
          Any objects waiting in currentObjectBatch for processing?
protected abstract  boolean isBatchBeginEvent(IWorldChangeEvent evt)
          Is this event a batch begin event? It is needed for the locking to be working correctly.
protected abstract  boolean isBatchEndEvent(IWorldChangeEvent evt)
          Is this event a batch end event? If so some extra events may be generated in processing this message.
 void notify(IWorldChangeEvent event)
          New event was generated from the world.
 void notifyImmediately(IWorldChangeEvent event)
          Notify immediately will process the event right away, it won't use "event recoursion buffer" to postpone the processing of the event.
protected  void objectAppeared(IViewable obj)
          Called whenever the object appears in the agent's FOV.
protected  void objectDisappeared(IViewable obj)
          Called whenever the object disappears from the agent's FOV.
protected abstract  void setDisappearedFlag(IViewable obj)
          Sets the visible flag to true on IViewable objects.
 
Methods inherited from class cz.cuni.amis.pogamut.base3d.worldview.impl.VisionWorldView
addVisibleObject, cleanUp, getAllVisible, getAllVisible, getVisible, getVisible, objectCreated, objectDestroyed, objectUpdatedEvent, removeVisibleObject
 
Methods inherited from class cz.cuni.amis.pogamut.base.communication.worldview.impl.EventDrivenWorldView
innerNotify, 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.component.IComponent
getComponentId
 

Field Detail

WORLDVIEW_DEPENDENCY

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

BatchAwareWorldView

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

isBatchEndEvent

protected abstract boolean isBatchEndEvent(IWorldChangeEvent evt)
Is this event a batch end event? If so some extra events may be generated in processing this message.

Parameters:
evt -
Returns:
true if this is a batch ending event

isBatchBeginEvent

protected abstract boolean isBatchBeginEvent(IWorldChangeEvent evt)
Is this event a batch begin event? It is needed for the locking to be working correctly.

Parameters:
evt -
Returns:
true if this is a batch ending event

setDisappearedFlag

protected abstract void setDisappearedFlag(IViewable obj)
Sets the visible flag to true on IViewable objects.

Parameters:
obj - Object that disappeared

batchAwareWorldViewNotify

protected void batchAwareWorldViewNotify(IWorldChangeEvent event)

notify

public void notify(IWorldChangeEvent event)
Description copied from interface: IWorldChangeEventInput
New event was generated from the world.

Specified by:
notify in interface IWorldChangeEventInput
Overrides:
notify in class EventDrivenWorldView

notifyImmediately

public void notifyImmediately(IWorldChangeEvent event)
                       throws ComponentNotRunningException,
                              ComponentPausedException
Description copied from interface: IWorldChangeEventInput
Notify immediately will process the event right away, it won't use "event recoursion buffer" to postpone the processing of the event.

This will work even if the world view is locked!

Specified by:
notifyImmediately in interface IWorldChangeEventInput
Overrides:
notifyImmediately in class EventDrivenWorldView
Throws:
ComponentNotRunningException
ComponentPausedException

objectAppeared

protected void objectAppeared(IViewable obj)
Description copied from class: VisionWorldView
Called whenever the object appears in the agent's FOV.

Overrides:
objectAppeared in class VisionWorldView

objectDisappeared

protected void objectDisappeared(IViewable obj)
Description copied from class: VisionWorldView
Called whenever the object disappears from the agent's FOV.

Overrides:
objectDisappeared in class VisionWorldView

hasObjectsToProcess

public boolean hasObjectsToProcess()
Any objects waiting in currentObjectBatch for processing?

Returns:
true if there is at least one object to process