Package org.biojavax.ga.functions
Class AbstractCrossOverFunction
- java.lang.Object
-
- org.biojava.utils.AbstractChangeable
-
- org.biojavax.ga.functions.AbstractCrossOverFunction
-
- All Implemented Interfaces:
Changeable
,CrossOverFunction
- Direct Known Subclasses:
OrderCrossover
,SimpleCrossOverFunction
public abstract class AbstractCrossOverFunction extends AbstractChangeable implements CrossOverFunction
Abstract implementation ofCrossOverFunction
. All custom implementations should inherit from here.- Since:
- 1.5
- Version:
- 1.0
- Author:
- Mark Schreiber
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.biojavax.ga.functions.CrossOverFunction
CrossOverFunction.NoCross
-
-
Field Summary
-
Fields inherited from interface org.biojavax.ga.functions.CrossOverFunction
CROSS_PROB, DEFAULT_CROSS_PROB, DEFAULT_MAX_CROSS, MAX_CROSSES, NO_CROSS
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractCrossOverFunction()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double[]
getCrossOverProbs()
int
getMaxCrossOvers()
void
setCrossOverProbs(double[] crossOverProbs)
Sets the probability of crossing at each base.void
setMaxCrossOvers(int maxCrossOvers)
Sets an upper limit on the number of crosses.-
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.functions.CrossOverFunction
performCrossOver
-
-
-
-
Constructor Detail
-
AbstractCrossOverFunction
protected AbstractCrossOverFunction()
-
-
Method Detail
-
setMaxCrossOvers
public final void setMaxCrossOvers(int maxCrossOvers) throws ChangeVetoException
Description copied from interface:CrossOverFunction
Sets an upper limit on the number of crosses. Its up to the implementation to decide what to do when the limit is reached although a good convention would be to keep only the first N crosses from the left end (5' end) of the sequence. By convention the default upper limit is DEFAULT_MAX_CROSS (eg infinite). This value should be used as the default by all implementations.- Specified by:
setMaxCrossOvers
in interfaceCrossOverFunction
- Parameters:
maxCrossOvers
- the limit on crosses- Throws:
ChangeVetoException
- if a ChangeListener vetoes this change
-
getMaxCrossOvers
public final int getMaxCrossOvers()
- Specified by:
getMaxCrossOvers
in interfaceCrossOverFunction
- Returns:
- the limit on crosses.
-
setCrossOverProbs
public final void setCrossOverProbs(double[] crossOverProbs) throws ChangeVetoException
Description copied from interface:CrossOverFunction
Sets the probability of crossing at each base. Each position in the array corresponds to a position in the sequences to be crossed. The probability of a cross occuring after position 1 in theSymbolList
is given bycrossOverProbs[1]
.CrossOverProbs[0]
is effectively redundant as the cross would occur before the 1st position in theSymbolList
. By convention if the array is shorter than the SymbolList it is being applied to then the last value in the array will be applied to every subsequent residue. The default value in all implementations should beDEFAULT_CROSS_PROB
- Specified by:
setCrossOverProbs
in interfaceCrossOverFunction
- Parameters:
crossOverProbs
- an array of doubles giving the probability of a cross occuring at any place.- Throws:
ChangeVetoException
-
getCrossOverProbs
public final double[] getCrossOverProbs()
- Specified by:
getCrossOverProbs
in interfaceCrossOverFunction
-
-