robocode.control.events
Class BattleCompletedEvent

java.lang.Object
  extended by robocode.control.events.BattleEvent
      extended by robocode.control.events.BattleCompletedEvent

public class BattleCompletedEvent
extends BattleEvent

A BattleCompletedEvent is sent to onBattleCompleted() when the battle is completed successfully and results are available. This event will not occur if the battle is terminated or aborted by the user before the battle is completed.

Since:
1.6.2
Author:
Pavel Savara (original), Flemming N. Larsen (contributor)
See Also:
IBattleListener, BattleStartedEvent, BattleFinishedEvent

Constructor Summary
BattleCompletedEvent(BattleRules battleRules, BattleResults[] results)
          Creates a new BattleCompletedEvent.
 
Method Summary
 BattleRules getBattleRules()
          Returns the rules that was used in the battle.
 BattleResults[] getIndexedResults()
          Returns the unsorted battle results so that robot indexes can be used.
 BattleResults[] getSortedResults()
          Returns the battle results sorted on score, meaning that robot indexes cannot be used.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BattleCompletedEvent

public BattleCompletedEvent(BattleRules battleRules,
                            BattleResults[] results)
Creates a new BattleCompletedEvent.

Parameters:
battleRules - the rules that was used in the battle.
results - the indexed results of the battle. These are unsorted, but using robot indexes.
Method Detail

getBattleRules

public BattleRules getBattleRules()
Returns the rules that was used in the battle.

Returns:
the rules of the battle.

getSortedResults

public BattleResults[] getSortedResults()
Returns the battle results sorted on score, meaning that robot indexes cannot be used.

Returns:
a sorted array of BattleResults, where the results with the biggest score are placed first in the list.

getIndexedResults

public BattleResults[] getIndexedResults()
Returns the unsorted battle results so that robot indexes can be used.

Returns:
an unsorted array of BattleResults, where each index matches an index of a specific robot.


Copyright © 2010 Robocode. All Rights Reserved.