org.jgap.impl
Class ChainOfSelectors
- java.lang.Object
-
- org.jgap.impl.ChainOfSelectors
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, java.lang.Comparable, ICloneable
public class ChainOfSelectors extends java.lang.Object implements java.io.Serializable, ICloneable, java.lang.Comparable
Ordered chain of NaturalSelectors. With this container you can plugin NaturalSelector implementations which will be performed either before (pre-) or after (post-selectors) registered genetic operations have been applied.- Since:
- 1.1
- See Also:
Configuration,Genotype, Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description ChainOfSelectors()Only for dynamic instantiation.ChainOfSelectors(Configuration a_conf)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaddAll(java.util.Collection a_c)voidaddNaturalSelector(NaturalSelector a_selector)Adds a natural selector to the chain.voidclear()Clears all registered selectors.java.lang.Objectclone()intcompareTo(java.lang.Object a_other)The compareTo-method.booleanequals(java.lang.Object a_obj)NaturalSelectorget(int a_index)Returns a Selector with specific index in the list.inthashCode()booleanisEmpty()java.util.Iteratoriterator()intsize()
-
-
-
Constructor Detail
-
ChainOfSelectors
public ChainOfSelectors()
Only for dynamic instantiation.- Since:
- 3.2
-
ChainOfSelectors
public ChainOfSelectors(Configuration a_conf)
-
-
Method Detail
-
addNaturalSelector
public void addNaturalSelector(NaturalSelector a_selector) throws InvalidConfigurationException
Adds a natural selector to the chain.- Parameters:
a_selector- the selector to be added- Throws:
InvalidConfigurationException- Since:
- 1.1 (previously part of class Configuration)
-
addAll
public void addAll(java.util.Collection a_c) throws InvalidConfigurationException- Parameters:
a_c- Collection to add all elements from- Throws:
InvalidConfigurationException- Since:
- 1.1
-
size
public int size()
- Returns:
- number of selectors in list
- Since:
- 1.1 (previously part of class Configuration)
-
isEmpty
public boolean isEmpty()
- Returns:
- true if number of selectors is zero
- Since:
- 1.1
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object a_obj)
- Overrides:
equalsin classjava.lang.Object- Parameters:
a_obj- Object- Returns:
- boolean
- Since:
- 1.1
-
get
public NaturalSelector get(int a_index)
Returns a Selector with specific index in the list.- Parameters:
a_index- the index of the Selector to read from the list- Returns:
- NaturalSelector
- Since:
- 1.1
-
clear
public void clear()
Clears all registered selectors.- Since:
- 1.1
-
iterator
public java.util.Iterator iterator()
- Returns:
- Iterator for iterating over list of selectors
- Since:
- 1.1
-
clone
public java.lang.Object clone()
- Specified by:
clonein interfaceICloneable- Overrides:
clonein classjava.lang.Object- Returns:
- deep clone of this instance
- Since:
- 3.2
-
compareTo
public int compareTo(java.lang.Object a_other)
The compareTo-method. Here we simply compare the class names of the contained selectors as INaturalSelector does not contain interface Comparable.- Specified by:
compareToin interfacejava.lang.Comparable- Parameters:
a_other- the other object to compare- Returns:
- -1, 0, 1
- Since:
- 3.2
-
-
DMelt 3.0 © DataMelt by jWork.ORG