@Test public void injectListeners() { final MockOptimizer optimizer = new MockOptimizer(null, null, null, null, null); OptimizerIterationListener l1 = (int iteration) -> { }; OptimizerStateListener l2 = new OptimizerStateListener() { @Override public void optimizationStarted(Optimizer optimizer) { } @Override public void optimizationStopped(Optimizer optimizer) { } }; optimizer.injectListeners(Collections.singleton(l2), Collections.singleton(l1)); Assert.assertSame(l1, optimizer.iterationListeners.iterator().next()); Assert.assertSame(l2, optimizer.stateListeners.iterator().next()); }
@Inject protected void injectListeners(Set<OptimizerStateListener> stateListeners, Set<OptimizerIterationListener> iterationListeners) { this.stateListeners.addAll(stateListeners); this.iterationListeners.addAll(iterationListeners); }
AbstractOptimizer implements Optimizer { @Inject protected void injectListeners(Set<OptimizerStateListener> stateListeners, Set<OptimizerIterationListener> iterationListeners) { this.stateListeners.addAll(stateListeners); this.iterationListeners.addAll(iterationListeners); } }
AbstractOptimizer implements Optimizer { @Inject protected void injectListeners(Set<OptimizerStateListener> stateListeners, Set<OptimizerIterationListener> iterationListeners) { this.stateListeners.addAll(stateListeners); this.iterationListeners.addAll(iterationListeners); } AbstractOptimizer(Population population, Archive archive, IndividualCompleter completer, Control control,
			Iteration iteration); }
AbstractOptimizer implements Optimizer { @Inject protected void injectListeners(Set<OptimizerStateListener> stateListeners, Set<OptimizerIterationListener> iterationListeners) { this.stateListeners.addAll(stateListeners); this.iterationListeners.addAll(iterationListeners); } AbstractOptimizer(Population population, Archive archive, IndividualCompleter completer, Control control,
			Iteration iteration); @Override int getIteration(); @Override boolean isRunning(); @Override void startOptimization(); @Override void stopOptimization(); @Override void addOptimizerIterationListener(OptimizerIterationListener listener); @Override void addOptimizerStateListener(OptimizerStateListener listener); @Override void removeOptimizerIterationListener(OptimizerIterationListener listener); @Override void removeOptimizerStateListener(OptimizerStateListener listener); }
AbstractOptimizer implements Optimizer { @Inject protected void injectListeners(Set<OptimizerStateListener> stateListeners, Set<OptimizerIterationListener> iterationListeners) { this.stateListeners.addAll(stateListeners); this.iterationListeners.addAll(iterationListeners); } AbstractOptimizer(Population population, Archive archive, IndividualCompleter completer, Control control,
			Iteration iteration); @Override int getIteration(); @Override boolean isRunning(); @Override void startOptimization(); @Override void stopOptimization(); @Override void addOptimizerIterationListener(OptimizerIterationListener listener); @Override void addOptimizerStateListener(OptimizerStateListener listener); @Override void removeOptimizerIterationListener(OptimizerIterationListener listener); @Override void removeOptimizerStateListener(OptimizerStateListener listener);  }