cz.cuni.amis.pogamut.udk.communication.worldview
Class UDKLockableWorldView
java.lang.Object
cz.cuni.amis.pogamut.base.communication.worldview.impl.AbstractWorldView
cz.cuni.amis.pogamut.base.communication.worldview.impl.EventDrivenWorldView
cz.cuni.amis.pogamut.base3d.worldview.impl.VisionWorldView
cz.cuni.amis.pogamut.base3d.worldview.impl.BatchAwareWorldView
cz.cuni.amis.pogamut.udk.communication.worldview.UDKWorldView
cz.cuni.amis.pogamut.udk.communication.worldview.UDKLockableWorldView
- All Implemented Interfaces:
- ILockableWorldView, IWorldChangeEventInput, IWorldView, IComponent, ILockableVisionWorldView, IVisionWorldView
public class UDKLockableWorldView
- extends UDKWorldView
- implements ILockableVisionWorldView
Lockable word view.
Contains GameBotsUDK 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.
- Author:
- Jimmy
Method Summary |
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. |
Methods inherited from class cz.cuni.amis.pogamut.base.communication.worldview.impl.AbstractWorldView |
addEventListener, 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, toString |
Methods inherited from interface cz.cuni.amis.pogamut.base.communication.worldview.IWorldView |
addEventListener, addObjectListener, addObjectListener, addObjectListener, addObjectListener, get, get, get, getAll, getAll, getEventBus, getSingle, isListening, isListening, isListening, isListening, isListening, isListening, removeEventListener, removeListener, removeObjectListener, removeObjectListener, removeObjectListener, removeObjectListener |
WORLDVIEW_DEPENDENCY
public static final String WORLDVIEW_DEPENDENCY
- See Also:
- Constant Field Values
UDKLockableWorldView
@Inject
public UDKLockableWorldView(ComponentDependencies dependencies,
IMediator mediator,
IComponentBus bus,
IAgentLogger log)
lock
public void lock()
throws ComponentNotRunningException
- When the world view is locked - no batches are processes until unlocked.
- Specified by:
lock
in interface ILockableWorldView
- Throws:
ComponentNotRunningException
unlock
public void unlock()
throws ComponentNotRunningException
- Unlocks the world view - triggers processing of all events till the last EndMessage that
came between lock() / unlock() calls.
- Specified by:
unlock
in interface ILockableWorldView
- Throws:
ComponentNotRunningException
isLocked
public boolean isLocked()
- Specified by:
isLocked
in interface ILockableWorldView
hasBatchesToProcess
public boolean hasBatchesToProcess()
notify
public void notify(IWorldChangeEvent event)
- Implements locking logic.
- Specified by:
notify
in interface IWorldChangeEventInput
- Overrides:
notify
in class BatchAwareWorldView
Copyright © 2014 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.