cz.cuni.amis.pogamut.udk.communication.messages.gbinfomessages
Class FlagInfo

Package class diagram package FlagInfo
java.lang.Object
  extended by cz.cuni.amis.pogamut.base.communication.messages.InfoMessage
      extended by cz.cuni.amis.pogamut.udk.communication.messages.GBObjectUpdate
          extended by cz.cuni.amis.pogamut.udk.communication.messages.gbinfomessages.FlagInfo
All Implemented Interfaces:
IWorldChangeEvent, IWorldObjectUpdatedEvent, IWorldObject, ILocated, IViewable, ICompositeWorldObject, IGBViewable, IGBWorldObjectEvent, cz.cuni.amis.utils.listener.Event

public class FlagInfo
extends GBObjectUpdate
implements IGBWorldObjectEvent, IWorldObject, ILocated, IGBViewable

Synchronous message. FlagInfo contains all info about the flag in the CTF game mode. Is not sent in other game types. Corresponding GameBots message is FLG.


Nested Class Summary
static class FlagInfo.ObjectDisappeared
          Used to drop Visible flag from the object.
 
Nested classes/interfaces inherited from interface cz.cuni.amis.pogamut.base.communication.translator.event.IWorldObjectUpdatedEvent
IWorldObjectUpdatedEvent.DestroyWorldObject
 
Field Summary
protected  UnrealId Holder
          Id of player/bot holding the flag.
protected  UnrealId Id
          An unique Id for this flag, assigned by the game.
protected  Location Location
          An absolute location of the flag (Sent if we can actually see the flag).
static String PROTOTYPE
          Example how the message looks like - used during parser tests.
protected  boolean Reachable
          True if the bot can run here directly, false otherwise.
protected  String State
          Represents the state the flag is in.
protected  int Team
          The owner team of this flag.
protected  double Time
           
protected  boolean Visible
          True if the bot can see the flag.
 
Constructor Summary
FlagInfo()
          Used by Yylex to create empty message then to fill it's protected fields (Yylex is in the same package).
FlagInfo(FlagInfo original)
          Cloning constructor.
FlagInfo(FlagInfo Original, boolean Visible)
          Used to create event that drops the Visible flag of the item.
FlagInfo(UnrealId Id, Location Location, UnrealId Holder, int Team, boolean Reachable, boolean Visible, String State)
          Creates new instance of command FlagInfo.
 
Method Summary
 IGBWorldObjectDisappeared createDisappearEvent()
          Creates an update event that has to update visibility to false.
 boolean equals(Object obj)
           
 UnrealId getHolder()
          Id of player/bot holding the flag.
 UnrealId getId()
          An unique Id for this flag, assigned by the game.
 double getLastSeenTime()
           
 ILocalWorldObject getLocal()
           
 Location getLocation()
          An absolute location of the flag (Sent if we can actually see the flag).
 IWorldObject getObject()
          Returns original object (if method update() has already been called, for bot-programmer that is always true as the original object is updated and then the event is propagated).
 ISharedWorldObject getShared()
           
 long getSimTime()
           
 String getState()
          Represents the state the flag is in.
 IStaticWorldObject getStatic()
           
 int getTeam()
          The owner team of this flag.
protected  double getTime()
           
 int hashCode()
           
 boolean isReachable()
          True if the bot can run here directly, false otherwise.
 boolean isVisible()
          True if the bot can see the flag.
protected  void setTime(double time)
           
 String toHtmlString()
           
 String toString()
           
 IWorldObjectUpdateResult update(IWorldObject obj)
           
 
Methods inherited from class cz.cuni.amis.pogamut.base.communication.messages.InfoMessage
toJsonLiteral
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

PROTOTYPE

public static final String PROTOTYPE
Example how the message looks like - used during parser tests.

See Also:
Constant Field Values

Id

protected UnrealId Id
An unique Id for this flag, assigned by the game.


Location

protected Location Location
An absolute location of the flag (Sent if we can actually see the flag).


