de.kumpe.hadooptimizer.impl
Class ReportingHalterWrapper<I>

java.lang.Object
  extended by de.kumpe.hadooptimizer.impl.NeedsRandomWrapperBase<Halter<I>>
      extended by de.kumpe.hadooptimizer.impl.ReportingHalterWrapper<I>
Type Parameters:
I - the individuals' type
All Implemented Interfaces:
Halter<I>, NeedsRandomGenerator, Stoppable, Wrapper<Halter<I>>, Serializable

public final class ReportingHalterWrapper<I>
extends NeedsRandomWrapperBase<Halter<I>>
implements Halter<I>, Stoppable

The ReportingHalterWrapper passed the EvaluationResults to each registered ReportingHalterWrapper.Reporter and then delegates the halt-decision the the specified Halter.

Author:
Christian Kumpe
See Also:
Serialized Form

Nested Class Summary
static interface ReportingHalterWrapper.Reporter<I>
          The ReportingHalterWrapper.Reporter is used by the ReportingHalterWrapper to report about the passed evaluation-results every cycle.
 
Field Summary
 
Fields inherited from class de.kumpe.hadooptimizer.impl.NeedsRandomWrapperBase
delegate
 
Constructor Summary
ReportingHalterWrapper(Halter<I> delegate)
          Creates a new ReportingHalterWrapper with the specified Halter delegate.
 
Method Summary
 void addReporter(ReportingHalterWrapper.Reporter<I> reporter)
          Adds a ReportingHalterWrapper.Reporter.
 boolean halt(Collection<EvaluationResult<I>> evaluationResults)
          Decides whether to stop or continue the evolution cycle.
 void removeReporter(ReportingHalterWrapper.Reporter<I> reporter)
          Remove a ReportingHalterWrapper.Reporter.
 void stop()
          Is called once to tell the Halter the stop the evoltion cycle at the end of the current iteration.
 String toString()
           
 
Methods inherited from class de.kumpe.hadooptimizer.impl.NeedsRandomWrapperBase
equals, getDelegate, hashCode, setRandomGenerator
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ReportingHalterWrapper

public ReportingHalterWrapper(Halter<I> delegate)
Creates a new ReportingHalterWrapper with the specified Halter delegate.

Parameters:
delegate - the Halter to which the halt-decision is delegated
Method Detail

halt

public boolean halt(Collection<EvaluationResult<I>> evaluationResults)
Description copied from interface: Halter
Decides whether to stop or continue the evolution cycle.

Specified by:
halt in interface Halter<I>
Parameters:
evaluationResults - the EvaluationResults of the parents for the next generation
Returns:
true to stop the evolution cycle, false to continue

stop

public void stop()
Description copied from interface: Stoppable
Is called once to tell the Halter the stop the evoltion cycle at the end of the current iteration.

Specified by:
stop in interface Stoppable

addReporter

public void addReporter(ReportingHalterWrapper.Reporter<I> reporter)
Adds a ReportingHalterWrapper.Reporter.

Parameters:
reporter - the ReportingHalterWrapper.Reporter to add; it will not check if the reporter is already registered

removeReporter

public void removeReporter(ReportingHalterWrapper.Reporter<I> reporter)
Remove a ReportingHalterWrapper.Reporter.

Parameters:
reporter - the ReportingHalterWrapper.Reporter to remove; it will only remove the first occurrence of the specified reporter

toString

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


Copyright © 2011 Christian Kumpe. All Rights Reserved.