O
- The specified Operator
.Q
- The specified Operator
with a wildcard (?).public abstract class AbstractGenericOperator<O extends org.opt4j.core.optimizer.Operator<?>,Q extends org.opt4j.core.optimizer.Operator<?>> extends java.lang.Object implements GenericOperator<O>
GenericOperator
s.Modifier and Type | Class and Description |
---|---|
protected static class |
AbstractGenericOperator.ClassComparator
Comparator for a specific order: Superclasses always are sorted after
subclasses.
|
static class |
AbstractGenericOperator.OperatorClassPredicate
The
AbstractGenericOperator.OperatorClassPredicate returns true for a given
specific class. |
protected static class |
AbstractGenericOperator.OperatorHolder<P> |
static interface |
AbstractGenericOperator.OperatorPredicate
The
AbstractGenericOperator.OperatorPredicate interface. |
static class |
AbstractGenericOperator.OperatorVoidPredicate
The
AbstractGenericOperator.OperatorVoidPredicate interface is used as marker for
Operator s for which the predicate is not explicitly defined. |
Modifier and Type | Field and Description |
---|---|
protected com.google.common.collect.Multimap<java.lang.Class<? extends org.opt4j.core.Genotype>,O> |
classOperators |
protected java.util.List<java.lang.Class<? extends Q>> |
cldef |
protected com.google.common.collect.Multimap<AbstractGenericOperator.OperatorPredicate,O> |
genericOperators |
protected java.util.Map<java.util.AbstractMap.SimpleEntry<java.lang.Class<? extends org.opt4j.core.Genotype>,java.lang.Class<? extends org.opt4j.core.optimizer.Operator<?>>>,IOperatorSelector> |
operatorSelectors |
Constructor and Description |
---|
AbstractGenericOperator(java.lang.Class<? extends Q>... clazzes)
Constructs an
AbstractGenericOperator class with the given
clazzes of default operators. |
Modifier and Type | Method and Description |
---|---|
void |
addOperator(AbstractGenericOperator.OperatorPredicate predicate,
O operator)
Adds an operator.
|
void |
addOperatorSelector(java.util.AbstractMap.SimpleEntry<java.lang.Class<? extends org.opt4j.core.Genotype>,java.lang.Class<? extends org.opt4j.core.optimizer.Operator<?>>> selectorKey,
IOperatorSelector selector)
Adds an
IOperatorSelector that decides which Operator is executed in case
multiple Operator s are registered for a Genotype . |
O |
getOperator(org.opt4j.core.Genotype genotype)
Returns the
Operator for a specific Genotype . |
java.util.Collection<O> |
getOperators()
Returns all classOperators.
|
protected static <O> java.lang.Class<? extends org.opt4j.core.Genotype> |
getTarget(O operator)
Returns the target
Genotype for an operator based on the
Apply annotation. |
protected void |
inject(AbstractGenericOperator.OperatorHolder<Q> holder)
Inject and organize the operators.
|
protected java.util.Map<java.util.AbstractMap.SimpleEntry<java.lang.Class<? extends org.opt4j.core.Genotype>,java.lang.Class<? extends org.opt4j.core.optimizer.Operator<?>>>,IOperatorSelector> operatorSelectors
protected com.google.common.collect.Multimap<java.lang.Class<? extends org.opt4j.core.Genotype>,O extends org.opt4j.core.optimizer.Operator<?>> classOperators
protected com.google.common.collect.Multimap<AbstractGenericOperator.OperatorPredicate,O extends org.opt4j.core.optimizer.Operator<?>> genericOperators
protected java.util.List<java.lang.Class<? extends Q extends org.opt4j.core.optimizer.Operator<?>>> cldef
public AbstractGenericOperator(java.lang.Class<? extends Q>... clazzes)
AbstractGenericOperator
class with the given
clazzes of default operators.clazzes
- the default operators@Inject protected void inject(AbstractGenericOperator.OperatorHolder<Q> holder)
holder
- the operator holderpublic void addOperator(AbstractGenericOperator.OperatorPredicate predicate, O operator)
GenericOperator
addOperator
in interface GenericOperator<O extends org.opt4j.core.optimizer.Operator<?>>
predicate
- the operator predicateoperator
- The Operator
public void addOperatorSelector(java.util.AbstractMap.SimpleEntry<java.lang.Class<? extends org.opt4j.core.Genotype>,java.lang.Class<? extends org.opt4j.core.optimizer.Operator<?>>> selectorKey, IOperatorSelector selector)
GenericOperator
IOperatorSelector
that decides which Operator
is executed in case
multiple Operator
s are registered for a Genotype
.addOperatorSelector
in interface GenericOperator<O extends org.opt4j.core.optimizer.Operator<?>>
selector
- The IOperatorSelector
to add.public O getOperator(org.opt4j.core.Genotype genotype)
GenericOperator
Operator
for a specific Genotype
.getOperator
in interface GenericOperator<O extends org.opt4j.core.optimizer.Operator<?>>
genotype
- the genotypepublic java.util.Collection<O> getOperators()
GenericOperator
getOperators
in interface GenericOperator<O extends org.opt4j.core.optimizer.Operator<?>>
protected static <O> java.lang.Class<? extends org.opt4j.core.Genotype> getTarget(O operator)
Genotype
for an operator based on the
Apply
annotation.O
- the type of operatoroperator
- the operator