net.sourceforge.cilib.coevolution.score
Class EntityScoreboard

java.lang.Object
  extended by net.sourceforge.cilib.coevolution.score.EntityScoreboard
All Implemented Interfaces:
Serializable, Type, Cloneable

public class EntityScoreboard
extends Object
implements Type

This class provides a means of keeping a competition history of one specific entity within a CoevolutionAlgorithm.

Author:
cornelius gouws, leo
See Also:
Serialized Form

Constructor Summary
EntityScoreboard()
          Create a default score board.
EntityScoreboard(EntityScoreboard copy)
          Create a copy of the provided instance.
 
Method Summary
 void clearScoreBoard()
           
 boolean equals(Object obj)
          Compare the specified object with this type for equality.
 EntityScoreboard getClone()
          Create a cloned copy of the current object and return it.
 int getCompeteCount()
          Get the number of times the entity assosiated with this score board has competed.
 int getCompeteCount(int round)
           
 int getDrawCount()
          Get the number of times the entity this score board is used for has drawn.
 ArrayList<Fitness> getDrawScores(int round)
          Get all the Fitness values for games drawn by this entity for the specified round
 int getLoseCount()
          Get the number of times the entity this score board is used for has lost.
 ArrayList<Fitness> getLoseScores(int round)
          Get all the Fitness values for games lost by this entity for the specified round
 double getPercentageWon()
          Get the percentage of games won from the total games played
 ArrayList<EntityScore> getScores()
          Get a list of all the Scores for this entity
 ArrayList<Fitness> getScores(int round)
          Get all the Fitness values for all games played by this entity for the specified round
 int getWinCount()
          Get the number of times the entity this score board is used for has won.
 int getWinCount(int round)
           
 ArrayList<Fitness> getWinScores(int round)
          Get all the Fitness values for games Won by this entity for the specified round
 int hashCode()
          Returns the hash code value for this list.
 void mergeEntityScore(EntityScore scoreBoard)
          Merge the given EntityScore into this scoreboard
 void removeScores(int round)
          Remove all the scores from a specified round
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EntityScoreboard

public EntityScoreboard()
Create a default score board.


EntityScoreboard

public EntityScoreboard(EntityScoreboard copy)
Create a copy of the provided instance.

Parameters:
copy - The instance to copy.
Method Detail

getClone

public EntityScoreboard getClone()
Create a cloned copy of the current object and return it. In general the created copy will be a deep copy of the provided instance. As a result this operation an be quite expensive if used incorrectly.

Specified by:
getClone in interface Type
Specified by:
getClone in interface Cloneable
Returns:
An exact clone of the current object instance.
See Also:
Object.clone()

equals

public boolean equals(Object obj)
Compare the specified object with this type for equality. Returns true if and only if the specified object is also an instance of the same type.

Specified by:
equals in interface Type
Overrides:
equals in class Object
Parameters:
obj - The object to compare.
Returns:
true if equality exists, false otherwise.
See Also:
Object.equals(Object)

hashCode

public int hashCode()
Returns the hash code value for this list. The hash code of a list is defined to be the result of the following calculation:
  int hashCode = 7;
  Iterator<E> i = list.iterator();
  while (i.hasNext()) {
      E obj = i.next();
      hashCode = 31*hashCode + (obj==null ? 0 : obj.hashCode());
  }
 
This ensures that type1.equals(type2) implies that type1.hashCode()==type2.hashCode() for any two types, type1 and type2, as required by the general contract of Object.hashCode().

Specified by:
hashCode in interface Type
Overrides:
hashCode in class Object
Returns:
the hash code value for this list
See Also:
Object.equals(Object), Type.equals(Object)

getScores

public ArrayList<EntityScore> getScores()
Get a list of all the Scores for this entity

Returns:
A list of score histories.

getWinCount

public int getWinCount()
Get the number of times the entity this score board is used for has won.

Returns:
The number of wins in the score board.

getWinCount

public int getWinCount(int round)

getLoseCount

public int getLoseCount()
Get the number of times the entity this score board is used for has lost.

Returns:
The number of loses in the score board.

getDrawCount

public int getDrawCount()
Get the number of times the entity this score board is used for has drawn.

Returns:
The number of draws in the score board.

getCompeteCount

public int getCompeteCount()
Get the number of times the entity assosiated with this score board has competed.

Returns:
The number of sum of the wins, loses and draws.

getCompeteCount

public int getCompeteCount(int round)

mergeEntityScore

public void mergeEntityScore(EntityScore scoreBoard)
Merge the given EntityScore into this scoreboard

Parameters:
scoreBoard -

getWinScores

public ArrayList<Fitness> getWinScores(int round)
Get all the Fitness values for games Won by this entity for the specified round

Parameters:
round -
Returns:
the list of Fitness values

getDrawScores

public ArrayList<Fitness> getDrawScores(int round)
Get all the Fitness values for games drawn by this entity for the specified round

Parameters:
round -
Returns:
the list of Fitness values

getLoseScores

public ArrayList<Fitness> getLoseScores(int round)
Get all the Fitness values for games lost by this entity for the specified round

Parameters:
round -
Returns:
the list of Fitness values

getScores

public ArrayList<Fitness> getScores(int round)
Get all the Fitness values for all games played by this entity for the specified round

Parameters:
round -
Returns:
the list of Fitness values

getPercentageWon

public double getPercentageWon()
Get the percentage of games won from the total games played

Returns:
the percentage games won

clearScoreBoard

public void clearScoreBoard()

removeScores

public void removeScores(int round)
Remove all the scores from a specified round

Parameters:
round -


Copyright © 2009 CIRG. All Rights Reserved.