net.sourceforge.cilib.coevolution.competitors
Class PopulationCompetitorList

java.lang.Object
  extended by net.sourceforge.cilib.coevolution.competitors.PopulationCompetitorList
All Implemented Interfaces:
Serializable, Cloneable

public class PopulationCompetitorList
extends Object
implements Cloneable

This class represents a list of Competitor's with the same populationID

Author:
leo
See Also:
Serialized Form

Constructor Summary
PopulationCompetitorList(int populationID)
           
PopulationCompetitorList(int populationID, List<Competitor> competitors)
           
PopulationCompetitorList(PopulationCompetitorList other)
           
 
Method Summary
 void addCompetitor(Competitor competitor)
          Add a Competitor to this list
 void addCompetitors(List<Competitor> competitors)
          Add a List of Competitor's to this list
 void changePopulationID(int oldPopulationID, int newPopulationID)
          Change the population ID of this list
 void clear()
           
 PopulationCompetitorList getClone()
          Create a cloned copy of the current object and return it.
 Competitor getCompetitor(int index)
          Return the Competitor at the specified index in the list
 int getPopulationID()
          get the populationID of the Competitor's in this object
 void merge(PopulationCompetitorList other)
          Merge this list with the specified list
 void removeCompetitor(int index)
          Remove the Competitor at the specified index in the list
 void replaceWorst(Competitor newCompetitor)
          Search through the Competitor for the lowest fitness and replace it with newCompetitor if its fitness is better
 int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PopulationCompetitorList

public PopulationCompetitorList(int populationID)

PopulationCompetitorList

public PopulationCompetitorList(int populationID,
                                List<Competitor> competitors)

PopulationCompetitorList

public PopulationCompetitorList(PopulationCompetitorList other)
Method Detail

getCompetitor

public Competitor getCompetitor(int index)
Return the Competitor at the specified index in the list

Parameters:
index - The index in the list
Returns:
The competitor object

removeCompetitor

public void removeCompetitor(int index)
Remove the Competitor at the specified index in the list

Parameters:
index -

size

public int size()

addCompetitor

public void addCompetitor(Competitor competitor)
Add a Competitor to this list

Parameters:
competitor -

replaceWorst

public void replaceWorst(Competitor newCompetitor)
Search through the Competitor for the lowest fitness and replace it with newCompetitor if its fitness is better

Parameters:
newCompetitor - the new competitor to potentially add

addCompetitors

public void addCompetitors(List<Competitor> competitors)
Add a List of Competitor's to this list

Parameters:
competitors -

changePopulationID

public void changePopulationID(int oldPopulationID,
                               int newPopulationID)
Change the population ID of this list

Parameters:
oldPopulationID - The original populationID
newPopulationID - The new populationID

merge

public void merge(PopulationCompetitorList other)
Merge this list with the specified list

Parameters:
other -

clear

public void clear()

getClone

public PopulationCompetitorList 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 Cloneable
Returns:
An exact clone of the current object instance.
See Also:
Object.clone()

getPopulationID

public int getPopulationID()
get the populationID of the Competitor's in this object

Returns:


Copyright © 2009 CIRG. All Rights Reserved.