<commit_before>package net.sf.kerner.utils.counter;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;

import net.sf.kerner.utils.time.StopWatch;
import net.sf.kerner.utils.time.TimePeriod;

public class PercentDoneCounterWatch extends PercentDoneCounter implements PercentDoneCounter.Listener {

    public static interface Listener {
        void update(double percentDone, TimePeriod period);
    }

    private final List<Listener> listeners = new ArrayList<Listener>();

    private double percentDone;

    private final StopWatch watch = new StopWatch();

    public PercentDoneCounterWatch(final int totalElements, final TimeUnit unit) {
        super(totalElements);
        addListener(this);
        addRunnable(new Runnable() {
            public void run() {
                final TimePeriod period = watch.stop();
                for (final Listener l : listeners) {
                    l.update(percentDone, period);
                }
                watch.start();
            }
        });
    }

    public void addListener(final Listener listener) {
        listeners.add(listener);<commit_msg>API-Break: PercentDOneCounterWatch: remove obsolete constructor param.<commit_after>package net.sf.kerner.utils.counter;

import java.util.ArrayList;
import java.util.List;

import net.sf.kerner.utils.time.StopWatch;
import net.sf.kerner.utils.time.TimePeriod;

public class PercentDoneCounterWatch extends PercentDoneCounter implements PercentDoneCounter.Listener {

    public static interface Listener {
        void update(double percentDone, TimePeriod period);
    }

    private final List<Listener> listeners = new ArrayList<Listener>();

    private double percentDone;

    private final StopWatch watch = new StopWatch();

    public PercentDoneCounterWatch(final int totalElements) {
        super(totalElements);
        addListener(this);
        addRunnable(new Runnable() {
            public void run() {
                final TimePeriod period = watch.stop();
                for (final Listener l : listeners) {
                    l.update(percentDone, period);
                }
                watch.start();
            }
        });
    }

    public void addListener(final Listener listener) {
        listeners.add(listener);
{'fraction_non_alphanumeric': 0.08550347222222222, 'fraction_numerical': 0.0, 'mean_word_length': 2.682108626198083, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5630102', 'n_tokens_mistral': 598, 'n_tokens_neox': 563, 'n_words': 149}