1 package cz.cuni.amis.pogamut.multi.communication.worldview.object; 2 3 import cz.cuni.amis.pogamut.base.communication.worldview.object.WorldObjectId; 4 import cz.cuni.amis.pogamut.multi.agent.ITeamId; 5 import cz.cuni.amis.pogamut.multi.communication.translator.event.ISharedPropertyUpdatedEvent; 6 import cz.cuni.amis.pogamut.multi.communication.worldview.property.PropertyId; 7 8 /** 9 * Interface for all shared properties in the world. <br> 10 * <p> 11 * A shared property is subjective to a single team of game bots but it is objective to all bots in the same team. Generally, the shared properties 12 * will contain information, that is useful to the entire team and can be derived from single-bot observation. ( visible => spawned ; mover positions etc...). 13 * These inferred values can get dirty if the direct observation of the object is older than the origin of the property.</p> 14 * <p>Also, sharedProperties can be used for team-coordination information, orders and such. In this case, the properties generally won't get dirty.</p> 15 * @author srlok 16 * 17 */ 18 public interface ISharedProperty<TYPE> extends Cloneable { 19 20 //TODO simTime for properties 21 22 /** 23 * Returns value of the property. 24 * @return 25 */ 26 public TYPE getValue(); 27 28 /** 29 * Sets the value of the property - should be used by Pogamut Library developers only! 30 * @param value 31 */ 32 public void setValue(TYPE value); 33 34 /** 35 * Must return an exact duplicate of this ISharedProperty, this will be used 36 * to create old versions of SharedProperties in the worldView. 37 * @return 38 */ 39 public ISharedProperty clone(); 40 41 /** 42 * ObjectId of the object that this property is part of. 43 * @return 44 */ 45 public WorldObjectId getObjectId(); 46 47 /** 48 * Unique Id of this property. 49 * @return 50 */ 51 public PropertyId getPropertyId(); 52 53 /** 54 * SharedProperties are generally properties derived from bot's observation of the world. (like visible => spawned ). This may become a problem when the inferred 55 * information is outdated (ie. a bot can no longer see the spawned item, but the last time anybody from the team saw it, it was spawned). In this case, we consider 56 * the information "dirty", because the team only assumes the value. It can be wrong. (the game will always know the correct value of course, only our AI won't. 57 * @return 58 */ 59 public boolean isDirty(); 60 61 /** 62 * Class of the compositeObject this property belongs to. 63 * @return 64 */ 65 public Class<?> getCompositeClass(); 66 67 /** 68 * Returns class of the property value. Used to enforce value-class checks. 69 * @return 70 */ 71 public Class<?> getPropertyValueClass(); 72 73 /** 74 * Creates an event updating a sharedProperty of the same id and the specified team to the same value as the parent property. 75 * @param time 76 * @param teamId 77 * @return 78 */ 79 public ISharedPropertyUpdatedEvent createUpdateEvent(long time, ITeamId teamId); 80 81 public boolean nullOverrides(); 82 }