cz.cuni.amis.pogamut.base.communication.worldview.impl
Class LockableWorldView
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.base.communication.worldview.impl.LockableWorldView
- All Implemented Interfaces:
- ILockableWorldView, IWorldChangeEventInput, IWorldView, IComponent
public class LockableWorldView
- extends EventDrivenWorldView
- implements ILockableWorldView
WorldView that can be locked. If the world is locked all chages on objects are postponed
and issued when the world is unlocked. The events aren't locked by default, but
there is a switch that enables locking of events.
Method Summary |
boolean |
isLocked()
Whether the worldview is locked. |
boolean |
isLockEvents()
|
void |
lock()
Prevent the WorldView from being changed. |
void |
notifyEvent(IWorldChangeEvent event)
Store all changes for later processing when the event is received in the
while the world is locked. |
void |
setLockEvents(boolean lockEvents)
Should the event processing also be locked? The object updating isn't
affected by this switch. |
void |
unlock()
Unlock the WorldView and process all changes that happened when the world
was locked. |
Methods inherited from class cz.cuni.amis.pogamut.base.communication.worldview.impl.AbstractWorldView |
addEventListener, addObjectListener, addObjectListener, addObjectListener, addObjectListener, addWorldObject, cleanUp, 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 |
WORLDVIEW_DEPENDENCY
public static final java.lang.String WORLDVIEW_DEPENDENCY
- See Also:
- Constant Field Values
eventsToProcess
protected java.util.List<IWorldChangeEvent> eventsToProcess
- List of events received when the worldview was locked.
lockEvents
protected boolean lockEvents
- Lock non object update events?
LockableWorldView
@Inject
public LockableWorldView(ComponentDependencies dependencies,
IComponentBus bus,
IAgentLogger log)
lock
public void lock()
throws ComponentNotRunningException
- Prevent the WorldView from being changed.
- Specified by:
lock
in interface ILockableWorldView
- Throws:
ComponentNotRunningException
unlock
public void unlock()
- Unlock the WorldView and process all changes that happened when the world
was locked.
- Specified by:
unlock
in interface ILockableWorldView
isLocked
public boolean isLocked()
- Description copied from interface:
ILockableWorldView
- Whether the worldview is locked.
- Specified by:
isLocked
in interface ILockableWorldView
- Returns:
setLockEvents
public void setLockEvents(boolean lockEvents)
- Should the event processing also be locked? The object updating isn't
affected by this switch.
- Parameters:
lockEvents
-
isLockEvents
public boolean isLockEvents()
notifyEvent
public void notifyEvent(IWorldChangeEvent event)
- Store all changes for later processing when the event is received in the
while the world is locked. Otherwise immedeately process the change.
- Parameters:
event
-