Holder

protected UnrealId Holder
Id of player/bot holding the flag. (Sent if we can actually see the flag and the flag is being carried, or if the flag is being carried by us).


Team

protected int Team
The owner team of this flag.


Reachable

protected boolean Reachable
True if the bot can run here directly, false otherwise.


Visible

protected boolean Visible
True if the bot can see the flag.


State

protected String State
Represents the state the flag is in. Can be "Held", "Dropped" or "Home" (note that the first letter does not have to be in upper case!).


Time

protected double Time
Constructor Detail

FlagInfo

public FlagInfo(UnrealId Id,
                Location Location,
                UnrealId Holder,
                int Team,
                boolean Reachable,
                boolean Visible,
                String State)
Creates new instance of command FlagInfo. Synchronous message. FlagInfo contains all info about the flag in the CTF game mode. Is not sent in other game types. Corresponding GameBots message for this command is .

Parameters:
Id - An unique Id for this flag, assigned by the game.
Location - An absolute location of the flag (Sent if we can actually see the flag).
Holder - Id of player/bot holding the flag. (Sent if we can actually see the flag and the flag is being carried, or if the flag is being carried by us).
Team - The owner team of this flag.
Reachable - True if the bot can run here directly, false otherwise.
Visible - True if the bot can see the flag.
State - Represents the state the flag is in. Can be "Held", "Dropped" or "Home" (note that the first letter does not have to be in upper case!).

FlagInfo

public FlagInfo(FlagInfo original)
Cloning constructor.


FlagInfo

public FlagInfo()
Used by Yylex to create empty message then to fill it's protected fields (Yylex is in the same package).


FlagInfo

public FlagInfo(FlagInfo Original,
                boolean Visible)
Used to create event that drops the Visible flag of the item.

Method Detail

getId

public UnrealId getId()
An unique Id for this flag, assigned by the game.

Specified by:
getId in interface IWorldObjectUpdatedEvent
Specified by:
getId in interface IWorldObject

getLocation

public Location getLocation()
An absolute location of the flag (Sent if we can actually see the flag).

Specified by:
getLocation in interface ILocated

getHolder

public UnrealId getHolder()
Id of player/bot holding the flag. (Sent if we can actually see the flag and the flag is being carried, or if the flag is being carried by us).


getTeam

public int getTeam()
The owner team of this flag.


isReachable

public boolean isReachable()
True if the bot can run here directly, false otherwise.


isVisible

public boolean isVisible()
True if the bot can see the flag.

Specified by:
isVisible in interface IViewable

getState

public String getState()
Represents the state the flag is in. Can be "Held", "Dropped" or "Home" (note that the first letter does not have to be in upper case!).


getTime

protected double getTime()

setTime

protected void setTime(double time)

getLastSeenTime

public double getLastSeenTime()

getLocal

public ILocalWorldObject getLocal()
Specified by:
getLocal in interface ICompositeWorldObject

getShared

public ISharedWorldObject getShared()
Specified by:
getShared in interface ICompositeWorldObject

getStatic

public IStaticWorldObject getStatic()
Specified by:
getStatic in interface ICompositeWorldObject

getSimTime

public long getSimTime()
Specified by:
getSimTime in interface IWorldChangeEvent
Specified by:
getSimTime in interface IWorldObject

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

createDisappearEvent

public IGBWorldObjectDisappeared createDisappearEvent()
Description copied from interface: IGBViewable
Creates an update event that has to update visibility to false.

Specified by:
createDisappearEvent in interface IGBViewable
Returns:

update

public IWorldObjectUpdateResult update(IWorldObject obj)
Specified by:
update in interface IWorldObjectUpdatedEvent

getObject

public IWorldObject getObject()
Returns original object (if method update() has already been called, for bot-programmer that is always true as the original object is updated and then the event is propagated).


toString

public String toString()
Overrides:
toString in class InfoMessage

toHtmlString

public String toHtmlString()


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