public class UT2004LockableWorldView extends UT2004WorldView implements ILockableVisionWorldView
Contains GameBots2004 correct locking of the worldview.
All messages are processed always in batches (all messages between EndMessages are one batch) meaning that the world view is always correct!
When worldview is lock()ed it postpones the events until unlock()ed, which is triggering raising all events that came from the lock().
The world view is unlocked from the beginning.
All those locking mechanisms start working when the first BEGIN message comes.
| Modifier and Type | Field and Description |
|---|---|
static String |
WORLDVIEW_DEPENDENCY |
notifyEventsList, receiveEventProcessingCOMPONENT_ID, control, controller, eventBus, log| Constructor and Description |
|---|
UT2004LockableWorldView(ComponentDependencies dependencies,
IMediator mediator,
IComponentBus bus,
IAgentLogger log) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
hasBatchesToProcess() |
boolean |
isLocked() |
void |
lock()
When the world view is locked - no batches are processes until unlocked.
|
void |
notify(IWorldChangeEvent event)
Implements locking logic.
|
void |
unlock()
Unlocks the world view - triggers processing of all events till the last EndMessage that
came between lock() / unlock() calls.
|
isBatchBeginEvent, isBatchEndEvent, setDisappearedFlagbatchAwareWorldViewNotify, hasObjectsToProcess, notifyImmediately, objectAppeared, objectDisappearedaddVisibleObject, cleanUp, getAllVisible, getAllVisible, getVisible, getVisible, objectCreated, objectDestroyed, objectUpdatedEvent, removeVisibleObjectinnerNotify, notifyAfterPropagation, objectUpdated, raiseEventaddEventListener, addObjectListener, addObjectListener, addObjectListener, addObjectListener, addWorldObject, get, 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, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetAllVisible, getAllVisible, getVisible, getVisibleaddEventListener, addObjectListener, addObjectListener, addObjectListener, addObjectListener, get, get, get, getAll, getAll, getEventBus, getSingle, isListening, isListening, isListening, isListening, isListening, isListening, removeEventListener, removeListener, removeObjectListener, removeObjectListener, removeObjectListener, removeObjectListenernotifyAfterPropagation, notifyImmediatelygetComponentIdpublic static final String WORLDVIEW_DEPENDENCY
@Inject public UT2004LockableWorldView(ComponentDependencies dependencies, IMediator mediator, IComponentBus bus, IAgentLogger log)
public void lock()
throws ComponentNotRunningException
lock in interface ILockableWorldViewComponentNotRunningExceptionpublic void unlock()
throws ComponentNotRunningException
unlock in interface ILockableWorldViewComponentNotRunningExceptionpublic boolean isLocked()
isLocked in interface ILockableWorldViewpublic boolean hasBatchesToProcess()
public void notify(IWorldChangeEvent event)
notify in interface IWorldChangeEventInputnotify in class BatchAwareWorldViewCopyright © 2012 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.