public interface ILocalWorldView extends IWorldChangeEventInput
Modifier and Type | Method and Description |
---|---|
void |
addEventListener(Class<?> eventClass,
IWorldEventListener<?> listener)
Adds listener to a specific event (Level A listeners).
|
void |
addObjectListener(Class<?> objectClass,
Class<?> eventClass,
IWorldObjectEventListener<?,?> listener)
Adds listener to a specified 'event' that occurs on the specific 'objectClass' (Level C listeners).
|
void |
addObjectListener(Class<?> objectClass,
IWorldObjectEventListener<?,?> listener)
Adds listener to all events that happens on any object of the 'objectClass' (Level B listeners).
|
void |
addObjectListener(WorldObjectId objectId,
Class<?> eventClass,
IWorldObjectEventListener<?,?> listener)
Adds listener to a specified 'event' that occurs on the specific object with 'objectId' (Level E listeners).
|
void |
addObjectListener(WorldObjectId objectId,
IWorldObjectEventListener<?,?> listener)
Adds listener to all events that happens on object with specific 'objectId' (Level D listeners).
|
Map<WorldObjectId,ICompositeWorldObject> |
get()
Returns a map of all CompositeWorldObjects in the world.
|
ICompositeWorldObject |
get(WorldObjectId objectId) |
<T extends ICompositeWorldObject> |
get(WorldObjectId objectId,
Class<T> clazz)
Returns object with specific id and class, if it exists.
|
ITeamedAgentId |
getAgentId() |
Map<Class,Map<WorldObjectId,ICompositeWorldObject>> |
getAll()
Returns all objects sorted according to class.
|
<T extends IWorldObject> |
getAll(Class<T> type) |
TimeKey |
getCurrentTimeKey() |
IComponentBus |
getEventBus() |
ILocalWorldObject |
getLocal(WorldObjectId objectId)
Returns the most current LocalObject.
|
<T extends IWorldObject> |
getSingle(Class<T> cls) |
boolean |
isListening(Class<?> objectClass,
Class<?> eventClass,
IWorldObjectEventListener<?,?> listener)
Tests whether the 'listener' is listening at specified 'objectClass' for specified 'event' (Level C listeners).
|
boolean |
isListening(Class<?> eventClass,
IWorldEventListener<?> listener)
Tests whether the 'listener' is listening to a specific event (Level A listeners).
|
boolean |
isListening(Class<?> objectClass,
IWorldObjectEventListener<?,?> listener)
Tests whether the 'listener' is listening at specified 'objectClass' (Level B listeners).
|
boolean |
isListening(IWorldEventListener<?> listener)
Checks whether this listener is hooked to the world view (at any listener level).
|
boolean |
isListening(WorldObjectId objectId,
Class<?> eventClass,
IWorldObjectEventListener<?,?> listener)
Tests whether the 'listener' is listening to a specified 'event' that occurs on the specific object with 'objectId' (Level E listeners).
|
boolean |
isListening(WorldObjectId objectId,
IWorldObjectEventListener<?,?> listener)
Tests whether the 'listener' is listening at specified 'objectId' (Level D Listeners).
|
void |
lockTime(long time) |
void |
notifyImmediately(IWorldChangeEvent event)
Calls notify without waiting for batches, locks or anything else.
|
void |
removeEventListener(Class<?> eventClass,
IWorldEventListener<?> listener)
Removes listener from a specific event (Level A listeners).
|
void |
removeListener(IWorldEventListener<?> listener)
Removes listener from every listeners category (from every listener level).
|
void |
removeObjectListener(Class<?> objectClass,
Class<?> eventClass,
IWorldObjectEventListener<?,?> listener)
Removes listener from specific 'objectClass' listening for specified 'event' (Level C listeners).
|
void |
removeObjectListener(Class<?> objectClass,
IWorldObjectEventListener<?,?> listener)
Removes listener from specific 'objectClass' listening for specified 'event' (Level B listeners).
|
void |
removeObjectListener(WorldObjectId objectId,
Class<?> eventClass,
IWorldObjectEventListener<?,?> listener)
Removes listener to a specified 'event' that occurs on the specific object with 'objectId' (Level E listeners).
|
void |
removeObjectListener(WorldObjectId objectId,
IWorldObjectEventListener<?,?> listener)
Removes listener from objects with specified 'objectId' (Level D Listeners).
|
boolean |
setCurrentTime(TimeKey timeKey) |
boolean |
setInitialTime(TimeKey timeKey) |
void |
unlockTime(long time) |
notify, notifyAfterPropagation
getComponentId
IComponentBus getEventBus()
void notifyImmediately(IWorldChangeEvent event) throws ComponentNotRunningException, ComponentPausedException
notifyImmediately
in interface IWorldChangeEventInput
ComponentNotRunningException
ComponentPausedException
ITeamedAgentId getAgentId()
ILocalWorldObject getLocal(WorldObjectId objectId)
objectId
- ICompositeWorldObject get(WorldObjectId objectId)
objectId
- <T extends ICompositeWorldObject> T get(WorldObjectId objectId, Class<T> clazz)
T
- objectId
- clazz
- ClassCastException
- if the object exists, but is not of specified classMap<WorldObjectId,ICompositeWorldObject> get()
Map<Class,Map<WorldObjectId,ICompositeWorldObject>> getAll()
<T extends IWorldObject> Map<WorldObjectId,T> getAll(Class<T> type)
T
- type
- <T extends IWorldObject> T getSingle(Class<T> cls)
boolean setInitialTime(TimeKey timeKey)
boolean setCurrentTime(TimeKey timeKey)
void lockTime(long time)
void unlockTime(long time) throws TimeKeyNotLockedException
TimeKeyNotLockedException
TimeKey getCurrentTimeKey()
void addEventListener(Class<?> eventClass, IWorldEventListener<?> listener)
It is the most general type of listener-registration allowing you to sniff any type of events.
Events passed to the listener are filtered only according to the 'event' class.
WARNING: even though the method does not require templated class and listener, you must be sure that 'listener' can accept 'eventClass'.
eventClass
- which event types you want to receivelistener
- where you want to handle these eventsvoid addObjectListener(Class<?> objectClass, IWorldObjectEventListener<?,?> listener)
Events passed to the listener are filtered according to the 'objectClass'.
WARNING: even though the method does not require templated classes and listener, you must be sure that 'listener' accepts all events (IWorldObjectEvent) for objects of 'objectClass'.
objectClass
- which object class you want to listen ateventClass
- which event class you want to receivelistener
- where you want to handle these eventsvoid addObjectListener(Class<?> objectClass, Class<?> eventClass, IWorldObjectEventListener<?,?> listener)
Events passed to the listener are filtered according to the 'event' and 'objectClass' of the object the event happened upon.
WARNING: even though the method does not require templated classes and listener, you must be sure that 'listener' accepts 'eventClass' for objects of 'objectClass'.
eventClass can be any implementor of IWorldObjectEvent
. E.g.
WorldObjectAppearedEvent
, WorldObjectDestroyedEvent
, WorldObjectDisappearedEvent
,
WorldObjectFirstEncounteredEvent
or WorldObjectUpdatedEvent
.
objectClass
- which object class you want to listen ateventClass
- which event class you want to receivelistener
- where you want to handle these eventsvoid addObjectListener(WorldObjectId objectId, IWorldObjectEventListener<?,?> listener)
Events passed to the listener are filtered according to the 'objectId' of the object.
WARNING: you must ensure that 'listener' can accept the event raised on object of specified 'objectId'.
objectId
- which object you want to listen atlistener
- where you want to handle eventsvoid addObjectListener(WorldObjectId objectId, Class<?> eventClass, IWorldObjectEventListener<?,?> listener)
Events passed to the listener are filtered according to the 'event' and 'objectId' of the object.
WARNING: even though the method does not require templated classes and listener, you must be sure that 'listener' accepts 'eventClass' for objects of specified 'objectId'.
objectId
- which object you want to listen ateventClass
- which event classes you want to receivelistener
- where you want to handle these eventsvoid removeEventListener(Class<?> eventClass, IWorldEventListener<?> listener)
eventClass
- which events class you want to remove the listener fromlistener
- you want to removevoid removeObjectListener(Class<?> objectClass, IWorldObjectEventListener<?,?> listener)
objectClass
- class of objects you want the listener to remove fromeventClass
- which events class you want to remove the listener fromlistener
- you want to removevoid removeObjectListener(Class<?> objectClass, Class<?> eventClass, IWorldObjectEventListener<?,?> listener)
objectClass
- class of objects you want the listener to remove fromeventClass
- which events class you want to remove the listener fromlistener
- you want to removevoid removeObjectListener(WorldObjectId objectId, IWorldObjectEventListener<?,?> listener)
objectId
- id of object you want the listener to remove fromlistener
- you want to removevoid removeObjectListener(WorldObjectId objectId, Class<?> eventClass, IWorldObjectEventListener<?,?> listener)
objectId
- id of object you want the listener to remove fromeventClass
- event class you want to stop receiving in the listenerlistener
- you want to removevoid removeListener(IWorldEventListener<?> listener)
WARNING: Can be time consuming! (Iterating through all levels of listeners.)
listener
- you want to remove from all listener levelsboolean isListening(Class<?> eventClass, IWorldEventListener<?> listener)
eventClass
- which events you want to receivelistener
- that is testedboolean isListening(Class<?> objectClass, IWorldObjectEventListener<?,?> listener)
objectClass
- where the listener is testedlistener
- that is testedboolean isListening(Class<?> objectClass, Class<?> eventClass, IWorldObjectEventListener<?,?> listener)
objectClass
- where the listener is testedeventClass
- where the listener is testedlistener
- that is testedboolean isListening(WorldObjectId objectId, IWorldObjectEventListener<?,?> listener)
objectId
- where the listener is testedlistener
- that is testedboolean isListening(WorldObjectId objectId, Class<?> eventClass, IWorldObjectEventListener<?,?> listener)
objectId
- where the listener is testedeventClass
- what class is testedlistener
- that is testedboolean isListening(IWorldEventListener<?> listener)
WARNING: Can be time consuming! (Iterating through all levels of listeners.)
listener
- Copyright © 2012 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.