<commit_before># JavaFixes

Adding some features which would be normally nice to have in Java

## Concurrency

`Runner` custom executor that allows you to wait until submitted tasks (of type `Runnable`, `Callable` or `Task`) have finished or failed

```Java
        Runner runner = Runner.runner(numberOfThreads);

        runner.runIn(2, SECONDS, runnable);
        runner.run(runnable);


         // blocks until all tasks are finished (or failed)
        runner.waitTillDone();


        // and reuse it

        runner.runIn(500, MILLISECONDS, callable);

        runner.waitTillDone();

        runner.shutdownAndAwaitTermination();

```

In case you would like to just monitor task submitted to existing scheduled executor then use `MonitoringTaskSubmitter` instead.

## Math

*this feature is currently in a beta / WIP state - although feature complete it still requires more testing, api fine-tuning and tuning of performance for arithmetic operations*

Introducing new class `Decimal`, that should fix the troubles we're currently facing when dealing with `BigDecimal`. The new class was needed as `BigDecimal`'s behavior can't be changed/patched because of backwards compatibility.

The advantages it provides are:

* `equals` reflects the `compareTo` behavior (plus `hashCode` is fixed respectively)

```Java
        assertThat(decimal("-1.2").equals(decimal("-1.200")), is(true));
        assertThat(decimal("-1.2").hashCode(), equalTo(decimal("-1.200").hashCode()));
```

* sensible defaults - using rounding `HALF_UP` (the one we used in school) when doing math operation (this is a default and you can pass in your own value) and max(28, valueA.scale(), valueB.scale()) decimal places when doing division (this will change soon to be defined as precision of 34 - which means number will be rounded after 34 digits - no matter the scale)

* extendible (although not by you :D ) - `Decimal` is an abstract class, and currently supports two subtypes `LongDecimal` (for number with precision up to 19 digits - backed by `long`) and `HugeDecimal` for everything else (backed by `BigInteger`). The library handles the transitions between them seamlessly when doing math operation and always uses the least memory consuming type. There are plans the introduce additional types `InfinityDecimal` and `NANDecimal` (that will be disabled by default)

* can evolve without affecting you - creation using only static factory methods doesn't expose defined types (you always refer to them as `Decimal`), so that the library can evolve without any changes needed on the users/client side.

* readable - able to use underscores during creation to improve readability (as in Java 7). Also can use short creation method `d(...)`:

```Java
        Decimal value = decimal("29_013_903_171.22");

        Decimal sum = d("0.456").plus(value);
```

* groovy and kotlin operators (sorry scala you have too ugly syntax):

```Groovy
        def monthlyInterest = d("129_550.00") * d("0.03") / d("12");

        def expectedPayment = monthlyInterest.descaleTo(2, RoundingMode.UP)
```

```Kotlin
        val monthlyInterest = d("129_550.00") * d("0.03") / d("12");

        val expectedPayment = monthlyInterest.descaleTo(2, RoundingMode.UP)
```

* handy constants - one of the confusing thing about `BigDecimal` for newcomers is what is the difference between scale and precision. To ease the understanding Decimal provides some readable constants on the `Scale` and `Precision` classes:

```Java
        d("123.4698").descaleTo(_2_Decimal_Places);  // = 123.46
<commit_msg>mtymes: more readme changes<commit_after># JavaFixes

Adding some features which would be normally nice to have in Java

## Concurrency

`Runner` custom executor that allows you to wait until submitted tasks (of type `Runnable`, `Callable` or `Task`) have finished or failed

```Java
        Runner runner = Runner.runner(numberOfThreads);

        runner.runIn(2, SECONDS, runnable);
        runner.run(runnable);


         // blocks until all tasks are finished (or failed)
        runner.waitTillDone();


        // and reuse it

        runner.runIn(500, MILLISECONDS, callable);

        runner.waitTillDone();

        runner.shutdownAndAwaitTermination();

```

In case you would like to just monitor task submitted to existing scheduled executor then use `MonitoringTaskSubmitter` instead.

## Math

*this feature is currently in a beta / WIP state - although feature complete it still requires more testing, api fine-tuning and tuning of performance for arithmetic operations*

Introducing new class `Decimal`, that should fix the troubles we're currently facing when dealing with `BigDecimal`. The new class was needed as `BigDecimal`'s behavior can't be changed/patched because of backwards compatibility.

The advantages it provides are:

* `equals` reflects the `compareTo` behavior (plus `hashCode` is fixed respectively)

```Java
        assertThat(decimal("-1.2").equals(decimal("-1.200")), is(true));
        assertThat(decimal("-1.2").hashCode(), equalTo(decimal("-1.200").hashCode()));
```

* sensible defaults - using rounding `HALF_UP` (the one we used in school) when doing math operation (this is a default and you can pass in your own value) and max(28, valueA.scale(), valueB.scale()) decimal places when doing division (this will change soon to be defined as precision of 34 - which means number will be rounded after 34 digits - no matter the scale)

* extendible (although not by you :D ) - `Decimal` is an abstract class, and currently supports two subtypes `LongDecimal` (for number with precision up to 19 digits - backed by `long`) and `HugeDecimal` for everything else (backed by `BigInteger`). The library handles the transitions between them seamlessly when doing math operation and always uses the least memory consuming type. There are plans the introduce additional types `InfinityDecimal` and `NANDecimal` (that will be disabled by default)

* can evolve without affecting you - creation using only static factory methods doesn't expose defined types (you always refer to them as `Decimal`), so that the library can evolve without any changes needed on the users/client side.

* readable - able to use underscores during creation to improve readability (as in Java 7). Also can use short creation method `d(...)`:

```Java
        Decimal value = decimal("29_013_903_171.22");

        Decimal sum = d("0.456").plus(value);
```

* groovy and kotlin operators (sorry scala you have too ugly syntax):

```Groovy
        def monthlyInterest = d("129_550.00") * d("0.03") / d("12");

        def totalDebt = d("129_550.00") + monthlyInterest * d("36");
```

```Kotlin
        val monthlyInterest = d("129_550.00") * d("0.03") / d("12");

        val totalDebt = d("129_550.00") + monthlyInterest * d("36");
```

* handy constants - one of the confusing thing about `BigDecimal` for newcomers is what is the difference between scale and precision. To ease the understanding Decimal provides some readable constants on the `Scale` and `Precision` classes:

```Java
        d("123.4698").descaleTo(_2_Decimal_Places);  // = 123.46

{'fraction_non_alphanumeric': 0.09579242636746144, 'fraction_numerical': 0.025806451612903226, 'mean_word_length': 4.014767932489452, 'pattern_counts': {'":': 0, '<': 3, '<?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': '843159', 'n_tokens_mistral': 2074, 'n_tokens_neox': 1867, 'n_words': 849}