cz.cuni.amis.pogamut.multi.communication.worldview
Interface ISharedWorldView

All Superinterfaces:
IComponent, ISharedComponent, ISharedWorldChangeEventInput
All Known Implementing Classes:
AbstractSharedWorldView, BatchAwareSharedWorldView, EventDrivenSharedWorldView, UT2004BatchAwareSharedWorldView

public interface ISharedWorldView
extends ISharedWorldChangeEventInput

Interface for WorldViews for multi-agent systems


Method Summary
 void addEventListener(java.lang.Class<?> eventClass, IWorldEventListener<?> listener)
          Adds listener to a specific event (Level A listeners).
 void addObjectListener(java.lang.Class<?> objectClass, java.lang.Class<?> eventClass, IWorldObjectEventListener<?,?> listener)
          Adds listener to a specified 'event' that occurs on the specific 'objectClass' (Level C listeners).
 void addObjectListener(java.lang.Class<?> objectClass, IWorldObjectEventListener<?,?> listener)
          Adds listener to all events that happens on any object of the 'objectClass' (Level B listeners).
 void addObjectListener(WorldObjectId objectId, java.lang.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).
 ISharedWorldObject getShared(ITeamId teamId, WorldObjectId objectId, TimeKey time)
          Returns the shared part of a requested object.
 IStaticWorldObject getStatic(WorldObjectId id)
          Returns only the static part of a requested object, static part of each objects only contains properties, that will NOT be changed over time.
 boolean isListening(java.lang.Class<?> objectClass, java.lang.Class<?> eventClass, IWorldObjectEventListener<?,?> listener)
          Tests whether the 'listener' is listening at specified 'objectClass' for specified 'event' (Level C listeners).
 boolean isListening(java.lang.Class<?> eventClass, IWorldEventListener<?> listener)
          Tests whether the 'listener' is listening to a specific event (Level A listeners).
 boolean isListening(java.lang.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, java.lang.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 registerLocalWorldView(ILocalWorldView localWV, ILifecycleBus bus)
          This method is called when a new localWorldView is created and wants to use this sharedWorldView, the method registers the LocalWorldView with the sharedWorldView's sharedComponentBus and also internally stores the information about which WorldViews are registered to it.
 void removeEventListener(java.lang.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(java.lang.Class<?> objectClass, java.lang.Class<?> eventClass, IWorldObjectEventListener<?,?> listener)
          Removes listener from specific 'objectClass' listening for specified 'event' (Level C listeners).
 void removeObjectListener(java.lang.Class<?> objectClass, IWorldObjectEventListener<?,?> listener)
          Removes listener from specific 'objectClass' listening for specified 'event' (Level B listeners).
 void removeObjectListener(WorldObjectId objectId, java.lang.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).
 
Methods inherited from interface cz.cuni.amis.pogamut.multi.communication.worldview.ISharedWorldChangeEventInput
notify
 
Methods inherited from interface cz.cuni.amis.pogamut.base.component.ISharedComponent
addComponentBus, removeComponentBus
 
Methods inherited from interface cz.cuni.amis.pogamut.base.component.IComponent
getComponentId
 

Method Detail

registerLocalWorldView

void registerLocalWorldView(ILocalWorldView localWV,
                            ILifecycleBus bus)
This method is called when a new localWorldView is created and wants to use this sharedWorldView, the method registers the LocalWorldView with the sharedWorldView's sharedComponentBus and also internally stores the information about which WorldViews are registered to it.

Parameters:
localWV - The local WorldView to to register.
bus - ILifecycleBus of the corresponding LocalWorldView

addEventListener

void addEventListener(java.lang.Class<?> eventClass,
                      IWorldEventListener<?> listener)
Adds listener to a specific event (Level A listeners). Note that the event listener must be able to handle events of the class 'event'.

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'.

Parameters:
eventClass - which event types you want to receive
listener - where you want to handle these events

addObjectListener

void addObjectListener(java.lang.Class<?> objectClass,
                       IWorldObjectEventListener<?,?> listener)
Adds listener to all events that happens on any object of the 'objectClass' (Level B listeners).

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'.

Parameters:
objectClass - which object class you want to listen at
eventClass - which event class you want to receive
listener - where you want to handle these events

addObjectListener

void addObjectListener(java.lang.Class<?> objectClass,
                       java.lang.Class<?> eventClass,
                       IWorldObjectEventListener<?,?> listener)
Adds listener to a specified 'event' that occurs on the specific 'objectClass' (Level C listeners).

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.

Parameters:
objectClass - which object class you want to listen at
eventClass - which event class you want to receive
listener - where you want to handle these events

addObjectListener

void addObjectListener(WorldObjectId objectId,
                       IWorldObjectEventListener<?,?> listener)
Adds listener to all events that happens on object with specific 'objectId' (Level D listeners).

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'.

Parameters:
objectId - which object you want to listen at
listener - where you want to handle events

addObjectListener

void addObjectListener(WorldObjectId objectId,
                       java.lang.Class<?> eventClass,
                       IWorldObjectEventListener<?,?> listener)
Adds listener to a specified 'event' that occurs on the specific object with 'objectId' (Level E listeners).

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'.

Parameters:
objectId - which object you want to listen at
eventClass - which event classes you want to receive
listener - where you want to handle these events

removeEventListener

void removeEventListener(java.lang.Class<?> eventClass,
                         IWorldEventListener<?> listener)
Removes listener from a specific event (Level A listeners).

Parameters:
eventClass - which events class you want to remove the listener from
listener - you want to remove

removeObjectListener

void removeObjectListener(java.lang.Class<?> objectClass,
                          IWorldObjectEventListener<?,?> listener)
Removes listener from specific 'objectClass' listening for specified 'event' (Level B listeners).

Parameters:
objectClass - class of objects you want the listener to remove from
eventClass - which events class you want to remove the listener from
listener - you want to remove

removeObjectListener

void removeObjectListener(java.lang.Class<?> objectClass,
                          java.lang.Class<?> eventClass,
                          IWorldObjectEventListener<?,?> listener)
Removes listener from specific 'objectClass' listening for specified 'event' (Level C listeners).

Parameters:
objectClass - class of objects you want the listener to remove from
eventClass - which events class you want to remove the listener from
listener - you want to remove

removeObjectListener

void removeObjectListener(WorldObjectId objectId,
                          IWorldObjectEventListener<?,?> listener)
Removes listener from objects with specified 'objectId' (Level D Listeners).

Parameters:
objectId - id of object you want the listener to remove from
listener - you want to remove

removeObjectListener

void removeObjectListener(WorldObjectId objectId,
                          java.lang.Class<?> eventClass,
                          IWorldObjectEventListener<?,?> listener)
Removes listener to a specified 'event' that occurs on the specific object with 'objectId' (Level E listeners).

Parameters:
objectId - id of object you want the listener to remove from
eventClass - event class you want to stop receiving in the listener
listener - you want to remove

removeListener

void removeListener(IWorldEventListener<?> listener)
Removes listener from every listeners category (from every listener level).

WARNING: Can be time consuming! (Iterating through all levels of listeners.)

Parameters:
listener - you want to remove from all listener levels

isListening

boolean isListening(java.lang.Class<?> eventClass,
                    IWorldEventListener<?> listener)
Tests whether the 'listener' is listening to a specific event (Level A listeners).

Parameters:
eventClass - which events you want to receive
listener - that is tested
Returns:
whether the listener is listening

isListening

boolean isListening(java.lang.Class<?> objectClass,
                    IWorldObjectEventListener<?,?> listener)
Tests whether the 'listener' is listening at specified 'objectClass' (Level B listeners).

Parameters:
objectClass - where the listener is tested
listener - that is tested
Returns:
whether the listener is listening

isListening

boolean isListening(java.lang.Class<?> objectClass,
                    java.lang.Class<?> eventClass,
                    IWorldObjectEventListener<?,?> listener)
Tests whether the 'listener' is listening at specified 'objectClass' for specified 'event' (Level C listeners).

Parameters:
objectClass - where the listener is tested
eventClass - where the listener is tested
listener - that is tested
Returns:
whether the listener is listening

isListening

boolean isListening(WorldObjectId objectId,
                    IWorldObjectEventListener<?,?> listener)
Tests whether the 'listener' is listening at specified 'objectId' (Level D Listeners).

Parameters:
objectId - where the listener is tested
listener - that is tested
Returns:
whether the listener is listening

isListening

boolean isListening(WorldObjectId objectId,
                    java.lang.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).

Parameters:
objectId - where the listener is tested
eventClass - what class is tested
listener - that is tested
Returns:
whether the listener is listening

isListening

boolean isListening(IWorldEventListener<?> listener)
Checks whether this listener is hooked to the world view (at any listener level).

WARNING: Can be time consuming! (Iterating through all levels of listeners.)

Parameters:
listener -
Returns:

getStatic

IStaticWorldObject getStatic(WorldObjectId id)
Returns only the static part of a requested object, static part of each objects only contains properties, that will NOT be changed over time. Therefore the static part of each object is immutable and always up-to-date.

Parameters:
id - - WorldObjectId of the entire WorldObject

getShared

ISharedWorldObject getShared(ITeamId teamId,
                             WorldObjectId objectId,
                             TimeKey time)
Returns the shared part of a requested object. Shared part of every worldObject contains properties, that are relevant to multiple agents (usually a team) and are not subjective in nature (every agent sees them differently). Good example is a boolean property isSpawned . Also note, that many shared properties are computed from other knowledge about the object (isVisible => isSpawned). For this reason, the value of a shared property can get "dirty" over time, so don't forget to check if your property is up-to-date.

Parameters:
teamId -
objectId -
Returns: