utils
Class BotInfoMap

java.lang.Object
  extended byutils.BotInfoMap

public class BotInfoMap
extends java.lang.Object

Map for listing bot infos

Author:
Francesco Baldisserri

Constructor Summary
BotInfoMap()
          Default constructor for BotInfoMap
 
Method Summary
 boolean containsInfo(java.lang.String botName)
          Check if map contains info about a robot
 BotInfo getInfo(java.lang.String botName)
          Get info about a robot (if present)
 BotInfo[] getInfoArray()
           
 java.lang.String[] getNamesArray()
           
 BotInfo getNearestBot(robocode.TeamRobot owner, boolean enemy, double maxEnergy, long maxInfoAge)
          Returns nearest BotInfo according to certain criteria
 boolean removeInfo(java.lang.String botName)
          Removes BotInfo if present
 java.lang.String toString()
           
 boolean updateInfo(BotInfo bot, long time)
          Update info regarding a bot
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BotInfoMap

public BotInfoMap()
Default constructor for BotInfoMap

Method Detail

getInfo

public BotInfo getInfo(java.lang.String botName)
Get info about a robot (if present)

Parameters:
botName - Desired info robot name
Returns:
Returns desired BotInfo if present, null otherwise

containsInfo

public boolean containsInfo(java.lang.String botName)
Check if map contains info about a robot

Parameters:
botName - Desired bot name
Returns:
Returns true if bot is present, false otherwise.

updateInfo

public boolean updateInfo(BotInfo bot,
                          long time)
Update info regarding a bot

Parameters:
bot - New BotInfo
time - BotInfo taking time
Returns:
Returns true if bot was already present, false otherwise

removeInfo

public boolean removeInfo(java.lang.String botName)
Removes BotInfo if present

Parameters:
botName - BotInfo name to be removed
Returns:
Returns true if bot was present, false otherwise

getInfoArray

public BotInfo[] getInfoArray()
Returns:
Returns a BotInfo array

getNamesArray

public java.lang.String[] getNamesArray()
Returns:
Returns a String array with robot names

getNearestBot

public BotInfo getNearestBot(robocode.TeamRobot owner,
                             boolean enemy,
                             double maxEnergy,
                             long maxInfoAge)
Returns nearest BotInfo according to certain criteria

Parameters:
owner - Owner robot
enemy - Flag to set enemy/friend searching
maxEnergy - Max energy allowed
maxInfoAge - Min info freshness
Returns:
Returns nearest BotInfo according to criteria if present, null otherwise

toString

public java.lang.String toString()