JAGA Homepage

org.jaga.util
Class SimpleCollectionOfIndividuals

java.lang.Object
  extended by org.jaga.util.SimpleCollectionOfIndividuals
All Implemented Interfaces:
Population

public class SimpleCollectionOfIndividuals
extends java.lang.Object
implements Population

TODO: Complete these comments.

Project: JAGA - Java API for Genetic Algorithms.

Company: University College London and JAGA.Org (http://www.jaga.org).

Copyright: (c) 2004 by G. Paperin.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, ONLY if you include a note of the original author(s) in any redistributed/modified copy.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or see http://www.gnu.org/licenses/gpl.html

Version:
JAGA public release 1.0 beta
Author:
Greg Paperin (greg@jaga.org)

Field Summary
private  java.util.ArrayList individuals
           
 
Constructor Summary
SimpleCollectionOfIndividuals()
           
 
Method Summary
 void add(Individual individual)
          Adds a specified individual to the population.
 void addAll(Individual[] individuals)
          Adds a list of individuals to the population.
 Individual[] getAllMembers()
          Gets an array of all individuals in the population.
 Individual getMember(int index)
          Gets an individual at the specifies index from the population.
If this population does not support an ordering, this method may throw an UnsupportedOperationException.
 int getSize()
          Gets the size of the population.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

individuals

private java.util.ArrayList individuals
Constructor Detail

SimpleCollectionOfIndividuals

public SimpleCollectionOfIndividuals()
Method Detail

getSize

public int getSize()
Description copied from interface: Population
Gets the size of the population.

Specified by:
getSize in interface Population
Returns:
The number of individuals in the population.

addAll

public void addAll(Individual[] individuals)
Description copied from interface: Population
Adds a list of individuals to the population.

Specified by:
addAll in interface Population
Parameters:
individuals - An array of individuals which should be added to the# population.

add

public void add(Individual individual)
Description copied from interface: Population
Adds a specified individual to the population.

Specified by:
add in interface Population
Parameters:
individual - To add to the population.

getAllMembers

public Individual[] getAllMembers()
Description copied from interface: Population
Gets an array of all individuals in the population.

Specified by:
getAllMembers in interface Population
Returns:
An array containing all individuals in the population.

getMember

public Individual getMember(int index)
Description copied from interface: Population
Gets an individual at the specifies index from the population.
If this population does not support an ordering, this method may throw an UnsupportedOperationException.

Specified by:
getMember in interface Population
Parameters:
index - The index of the population member to return.
Returns:
The member of the mopulation at the specified index.

JAGA Homepage

Go to JAGA Homepage