public abstract class AbstractCrossOverFunction extends AbstractChangeable implements CrossOverFunction
CrossOverFunction
. All custom
implementations should inherit from here.CrossOverFunction.NoCross
CROSS_PROB, DEFAULT_CROSS_PROB, DEFAULT_MAX_CROSS, MAX_CROSSES, NO_CROSS
Modifier | Constructor and Description |
---|---|
protected |
AbstractCrossOverFunction() |
Modifier and Type | Method and 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.
|
addChangeListener, addChangeListener, generateChangeSupport, getChangeSupport, hasListeners, hasListeners, isUnchanging, removeChangeListener, removeChangeListener
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
performCrossOver
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener
protected AbstractCrossOverFunction()
public final void setMaxCrossOvers(int maxCrossOvers) throws ChangeVetoException
CrossOverFunction
setMaxCrossOvers
in interface CrossOverFunction
maxCrossOvers
- the limit on crossesChangeVetoException
- if a ChangeListener vetoes this changepublic final int getMaxCrossOvers()
getMaxCrossOvers
in interface CrossOverFunction
public final void setCrossOverProbs(double[] crossOverProbs) throws ChangeVetoException
CrossOverFunction
SymbolList
is given by crossOverProbs[1]
. CrossOverProbs[0]
is effectively
redundant as the cross would occur before the 1st position in the SymbolList
.
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 be DEFAULT_CROSS_PROB
setCrossOverProbs
in interface CrossOverFunction
crossOverProbs
- an array of doubles giving the probability of a
cross occuring at any place.ChangeVetoException
public final double[] getCrossOverProbs()
getCrossOverProbs
in interface CrossOverFunction
Copyright © 2014 BioJava. All rights reserved.