<commit_before><html>
<head>
    <title>javafall</title>
</head>
<body>
Cool and funny parallel programming.
<h2>Usage examples</h2>
<b>Example 1:</b> Root mean square:
<p>
    The code below shows how it is possible to implement the computation of the root mean square of
    some input data by distributing them in a predefined number of background threads.
</p>
<pre>
    <code>
        final float[] input;

        ...

        // Sequential

        double sum = 0;

        for (final float sample : input) {

        final double d = sample;
        sum += (d * d);
        }

        final double sRms = Math.sqrt(sum / input.length);

        // Parallel

        final Double pRms = (Double) fall().start()
        // Let the optimum number of threads be automatically computed
        .inBackground()
        // Equally distribute the load among them
        .distribute()
        // Compute the square of each sample
        .chain(Rapid.leapGenerator(new RapidLeap() {

        public Double onSample(final Float sample) {

        final double d = sample;
        return (d * d);
        }

        }, this))
        // Merge the results in a single thread
        .inBackground(1)
        // Accumulate the sum and then calculate the square root mean
        .chain(new RapidLeap() {

        private int mCount;

        private double mSum;

        public void onSquare(final Double square) {

        mSum += square;
        ++mCount;
        }

        public Double onComplete(final Discharge ignored) {

        return Math.sqrt(mSum / mCount);
        }

        })
        // Pull the input data along the flow...
        .pull(Drops.asList(input).toObjects())
        // ...and finally collect the result
        .next();

        assert pRms == sRms;
    </code>
</pre>
</body>
</html><commit_msg>Unit tests + documentation<commit_after><html>
<head>
    <title>javafall</title>
</head>
<body>
Cool and funny parallel programming.
<h2>Usage examples</h2>
<b>Example 1:</b> Root mean square:
<p>
The code below shows how it is possible to implement the computation of the root mean square of some input data by distributing them in a predefined number of background threads.
</p>
<pre>
    <code>
        final float[] input;

        ...

        // Sequential

        double sum = 0;

        for (final float sample : input) {

            final double d = sample;
            sum += (d * d);
        }

        final double sRms = Math.sqrt(sum / input.length);

        // Parallel

        final Double pRms = (Double) fall().start()
                                            // Let the optimum number of threads be automatically computed
                                            .inBackground()
                                            // Equally distribute the load among them
                                            .distribute()
                                            // Compute the square of each sample
                                            .chain(Rapid.leapGenerator(new RapidLeap() {

                                                public Double onSample(final Float sample) {

                                                    final double d = sample;
                                                    return (d * d);
                                                }

                                            }, this))
                                            // Merge the results in a single thread
                                            .inBackground(1)
                                            // Accumulate the sum and then calculate the square root mean
                                            .chain(new RapidLeap() {

                                                private int mCount;

                                                private double mSum;

                                                public void onSquare(final Double square) {

                                                    mSum += square;
                                                    ++mCount;
                                                }

                                                public Double onComplete(final Discharge ignored) {

                                                    return Math.sqrt(mSum / mCount);
                                                }

                                            })
                                            // Pull the input data along the flow...
                                            .pull(Drops.asList(input).toObjects())
                                            // ...and finally collect the result
                                            .next();

        assert pRms == sRms;
    </code>
</pre>
</body>
</html>
{'fraction_non_alphanumeric': 0.07808247854301863, 'fraction_numerical': 0.0020933640360058614, 'mean_word_length': 0.9941569282136895, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 58, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4861908', 'n_tokens_mistral': 1019, 'n_tokens_neox': 958, 'n_words': 367}