Package org.biojavax.ga.functions
Class CrossOverFunction.NoCross
- java.lang.Object
-
- org.biojavax.ga.functions.CrossOverFunction.NoCross
-
- All Implemented Interfaces:
Changeable
,CrossOverFunction
- Enclosing interface:
- CrossOverFunction
public static final class CrossOverFunction.NoCross extends Object implements CrossOverFunction
A place holder CrossOverFunction that doesn't perform cross overs
- 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 Constructor Description NoCross()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addChangeListener(ChangeListener cl)
Add a listener that will be informed of all changes.void
addChangeListener(ChangeListener cl, ChangeType ct)
Add a listener that will be informed of changes of a given type.double[]
getCrossOverProbs()
int
getMaxCrossOvers()
boolean
isUnchanging(ChangeType t)
A particular ChangeType can never be raised by this Changeable.GACrossResult
performCrossOver(SymbolList chromA, SymbolList chromB)
Performs a cross between the pair of chromosomesvoid
removeChangeListener(ChangeListener c)
Remove a listener that was interested in all types of changes.void
removeChangeListener(ChangeListener cl, ChangeType ct)
Remove a listener that was interested in a specific types of changes.void
setCrossOverProbs(double[] crossOverProb)
Sets the probability of crossing at each base.void
setMaxCrossOvers(int max)
Sets an upper limit on the number of crosses.
-
-
-
Constructor Detail
-
NoCross
public NoCross()
-
-
Method Detail
-
getCrossOverProbs
public double[] getCrossOverProbs()
- Specified by:
getCrossOverProbs
in interfaceCrossOverFunction
- Returns:
- a single member array equal to {0.0}
-
getMaxCrossOvers
public int getMaxCrossOvers()
- Specified by:
getMaxCrossOvers
in interfaceCrossOverFunction
- Returns:
- 0 (after all you can't cross over with this function)
-
performCrossOver
public GACrossResult performCrossOver(SymbolList chromA, SymbolList chromB)
Description copied from interface:CrossOverFunction
Performs a cross between the pair of chromosomes- Specified by:
performCrossOver
in interfaceCrossOverFunction
- Parameters:
chromA
- The first chromosome in the crosschromB
- The second chromosome in the cross- Returns:
- A
GACross
that holds the results of the cross
-
setCrossOverProbs
public void setCrossOverProbs(double[] crossOverProb) 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:
crossOverProb
- an array of doubles giving the probability of a cross occuring at any place.- Throws:
ChangeVetoException
-
setMaxCrossOvers
public void setMaxCrossOvers(int max) 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:
max
- the limit on crosses- Throws:
ChangeVetoException
- if a ChangeListener vetoes this change
-
isUnchanging
public boolean isUnchanging(ChangeType t)
Description copied from interface:Changeable
A particular ChangeType can never be raised by this Changeable.
If this returns true, then it is guaranteed that change events of this type (and all child types) can never under any circumstances be fired by this Changeable instance. If it returns false, that does not mean that this type of event will or even can be raised, but that it is worth registering listeners incase.
- Specified by:
isUnchanging
in interfaceChangeable
- Parameters:
t
- the ChangeType to check- Returns:
- true if ChangeEvents of this type are guaranteed to never be fired
-
removeChangeListener
public void removeChangeListener(ChangeListener c)
Description copied from interface:Changeable
Remove a listener that was interested in all types of changes.- Specified by:
removeChangeListener
in interfaceChangeable
- Parameters:
c
- a ChangeListener to remove
-
addChangeListener
public void addChangeListener(ChangeListener cl)
Description copied from interface:Changeable
Add a listener that will be informed of all changes.- Specified by:
addChangeListener
in interfaceChangeable
- Parameters:
cl
- the ChangeListener to add
-
addChangeListener
public void addChangeListener(ChangeListener cl, ChangeType ct)
Description copied from interface:Changeable
Add a listener that will be informed of changes of a given type.- Specified by:
addChangeListener
in interfaceChangeable
- Parameters:
cl
- the ChangeListenerct
- the ChangeType it is to be informed of
-
removeChangeListener
public void removeChangeListener(ChangeListener cl, ChangeType ct)
Description copied from interface:Changeable
Remove a listener that was interested in a specific types of changes.- Specified by:
removeChangeListener
in interfaceChangeable
- Parameters:
cl
- a ChangeListener to removect
- the ChangeType that it was interested in
-
-