<commit_before>package org.jbehave.examples.threads.steps;

import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;

import org.jbehave.core.annotations.When;

public class ThreadsSteps {

    @When("$name counts to $n Mississippi")
    public void whenSomeoneCountsMississippis(String name, AtomicInteger n) {
        long start = System.currentTimeMillis();
        System.out.println(name + " starts counting to " + n);
        for (int i = 0; i < n.intValue(); i++) {
            long elapsed = System.currentTimeMillis() - start;
            System.out.println(name + " says " + i + " Mississippi (after " + elapsed + " millis)");
            sleepFor(1, TimeUnit.SECONDS);
        }
    }

    private void sleepFor(int i, TimeUnit unit) {
        try {
            unit.sleep(i);
        } catch (InterruptedException e) {
            System.out.println("Yawn! Who's there?");
            throw new RuntimeException(e);
        }
    }

    @When("something bad happens")
    public void whenSomethingBadHappens() {
        throw new RuntimeException("C'est la vie");
    }
}<commit_msg>Expressed elapsed time in s.<commit_after>package org.jbehave.examples.threads.steps;

import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;

import org.jbehave.core.annotations.When;

public class ThreadsSteps {

    @When("$name counts to $n Mississippi")
    public void whenSomeoneCountsMississippis(String name, AtomicInteger n) {
        long start = System.currentTimeMillis();
        System.out.println(name + " starts counting to " + n);
        for (int i = 0; i < n.intValue(); i++) {
            System.out.println(name + " says " + i + " Mississippi (after " + elapsedSeconds(start) + " s)");
            sleepFor(1, TimeUnit.SECONDS);
        }
    }

    private long elapsedSeconds(long start) {
        return (System.currentTimeMillis() - start)/1000L;
    }

    private void sleepFor(int i, TimeUnit unit) {
        try {
            unit.sleep(i);
        } catch (InterruptedException e) {
            System.out.println("Yawn! Who's there?");
            throw new RuntimeException(e);
        }
    }

    @When("something bad happens")
    public void whenSomethingBadHappens() {
        throw new RuntimeException("C'est la vie");
    }
}
{'fraction_non_alphanumeric': 0.12, 'fraction_numerical': 0.0034408602150537634, 'mean_word_length': 2.64576802507837, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '7395433', 'n_tokens_mistral': 696, 'n_tokens_neox': 677, 'n_words': 163}