cz.cuni.amis.pogamut.multi.communication.worldview.impl
Class BatchAwareSharedWorldView

java.lang.Object
  extended by cz.cuni.amis.pogamut.multi.communication.worldview.impl.AbstractSharedWorldView
      extended by cz.cuni.amis.pogamut.multi.communication.worldview.impl.EventDrivenSharedWorldView
          extended by cz.cuni.amis.pogamut.multi.communication.worldview.impl.BatchAwareSharedWorldView
All Implemented Interfaces:
IComponent, ISharedComponent, ISharedWorldChangeEventInput, ISharedWorldView
Direct Known Subclasses:
UT2004BatchAwareSharedWorldView

public abstract class BatchAwareSharedWorldView
extends EventDrivenSharedWorldView


Field Summary
 
Fields inherited from class cz.cuni.amis.pogamut.multi.communication.worldview.impl.EventDrivenSharedWorldView
notifyEventsList, receiveEventProcessing, syncEventList, WORLDVIEW_DEPENDENCY
 
Fields inherited from class cz.cuni.amis.pogamut.multi.communication.worldview.impl.AbstractSharedWorldView
COMPONENT_ID, control, controller, currentSharedProperties, idClassMap, localWorldViews, log, sharedProperties, sharedWorldObjects, staticWorldObjects, syncCurrentSharedProperties, syncIdClassMap, syncSharedProperties, syncSharedWorldObjects
 
Constructor Summary
BatchAwareSharedWorldView(java.util.logging.Logger logger)
          Construcotr - all we need is logger.
 
Method Summary
protected abstract  boolean isBatchEndEvent(IWorldChangeEvent event)
           
 void notify(IWorldChangeEvent event)
           
protected  void notifyLocalWorldViews(java.util.Set<IAgentId> waiting, long time)
          Notifies all waiting local world views, that batch belonging to 'time' has been exported by all local world views.
protected  void processBeginEvent(SharedBatchBeginEvent event)
          Adds a lock for the desired time.
protected  void processEndEvent(IWorldChangeEvent event)
          Processes batch-end event ...
 
Methods inherited from class cz.cuni.amis.pogamut.multi.communication.worldview.impl.EventDrivenSharedWorldView
innerNotify, objectCreated, objectDestroyed, objectUpdated, propertyCreated, propertyUpdated, propertyUpdatedEvent, raiseEvent, sharedObjectUpdatedEvent, staticObjectUpdatedEvent
 
Methods inherited from class cz.cuni.amis.pogamut.multi.communication.worldview.impl.AbstractSharedWorldView
addComponentBus, addEventListener, addObjectListener, addObjectListener, addObjectListener, addObjectListener, addOldSharedProperty, addSharedProperty, addSharedProperty, addSharedWorldObject, addStaticWorldObject, cleanUp, createSharedObject, getComponentId, getShared, getSharedProperties, getSharedProperty, getStatic, isListening, isListening, isListening, isListening, isListening, isListening, isPaused, isRunning, kill, pause, prePause, preStop, registerLocalWorldView, removeComponentBus, removeEventListener, removeListener, removeObjectListener, removeObjectListener, removeObjectListener, removeObjectListener, removeSharedProperty, removeSharedProperty, removeStaticWorldObject, removeStaticWorldObject, reset, resume, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BatchAwareSharedWorldView

public BatchAwareSharedWorldView(java.util.logging.Logger logger)
Construcotr - all we need is logger. Shared world view has no other affiliation either to concrete agent or a team.

Parameters:
logger -
Method Detail

isBatchEndEvent

protected abstract boolean isBatchEndEvent(IWorldChangeEvent event)

notifyLocalWorldViews

protected void notifyLocalWorldViews(java.util.Set<IAgentId> waiting,
                                     long time)
Notifies all waiting local world views, that batch belonging to 'time' has been exported by all local world views. I.e. SharedBatchBeginEvent occurs for 'time'.

Parameters:
waiting - agent which local wvs should be notified
time - time for which the batch has finished

processBeginEvent

protected void processBeginEvent(SharedBatchBeginEvent event)
Adds a lock for the desired time. This method is called when a SharedBatchBeginEvent is recieved, it means that the localWorldViews should wait until the entire batch has been processed.

Parameters:
time -

processEndEvent

protected void processEndEvent(IWorldChangeEvent event)
Processes batch-end event ... correctly synchronize access to timeLocks in lock-free manner.

Parameters:
time -

notify

public void notify(IWorldChangeEvent event)
Specified by:
notify in interface ISharedWorldChangeEventInput
Overrides:
notify in class EventDrivenSharedWorldView