|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object cz.cuni.amis.pogamut.multi.communication.worldview.impl.AbstractLocalWorldView cz.cuni.amis.pogamut.multi.communication.worldview.impl.EventDrivenLocalWorldView cz.cuni.amis.pogamut.multi.communication.worldview.impl.VisionLocalWorldView cz.cuni.amis.pogamut.multi.communication.worldview.impl.BatchAwareLocalWorldView
public abstract class BatchAwareLocalWorldView
Implements the batch logic into the worldView.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class cz.cuni.amis.pogamut.multi.communication.worldview.impl.AbstractLocalWorldView |
---|
AbstractLocalWorldView.LazyCompositeObjectMap<T extends ICompositeWorldObject> |
Field Summary | |
---|---|
protected Map<WorldObjectId,Set<DummyObjectEvent.EventType>> |
bufferedEvents
|
protected List<DummyObjectEvent> |
eventBuffer
|
Fields inherited from class cz.cuni.amis.pogamut.multi.communication.worldview.impl.VisionLocalWorldView |
---|
syncVisibleClassMap, syncVisibleMap, visibleClassMap, visibleMap |
Fields inherited from class cz.cuni.amis.pogamut.multi.communication.worldview.impl.EventDrivenLocalWorldView |
---|
notifyEventsList, receiveEventProcessing, WORLDVIEW_DEPENDENCY |
Fields inherited from class cz.cuni.amis.pogamut.multi.communication.worldview.impl.AbstractLocalWorldView |
---|
actLocalWorldObjects, agentId, classMap, COMPONENT_ID, control, controller, eventBus, log, sharedWorldView, syncClassMap |
Constructor Summary | |
---|---|
BatchAwareLocalWorldView(ComponentDependencies dependencies,
ILifecycleBus bus,
IAgentLogger logger,
ISharedWorldView parentWorldView,
ITeamedAgentId agentId)
|
Method Summary | |
---|---|
protected void |
bufferObjectEvent(WorldObjectId id,
DummyObjectEvent.EventType eventType,
long time)
This is used for raising object events safely by buffering the object events, we make sure that when the events are raised and listeners notified, the update event has been fully processed and the object contains correct and consistent data. |
protected abstract void |
disappearObject(WorldObjectId id,
long time)
Sets the visible property on the object to false by creating a disappeared event also raises correct events |
protected void |
flushEvents()
Raises all events from this batch |
protected abstract boolean |
isBatchBeginEvent(IWorldChangeEvent event)
Used to identify events marking beginning of batches. |
protected abstract boolean |
isBatchEndEvent(IWorldChangeEvent event)
Used to detect batch end events, needs to be overriden to detect the events properly. |
boolean |
isLocked()
|
protected void |
kill()
Kills the world view. |
void |
lock()
Must be called before starting logic. |
void |
notify(IWorldChangeEvent event)
New event was generated from the world. |
protected void |
notifySharedBegin(long time)
Notifies sharedWorldView that a beginEvent has been recieved with with the specified time and the sharedWorldView should notify this worldView back, when all events for the time have been processed. |
protected void |
objectAppeared(ILocalViewable obj,
long time)
Handles events for making the object visible. |
protected void |
objectCreated(ILocalWorldObject obj,
long time)
Must be called whenever an object was created, raises correct events. |
protected void |
objectDestroyed(ILocalWorldObject obj,
long time)
Must be called whenever an object was destroyed - raises correct events. |
protected void |
objectDisappeared(ILocalViewable obj,
long time)
Handles events for making the object not visible. |
protected void |
objectUpdated(ILocalWorldObject obj,
long time)
Must be called whenever an object was updated - raises correct event. |
protected void |
sharedBatchFinished(long time)
This method is called when the SharedBatchFinishedEvent is recieved from the sharedWorldView, notifying us that all sharedEvents for the specified time have been processed and it is safe to run logic on the time. |
protected void |
stop()
Stops the world view. |
void |
unlock()
Called after the logic has finished. |
Methods inherited from class cz.cuni.amis.pogamut.multi.communication.worldview.impl.VisionLocalWorldView |
---|
addVisible, getAllVisible, getAllVisible, getVisible, getVisible, objectUpdatedEvent, removeVisible |
Methods inherited from class cz.cuni.amis.pogamut.multi.communication.worldview.impl.EventDrivenLocalWorldView |
---|
innerNotify, notifyAfterPropagation, notifyImmediately, raiseEvent |
Methods inherited from class cz.cuni.amis.pogamut.multi.communication.worldview.impl.AbstractLocalWorldView |
---|
addEventListener, addLocalWorldObject, addObjectListener, addObjectListener, addObjectListener, addObjectListener, addOldLocalWorldObject, cleanUp, createCompositeObject, get, get, get, get, get, getAgentId, getAll, getAll, getAll, getAll, getComponentId, getCurrentTimeKey, getEventBus, getLocal, getLocal, getMostRecentLocalWorldObject, getSingle, getSingle, isListening, isListening, isListening, isListening, isListening, isListening, isPaused, isRunning, lockTime, pause, prePause, preStop, removeEventListener, removeListener, removeLocalWorldObject, removeObjectListener, removeObjectListener, removeObjectListener, removeObjectListener, reset, resume, setCurrentTime, setInitialTime, start, unlockTime |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface cz.cuni.amis.pogamut.multi.communication.worldview.ILocalWorldView |
---|
addEventListener, addObjectListener, addObjectListener, addObjectListener, addObjectListener, get, get, get, getAgentId, getAll, getAll, getCurrentTimeKey, getEventBus, getLocal, getSingle, isListening, isListening, isListening, isListening, isListening, isListening, lockTime, notifyImmediately, removeEventListener, removeListener, removeObjectListener, removeObjectListener, removeObjectListener, removeObjectListener, setCurrentTime, setInitialTime, unlockTime |
Methods inherited from interface cz.cuni.amis.pogamut.base.communication.worldview.IWorldChangeEventInput |
---|
notifyAfterPropagation |
Methods inherited from interface cz.cuni.amis.pogamut.base.component.IComponent |
---|
getComponentId |
Field Detail |
---|
protected Map<WorldObjectId,Set<DummyObjectEvent.EventType>> bufferedEvents
protected List<DummyObjectEvent> eventBuffer
Constructor Detail |
---|
public BatchAwareLocalWorldView(ComponentDependencies dependencies, ILifecycleBus bus, IAgentLogger logger, ISharedWorldView parentWorldView, ITeamedAgentId agentId)
Method Detail |
---|
protected abstract boolean isBatchBeginEvent(IWorldChangeEvent event)
event
-
protected abstract boolean isBatchEndEvent(IWorldChangeEvent event)
event
-
protected void notifySharedBegin(long time)
time
- protected void objectCreated(ILocalWorldObject obj, long time)
EventDrivenLocalWorldView
Might be overridden to provide different behavior.
objectCreated
in class VisionLocalWorldView
protected void objectUpdated(ILocalWorldObject obj, long time)
EventDrivenLocalWorldView
Might be overridden to provide a mechanism that will forbid update of certain objects (like items that can't move).
objectUpdated
in class EventDrivenLocalWorldView
protected void objectDestroyed(ILocalWorldObject obj, long time)
EventDrivenLocalWorldView
Might be overriden to provide different behavior.
objectDestroyed
in class VisionLocalWorldView
protected void objectAppeared(ILocalViewable obj, long time)
VisionLocalWorldView
objectAppeared
in class VisionLocalWorldView
protected void objectDisappeared(ILocalViewable obj, long time)
VisionLocalWorldView
objectDisappeared
in class VisionLocalWorldView
protected abstract void disappearObject(WorldObjectId id, long time)
id
- time
- protected void bufferObjectEvent(WorldObjectId id, DummyObjectEvent.EventType eventType, long time)
id
- eventType
- time
- protected void flushEvents()
protected void sharedBatchFinished(long time)
time
- public boolean isLocked()
public void lock()
public void unlock()
public void notify(IWorldChangeEvent event)
IWorldChangeEventInput
notify
in interface IWorldChangeEventInput
notify
in class VisionLocalWorldView
protected void stop()
AbstractLocalWorldView
If you override this method, do not forget to call super.stop().
stop
in class AbstractLocalWorldView
protected void kill()
AbstractLocalWorldView
If you override this method, do not forget to call super.stop().
kill
in class AbstractLocalWorldView
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |