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

All Superinterfaces:
Event, IWorldChangeEvent
All Known Implementing Classes:
AliveMessageMessage, AutoTraceRayMessage, BombInfo.ObjectDisappeared, BombInfoMessage, ConfigChangeMessage, FlagInfo.ObjectDisappeared, FlagInfoMessage, GameInfoMessage, IncomingProjectileMessage, InitedMessageMessage, Item.ObjectDisappeared, ItemMessage, Mover.ObjectDisappeared, MoverMessage, MyInventoryMessage, NavPoint.ObjectDisappeared, NavPointMessage, Player.ObjectDisappeared, PlayerMessage, SelfMessage, TeamScoreMessage, Vehicle.ObjectDisappeared, VehicleMessage

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 passed to the world view).
  4. IWorldObjectUpdateResult.Result.DESTROYED = object disappeared from the world - this is the case when the object's id id known to the world, according world object is passed to the update() method AND update() method returns null

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.


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)