public abstract class VisionLocalWorldView extends EventDrivenLocalWorldView implements IVisionLocalWorldView
IVisionLocalWorldView
interface.AbstractLocalWorldView.LazyCompositeObjectMap<T extends ICompositeWorldObject>
Modifier and Type | Field and Description |
---|---|
protected Map<TimeKey,Map<Class,Map<WorldObjectId,IViewable>>> |
syncVisibleClassMap
Synchronized version of visible objects sorted according to class.
|
protected Map<TimeKey,Map<WorldObjectId,IViewable>> |
syncVisibleMap
Synchronized version of visible objects.
|
protected Map<TimeKey,Map<Class,Map<WorldObjectId,IViewable>>> |
visibleClassMap
Map of all currently visible objects, sorted according to their classes.
|
protected Map<TimeKey,Map<WorldObjectId,IViewable>> |
visibleMap
Map of all currently visible objects.
|
notifyEventsList, receiveEventProcessing, WORLDVIEW_DEPENDENCY
actLocalWorldObjects, agentId, classMap, COMPONENT_ID, control, controller, eventBus, log, sharedWorldView, syncClassMap
Constructor and Description |
---|
VisionLocalWorldView(ComponentDependencies dependencies,
ILifecycleBus bus,
IAgentLogger logger,
ISharedWorldView parentWorldView,
ITeamedAgentId agentId) |
Modifier and Type | Method and Description |
---|---|
protected void |
addVisible(ILocalViewable obj,
long time)
Adds the provided object as visible into all visibleMaps int the worldView.
|
Map<Class,Map<WorldObjectId,IViewable>> |
getAllVisible()
Returns map of all visible objects (
IViewable instances} - those that the agent can currently see. |
<T extends IViewable> |
getAllVisible(Class<T> type)
Returns map of all visible objects (
IViewable instances} - those that the agent can currently see. |
Map<WorldObjectId,IViewable> |
getVisible()
Returns map of all visible objects (
IViewable instances} organized according to their WorldObjectId -
those that the agent can currently see. |
IViewable |
getVisible(WorldObjectId id)
Returns a visible world object of the specific id (if exists inside the world view and is visible).
|
void |
notify(IWorldChangeEvent event)
New event was generated from the world.
|
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 |
objectUpdatedEvent(ILocalWorldObjectUpdatedEvent updateEvent)
Called from
EventDrivenWorldView.innerNotify(IWorldChangeEvent) if the event is IWorldObjectUpdatedEvent
to process it. |
protected void |
removeVisible(ILocalViewable obj,
long time)
Removes object of the same objectId as the provided localObject from visible maps.
|
innerNotify, notifyAfterPropagation, notifyImmediately, objectUpdated, raiseEvent
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, kill, lockTime, pause, prePause, preStop, removeEventListener, removeListener, removeLocalWorldObject, removeObjectListener, removeObjectListener, removeObjectListener, removeObjectListener, reset, resume, setCurrentTime, setInitialTime, start, stop, unlockTime
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
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
notifyAfterPropagation
getComponentId
protected Map<TimeKey,Map<WorldObjectId,IViewable>> visibleMap
protected Map<TimeKey,Map<WorldObjectId,IViewable>> syncVisibleMap
protected Map<TimeKey,Map<Class,Map<WorldObjectId,IViewable>>> visibleClassMap
public VisionLocalWorldView(ComponentDependencies dependencies, ILifecycleBus bus, IAgentLogger logger, ISharedWorldView parentWorldView, ITeamedAgentId agentId)
public void notify(IWorldChangeEvent event)
IWorldChangeEventInput
notify
in interface IWorldChangeEventInput
notify
in class EventDrivenLocalWorldView
protected void objectUpdatedEvent(ILocalWorldObjectUpdatedEvent updateEvent)
EventDrivenLocalWorldView
EventDrivenWorldView.innerNotify(IWorldChangeEvent)
if the event is IWorldObjectUpdatedEvent
to process it.objectUpdatedEvent
in class EventDrivenLocalWorldView
protected void objectCreated(ILocalWorldObject obj, long time)
EventDrivenLocalWorldView
Might be overridden to provide different behavior.
objectCreated
in class EventDrivenLocalWorldView
protected void objectDestroyed(ILocalWorldObject obj, long time)
EventDrivenLocalWorldView
Might be overriden to provide different behavior.
objectDestroyed
in class EventDrivenLocalWorldView
protected void objectAppeared(ILocalViewable obj, long time)
obj
- protected void objectDisappeared(ILocalViewable obj, long time)
obj
- protected void addVisible(ILocalViewable obj, long time)
obj
- protected void removeVisible(ILocalViewable obj, long time)
obj
- public Map<Class,Map<WorldObjectId,IViewable>> getAllVisible()
IVisionLocalWorldView
IViewable
instances} - those that the agent can currently see.
WARNING: If you will do iteration over the map, you must synchronize on it.
getAllVisible
in interface IVisionLocalWorldView
public <T extends IViewable> Map<WorldObjectId,T> getAllVisible(Class<T> type)
IVisionLocalWorldView
IViewable
instances} - those that the agent can currently see.
WARNING: If you will do iteration over the map, you must synchronize on it.
getAllVisible
in interface IVisionLocalWorldView
public Map<WorldObjectId,IViewable> getVisible()
IVisionLocalWorldView
IViewable
instances} organized according to their WorldObjectId
-
those that the agent can currently see.
WARNING: If you will do iteration over the map, you must synchronize on it.
getVisible
in interface IVisionLocalWorldView
public IViewable getVisible(WorldObjectId id)
IVisionLocalWorldView
Otherwise, null is returned.
getVisible
in interface IVisionLocalWorldView
id
- objects's idCopyright © 2012 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.