cz.cuni.amis.pogamut.base.communication.translator.event
Interface IWorldObjectUpdatedEvent

Package class diagram package IWorldObjectUpdatedEvent
All Superinterfaces:
cz.cuni.amis.utils.listener.Event, IWorldChangeEvent
All Known Implementing Classes:
IWorldObjectUpdatedEvent.DestroyWorldObject

public interface IWorldObjectUpdatedEvent
extends IWorldChangeEvent

Interface for the event that suppose to update the informations about the object in the world.

Each event should return an id of the object it is meant to update, this event is processed by the IWorldViewEventInput implementor that should look up the object in it's view and update it with the method defined by the implementor of this interface.

Update event may have four different outcomes according to IWorldObjectUpdateResult.getResult().

  1. IWorldObjectUpdateResult.Result.CREATED = new object appeared in the world - this is the case when the object's id is unknown to the world view thus 'null' is passed to the update() method AND update() returns new world object
  2. IWorldObjectUpdateResult.Result.UPDATED = update state of the existing object in the world - this is the case when the object's id is known to the world view so the according world object is passed to the update() method AND update() returns the same instance (but updated, i.e., some of its fields changes) of the world object
  3. IWorldObjectUpdateResult.Result.SAME = object was not updated (no new information has been set to it).
  4. IWorldObjectUpdateResult.Result.DESTROYED = object disappeared from the world - this is the case when the object's id is known to the world and should be destroyed.

It's forbidden for the instance of update event to create a new world object instance in the 2) case, it must always work over the instance passed to the update() method

For the case 1), IWorldView will generate WorldObjectFirstEncounteredEvent followed by WorldObjectUpdatedEvent, for the case 2) the world view will generate just WorldObjectUpdatedEvent and for the case 4) WorldObjectDestroyedEvent. No event is generated for the case 3 as it does not bring new information.

Author:
Jimmy

Nested Class Summary
static class IWorldObjectUpdatedEvent.DestroyWorldObject
          Shortcut implementation of IWorldObjectUpdatedEvent that informs that some object has been destroyed.
 
Method Summary
 WorldObjectId getId()
           
 IWorldObjectUpdateResult<IWorldObject> update(IWorldObject obj)
           
 
Methods inherited from interface cz.cuni.amis.pogamut.base.communication.translator.event.IWorldChangeEvent
getSimTime
 

Method Detail

getId

WorldObjectId getId()

update

IWorldObjectUpdateResult<IWorldObject> update(IWorldObject obj)


Copyright © 2014 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.