de.kumpe.hadooptimizer.impl
Class EsMutatorWrapper

java.lang.Object
  extended by de.kumpe.hadooptimizer.impl.NeedsRandomWrapperBase<EsWrappableMutator>
      extended by de.kumpe.hadooptimizer.impl.EsMutatorWrapper
All Implemented Interfaces:
Mutator<EsIndividual>, NeedsRandomGenerator, Wrapper<EsWrappableMutator>, Serializable

public final class EsMutatorWrapper
extends NeedsRandomWrapperBase<EsWrappableMutator>
implements Mutator<EsIndividual>

Wrapp's a given EsWrappableMutator to mutate the double[] -individual nested in an EsIndividual.

It randomly increases or reduces the EsIndividual's increment by a given factor.

Author:
Christian Kumpe
See Also:
Serialized Form

Field Summary
 
Fields inherited from class de.kumpe.hadooptimizer.impl.NeedsRandomWrapperBase
delegate
 
Constructor Summary
EsMutatorWrapper(EsWrappableMutator delegate)
          Creates a new EsMutatorWrapper wrapping the specified EsWrappableMutator.
EsMutatorWrapper(EsWrappableMutator delegate, double incrementFactor)
          Creates a new EsMutatorWrapper wrapping the specified EsWrappableMutator.
 
Method Summary
 boolean equals(Object obj)
           
 int hashCode()
           
 EsIndividual mutate(EsIndividual individual)
          Creates a mutant of the given individual.
 void setRandomGenerator(org.apache.commons.math.random.RandomGenerator randomGenerator)
          Injects a RandomGenerator instance.
 String toString()
           
 
Methods inherited from class de.kumpe.hadooptimizer.impl.NeedsRandomWrapperBase
getDelegate
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EsMutatorWrapper

public EsMutatorWrapper(EsWrappableMutator delegate)
Creates a new EsMutatorWrapper wrapping the specified EsWrappableMutator.

Parameters:
delegate - an EsWrappableMutator to wrap

EsMutatorWrapper

public EsMutatorWrapper(EsWrappableMutator delegate,
                        double incrementFactor)
Creates a new EsMutatorWrapper wrapping the specified EsWrappableMutator.

Parameters:
delegate - an EsWrappableMutator to wrap
incrementFactor - the factor by which the current increment is randomly increased or reduced
Method Detail

setRandomGenerator

public void setRandomGenerator(org.apache.commons.math.random.RandomGenerator randomGenerator)
Description copied from interface: NeedsRandomGenerator
Injects a RandomGenerator instance.

Specified by:
setRandomGenerator in interface NeedsRandomGenerator
Overrides:
setRandomGenerator in class NeedsRandomWrapperBase<EsWrappableMutator>
Parameters:
randomGenerator - the new RandomGenerator instance

mutate

public EsIndividual mutate(EsIndividual individual)
Description copied from interface: Mutator
Creates a mutant of the given individual.

The general contract is to not modify the given individual, but return a mutated copy.

Specified by:
mutate in interface Mutator<EsIndividual>
Parameters:
individual - the individual to mutate
Returns:
the mutant of the passed individual

hashCode

public int hashCode()
Overrides:
hashCode in class NeedsRandomWrapperBase<EsWrappableMutator>

equals

public boolean equals(Object obj)
Overrides:
equals in class NeedsRandomWrapperBase<EsWrappableMutator>

toString

public String toString()
Overrides:
toString in class NeedsRandomWrapperBase<EsWrappableMutator>


Copyright © 2011 Christian Kumpe. All Rights Reserved.