Example usage for org.apache.commons.lang3.event EventListenerSupport create

List of usage examples for org.apache.commons.lang3.event EventListenerSupport create

Introduction

In this page you can find the example usage for org.apache.commons.lang3.event EventListenerSupport create.

Prototype

public static <T> EventListenerSupport<T> create(final Class<T> listenerInterface) 

Source Link

Document

Creates an EventListenerSupport object which supports the specified listener type.

Usage

From source file:io.cloudslang.lang.tools.build.tester.parallel.services.TestCaseEventDispatchService.java

@PostConstruct
void initializeListeners() {
    this.listenerList = EventListenerSupport.create(ISlangTestCaseEventListener.class);
}

From source file:iDynoOptimizer.MOEAFramework26.src.org.moeaframework.util.progress.ProgressHelper.java

/**
 * Constructs a new progress helper for generating progress reports for
 * the given executor.//from  w w  w .  j  a v a 2s.c o  m
 * 
 * @param executor the executor that will be reporting progress
 */
public ProgressHelper(Executor executor) {
    super();
    this.executor = executor;

    statistics = new DescriptiveStatistics(25);
    listeners = EventListenerSupport.create(ProgressListener.class);
}

From source file:iDynoOptimizer.MOEAFramework26.src.org.moeaframework.algorithm.AdaptiveTimeContinuation.java

/**
 * Decorates the specified algorithm with adaptive time continuation.
 * /* w w w .j av a  2s .  c om*/
 * @param algorithm the algorithm being decorated
 * @param windowSize the number of iterations between invocations of
 *        {@code check}
 * @param maxWindowSize the maximum number of iterations allowed since the
 *        last restart before forcing a restart
 * @param populationRatio the population-to-archive ratio
 * @param minimumPopulationSize the minimum size of the population
 * @param maximumPopulationSize the maximum size of the population
 * @param selection the selection operator for selecting solutions from the
 *        archive during a restart
 * @param variation the variation operator for mutating solutions selected
 *        from the archive during a restart
 */
public AdaptiveTimeContinuation(EvolutionaryAlgorithm algorithm, int windowSize, int maxWindowSize,
        double populationRatio, int minimumPopulationSize, int maximumPopulationSize, Selection selection,
        Variation variation) {
    super(algorithm, windowSize, FrequencyType.STEPS);
    this.maxWindowSize = maxWindowSize;
    this.populationRatio = populationRatio;
    this.minimumPopulationSize = minimumPopulationSize;
    this.maximumPopulationSize = maximumPopulationSize;
    this.selection = selection;
    this.variation = variation;

    listeners = EventListenerSupport.create(RestartListener.class);
}

From source file:iDynoOptimizer.MOEAFramework26.src.org.moeaframework.analysis.diagnostics.Controller.java

/**
 * Constructs a new controller for the specified {@code DiagnosticTool}
 * instance.//from  www .  j  a  va 2 s . c om
 * 
 * @param frame the {@code DiagnosticTool} instance using this controller
 */
public Controller(DiagnosticTool frame) {
    super();
    this.frame = frame;

    listeners = EventListenerSupport.create(ControllerListener.class);
    accumulators = new HashMap<ResultKey, List<Accumulator>>();
}

From source file:org.tros.logo.swing.LogoPanel.java

@Override
public Drawable cloneDrawable() {
    Drawable d = new Drawable() {

        private final ArrayList<Drawable> queuedCommandsCopy = new ArrayList<>();
        protected final EventListenerSupport<DrawListener> listenersCopy = EventListenerSupport
                .create(DrawListener.class);

        /**//from  w  ww  .j  a v  a2  s.  c om
         * Anonymous class initializer.
         * Clone all internal drawable objects.
         */
        {
            for (Drawable d : queuedCommands) {
                queuedCommandsCopy.add(d.cloneDrawable());
            }
        }

        @Override
        public void draw(Graphics2D g2d, TurtleState turtleState) {
            //since this list can be written to, do not swith to for-each
            for (int ii = 0; ii < queuedCommandsCopy.size(); ii++) {
                queuedCommandsCopy.get(ii).draw(g2d, turtleState);
                listenersCopy.fire().drawn(this);
            }
        }

        @Override
        public void addListener(DrawListener listener) {
            listenersCopy.addListener(listener);
        }

        @Override
        public void removeListener(DrawListener listener) {
            listenersCopy.removeListener(listener);
        }

        @Override
        public Drawable cloneDrawable() {
            return this;
        }
    };
    return d;
}