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

All Superinterfaces:
IComponent, ITimedWorldChangeEventInput
All Known Subinterfaces:
IVisionLocalWorldView
All Known Implementing Classes:
AbstractLocalWorldView, BatchAwareLocalWorldView, EventDrivenLocalWorldView, UT2004LockableLocalWorldView, UT2004VisionLocalWorldView, VisionLocalWorldView

public interface ILocalWorldView
extends ITimedWorldChangeEventInput

Interface for a World View local to a single agent in a multi-agent system any implementation must implement the necessary object maps! TODO: [srlok] what are the problems using TimeKey? does it always return the information to any TimeKey I may obtain? Am I supposed to always provide the TimeKey that is Current? What about locking?


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).
 java.util.Map<WorldObjectId,ICompositeWorldObject> get()
          Returns a map of all CompositeWorldObjects in the world.
 ICompositeWorldObject get(WorldObjectId objectId)
           
 ITeamedAgentId getAgentId()
           
 java.util.Map<java.lang.Class<?>,java.util.Map<WorldObjectId,ICompositeWorldObject>> getAll()
          Returns all objects sorted according to class.
<T extends ICompositeWorldObject>
java.util.Map<WorldObjectId,T>
getAll(java.lang.Class<T> type)
           
 TimeKey getCurrentTimeKey()
           
 IComponentBus getEventBus()
           
 ILocalWorldObject getLocal(WorldObjectId objectId)
          Returns the most current LocalObject.
<T extends ICompositeWorldObject>
T
getSingle(java.lang.Class<T> cls)
           
 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 lockTime(long time)
           
 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).
 boolean setCurrentTime(TimeKey timeKey)
           
 boolean setInitialTime(TimeKey timeKey)
           
 void unlockTime(long time)
           
 
Methods inherited from interface cz.cuni.amis.pogamut.multi.communication.worldview.ITimedWorldChangeEventInput
notify
 
Methods inherited from interface cz.cuni.amis.pogamut.base.component.IComponent
getComponentId
 

Method Detail

getEventBus

IComponentBus getEventBus()

getAgentId

ITeamedAgentId getAgentId()

getLocal

ILocalWorldObject getLocal(WorldObjectId objectId)
Returns the most current LocalObject.
Returns the local part of requested WorldObject. A local part for every object contains properties subjective to only one agent. (like isVisible).

Parameters:
objectId -
Returns:

get

ICompositeWorldObject get(WorldObjectId objectId)
Parameters:
objectId -
Returns:

get

java.util.Map<WorldObjectId,ICompositeWorldObject> get()
Returns a map of all CompositeWorldObjects in the world.
The map is lazy, the Composite objects are created only when a get() method is called. If you need to iterate over this map and you don't need all of the values iterate over the keySet.
The map will contain objects current to timeKey actual on calling of this method.

Returns:

getAll

java.util.Map<java.lang.Class<?>,java.util.Map<WorldObjectId,ICompositeWorldObject>> getAll()
Returns all objects sorted according to class. All of the classMaps are lazy-implemented, so the CompositeObject will only be created on get method. If you need to iterate over the map, but you don't need the actual objects, iterate over the keySet. Do not hold reference to this map! Always use new getAll() call when you need this map again or you risk that some classMaps will get new timeKeys. By calling getAll(Class, time != thisTime).

Returns:

getAll

<T extends ICompositeWorldObject> java.util.Map<WorldObjectId,T> getAll(java.lang.Class<T> type)
Type Parameters:
T -
Parameters:
type -
Returns:

getSingle

<T extends ICompositeWorldObject> T getSingle(java.lang.Class<T> cls)

setInitialTime

boolean setInitialTime(TimeKey timeKey)

setCurrentTime

boolean setCurrentTime(TimeKey timeKey)

lockTime

void lockTime(long time)

unlockTime

void unlockTime(long time)
                throws TimeKeyNotLockedException
Throws:
TimeKeyNotLockedException

getCurrentTimeKey

TimeKey getCurrentTimeKey()

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: