Package org.biojavax.ga.impl
Class AbstractPopulation
- java.lang.Object
-
- org.biojava.utils.AbstractChangeable
-
- 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
Constructors Constructor Description AbstractPopulation()
AbstractPopulation(String name)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addOrganism(Organism org)
Adds an Organism to the Populationprotected abstract void
addOrganismImpl(Organism org)
void
addOrganisms(Set orgs)
Adds several organisms to the populationvoid
addOrganisms(Organism[] orgs)
Adds several organisms to the populationvoid
addOrganisms(Population orgs)
Adds the residents of one population to this oneString
getName()
void
removeAllOrganisms()
Removes all theOrganisms
in thisPopulation
protected abstract void
removeAllOrganismsImpl()
void
removeOrganism(Organism org)
Kills off the organismprotected abstract void
removeOrganismImpl(Organism org)
void
removeOrganisms(Set orgs)
Removes all theOrganisms
inorgs
void
removeOrganisms(Organism[] orgs)
Removes all theOrganisms
inorgs
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.biojava.utils.Changeable
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener
-
Methods inherited from interface org.biojavax.ga.Population
getOrganismByName, getOrganisms, organisms, size
-
-
-
-
Constructor Detail
-
AbstractPopulation
public AbstractPopulation()
-
AbstractPopulation
public AbstractPopulation(String name)
-
-
Method Detail
-
getName
public String getName()
- Specified by:
getName
in interfacePopulation
- 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 interfacePopulation
- 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 interfacePopulation
- 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 interfacePopulation
- 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 interfacePopulation
- 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 interfacePopulation
- 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 theOrganisms
inorgs
- Specified by:
removeOrganisms
in interfacePopulation
- Parameters:
orgs
- theOrganisms
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 theOrganisms
inorgs
- Specified by:
removeOrganisms
in interfacePopulation
- Parameters:
orgs
- theOrganisms
to remove.- Throws:
ChangeVetoException
- if the change is vetoed
-
removeAllOrganisms
public final void removeAllOrganisms() throws ChangeVetoException
Description copied from interface:Population
Removes all theOrganisms
in thisPopulation
- Specified by:
removeAllOrganisms
in interfacePopulation
- 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 interfacePopulation
- Parameters:
org
- the organism to kill- Throws:
ChangeVetoException
-
removeOrganismImpl
protected abstract void removeOrganismImpl(Organism org)
-
removeAllOrganismsImpl
protected abstract void removeAllOrganismsImpl()
-
-