org.biojavax.ga.impl
Class AbstractPopulation

java.lang.Object
  extended by org.biojava.utils.AbstractChangeable
      extended by org.biojavax.ga.impl.AbstractPopulation
All Implemented Interfaces:
Changeable, Population
Direct Known Subclasses:
SimplePopulation

public abstract class AbstractPopulation
extends AbstractChangeable
implements Population

Most Population implementations will want to inherit from here. This class doesn't define how Organims are stored or accessed so inheriting classes can define that themselves.

Since:
1.5
Version:
1.0
Author:
Mark Schreiber

Field Summary
 
Fields inherited from interface org.biojavax.ga.Population
NAME, ORGANISMS
 
Constructor Summary
AbstractPopulation()
           
AbstractPopulation(String name)
           
 
Method Summary
 void addOrganism(Organism org)
          Adds an Organism to the Population
protected abstract  void addOrganismImpl(Organism org)
           
 void addOrganisms(Organism[] orgs)
          Adds several organisms to the population
 void addOrganisms(Population orgs)
          Adds the residents of one population to this one
 void addOrganisms(Set orgs)
          Adds several organisms to the population
 String getName()
           
 void removeAllOrganisms()
          Removes all the Organisms in this Population
protected abstract  void removeAllOrganismsImpl()
           
 void removeOrganism(Organism org)
          Kills off the organism
protected abstract  void removeOrganismImpl(Organism org)
           
 void removeOrganisms(Organism[] orgs)
          Removes all the Organisms in orgs
 void removeOrganisms(Set orgs)
          Removes all the Organisms in orgs
 void setName(String name)
          Sets the name of the population
 
Methods inherited from class org.biojava.utils.AbstractChangeable
addChangeListener, addChangeListener, generateChangeSupport, getChangeSupport, hasListeners, hasListeners, isUnchanging, removeChangeListener, removeChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.biojavax.ga.Population
getOrganismByName, getOrganisms, organisms, size
 
Methods inherited from interface org.biojava.utils.Changeable
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener
 

Constructor Detail

AbstractPopulation

public AbstractPopulation()

AbstractPopulation

public AbstractPopulation(String name)
Method Detail

getName

public String getName()
Specified by:
getName in interface Population
Returns:
the name of the population

setName

public final void setName(String name)
                   throws ChangeVetoException
Description copied from interface: Population
Sets the name of the population

Specified by:
setName in interface Population
Parameters:
name - set the name to this.
Throws:
ChangeVetoException - if the name may not be changed

addOrganism

public final void addOrganism(Organism org)
                       throws ChangeVetoException,
                              IllegalOrganismException
Description copied from interface: Population
Adds an Organism to the Population

Specified by:
addOrganism in interface Population
Parameters:
org - the organism
Throws:
ChangeVetoException
IllegalOrganismException - if for some reason the organism is invalid

addOrganismImpl

protected abstract void addOrganismImpl(Organism org)
                                 throws IllegalOrganismException
Throws:
IllegalOrganismException

addOrganisms

public final void addOrganisms(Organism[] orgs)
                        throws ChangeVetoException,
                               IllegalOrganismException
Description copied from interface: Population
Adds several organisms to the population

Specified by:
addOrganisms in interface Population
Parameters:
orgs - the organisms to add
Throws:
ChangeVetoException
IllegalOrganismException - if for some reason the organism is invalid

addOrganisms

public final void addOrganisms(Set orgs)
                        throws ChangeVetoException,
                               IllegalOrganismException
Description copied from interface: Population
Adds several organisms to the population

Specified by:
addOrganisms in interface Population
Parameters:
orgs - the organisms to add
Throws:
ChangeVetoException
IllegalOrganismException - if for some reason the organism is invalid

addOrganisms

public final void addOrganisms(Population orgs)
                        throws ChangeVetoException,
                               IllegalOrganismException
Description copied from interface: Population
Adds the residents of one population to this one

Specified by:
addOrganisms in interface Population
Parameters:
orgs - the population to add
Throws:
ChangeVetoException
IllegalOrganismException - if for some reason the organism is invalid

removeOrganisms

public final void removeOrganisms(Organism[] orgs)
                           throws ChangeVetoException
Description copied from interface: Population
Removes all the Organisms in orgs

Specified by:
removeOrganisms in interface Population
Parameters:
orgs - the Organisms to remove.
Throws:
ChangeVetoException - if the change is vetoed

removeOrganisms

public final void removeOrganisms(Set orgs)
                           throws ChangeVetoException
Description copied from interface: Population
Removes all the Organisms in orgs

Specified by:
removeOrganisms in interface Population
Parameters:
orgs - the Organisms to remove.
Throws:
ChangeVetoException - if the change is vetoed

removeAllOrganisms

public final void removeAllOrganisms()
                              throws ChangeVetoException
Description copied from interface: Population
Removes all the Organisms in this Population

Specified by:
removeAllOrganisms in interface Population
Throws:
ChangeVetoException - if the change is vetoed

removeOrganism

public final void removeOrganism(Organism org)
                          throws ChangeVetoException
Description copied from interface: Population
Kills off the organism

Specified by:
removeOrganism in interface Population
Parameters:
org - the organism to kill
Throws:
ChangeVetoException

removeOrganismImpl

protected abstract void removeOrganismImpl(Organism org)

removeAllOrganismsImpl

protected abstract void removeAllOrganismsImpl()