<commit_before>package ru.agolovin;

/**
 * @author agolovin (<EMAIL>)
 * @version $Id$
 * @since 0.1
 */

public class StringParse {

    /**
     * Incoming string.
     */
    private String str;

    /**
     * Constructor.
     *
     * @param str String.
     */
    StringParse(String str) {
        this.str = str;
    }

    /**
     * Main nethod.
     *
     * @param args String array
     */
    public static void main(String[] args) {
        String str = "word word2      word3";
        System.out.println("Start");
        System.out.println(String.format("Incoming string: %s", str));
        StringParse stringParse = new StringParse(str);
        Thread threadOne = new Thread(stringParse.new CountWords());
        Thread threadTwo = new Thread(stringParse.new CountWhiteSpace());
        long startTime = System.currentTimeMillis();
        threadOne.start();
        try {
            threadOne.join(200);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        threadTwo.start();
        try {
            threadTwo.join(200);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        while (threadOne.isAlive() || threadTwo.isAlive()) {
            if ((threadOne.isAlive() || threadTwo.isAlive()) && (startTime - System.currentTimeMillis() < 1000)) {
                if (threadOne.isAlive()) {
                    stopThread(threadOne);
                }

                if (threadTwo.isAlive()) {
                    stopThread(threadTwo);
                }
            }
        }<commit_msg>add task2 in part1 chapter7 package2<commit_after>package ru.agolovin;

/**
 * @author agolovin (<EMAIL>)
 * @version $Id$
 * @since 0.1
 */

public class StringParse {

    /**
     * Incoming string.
     */
    private String str;

    /**
     * Constructor.
     *
     * @param str String.
     */
    StringParse(String str) {
        this.str = str;
    }

    /**
     * Main nethod.
     *
     * @param args String array
     */
    public static void main(String[] args) {
        String str = "word word2      word3";
        System.out.println("Start");
        System.out.println(String.format("Incoming string: %s", str));
        StringParse stringParse = new StringParse(str);
        Thread threadOne = new Thread(stringParse.new CountWords());
        Thread threadTwo = new Thread(stringParse.new CountWhiteSpace());
        long startTime = System.currentTimeMillis();
        threadOne.start();
        try {
            threadOne.join(200);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        threadTwo.start();
        try {
            threadTwo.join(200);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        while (threadOne.isAlive() || threadTwo.isAlive()) {
            if ((threadOne.isAlive() || threadTwo.isAlive()) && (startTime - System.currentTimeMillis() > 1000)) {
                if (threadOne.isAlive()) {
                    stopThread(threadOne);
                }

                if (threadTwo.isAlive()) {
                    stopThread(threadTwo);
                }
            }
        }
{'fraction_non_alphanumeric': 0.12620453838980417, 'fraction_numerical': 0.009947155735156978, 'mean_word_length': 1.7087542087542087, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, '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': '3837641', 'n_tokens_mistral': 934, 'n_tokens_neox': 896, 'n_words': 189}