<commit_before>package io.metacake.core.common;

/**
 * This class acts as a Millisecond timer.
 * <p>
 * It has two functions. The first is to record the difference between two times.
 * The second is to act as a 'time mechanism', blocking a thread until a give time.
 * The accuracy of this time is approximately the accuracy of System.nanoTime()
 * on the give system.
 *
 * @author florence
 */
public class MilliTimer {
    private static final long TO_MILLIS = 1_000_000;

    private long interval;
    private long lastActive;

    /**
     * Constructs a timer with a 0 interval.
     */
    public MilliTimer() {
        this(0);
    }

    /**
     * Constructs a timer with the given interval
     * @param interval The interval for this timer
     */
    public MilliTimer(long interval) {
        this.interval = interval;
        this.lastActive = System.nanoTime();
    }

    /**
     * Set the timing interval in milliseconds
     * @param interval the new interval
     */
    public void setInterval(long interval) {
        this.interval = interval;
    }

    /**
     * Block the current thread in such a way that {@code interval} milliseconds has occurred
     * since the last call to update. If greater than {@code interval}
     * milliseconds have passed, calling this has no effect.
     */
    public void block() {
        try {
            long waitFor = interval - this.poll();
            if (waitFor > 0) {
                Thread.sleep(waitFor);
            }
        } catch (InterruptedException e) {
            e.printStackTrace(); // TODO: convert to logger (when we have it)
            Thread.currentThread().interrupt();<commit_msg>removed a stack trace printout<commit_after>package io.metacake.core.common;

/**
 * This class acts as a Millisecond timer.
 * <p>
 * It has two functions. The first is to record the difference between two times.
 * The second is to act as a 'time mechanism', blocking a thread until a give time.
 * The accuracy of this time is approximately the accuracy of System.nanoTime()
 * on the give system.
 *
 * @author florence
 */
public class MilliTimer {
    private static final long TO_MILLIS = 1_000_000;

    private long interval;
    private long lastActive;

    /**
     * Constructs a timer with a 0 interval.
     */
    public MilliTimer() {
        this(0);
    }

    /**
     * Constructs a timer with the given interval
     * @param interval The interval for this timer
     */
    public MilliTimer(long interval) {
        this.interval = interval;
        this.lastActive = System.nanoTime();
    }

    /**
     * Set the timing interval in milliseconds
     * @param interval the new interval
     */
    public void setInterval(long interval) {
        this.interval = interval;
    }

    /**
     * Block the current thread in such a way that {@code interval} milliseconds has occurred
     * since the last call to update. If greater than {@code interval}
     * milliseconds have passed, calling this has no effect.
     */
    public void block() {
        try {
            long waitFor = interval - this.poll();
            if (waitFor > 0) {
                Thread.sleep(waitFor);
            }
        } catch (InterruptedException e) {
            // e.printStackTrace(); // TODO: convert to logger (when we have it)
            Thread.currentThread().interrupt();
{'fraction_non_alphanumeric': 0.08664688427299704, 'fraction_numerical': 0.005934718100890208, 'mean_word_length': 2.260154738878143, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4259757', 'n_tokens_mistral': 905, 'n_tokens_neox': 873, 'n_words': 359}