DK96-OS / MathTools

Mathematical Software Components. This library is actively maintained, and aims to stay updated. New feature proposals are welcome, but may not be included.
Apache License 2.0
2 stars 1 forks source link

Number Integer Range Implementations #106

Closed DK96-OS closed 2 years ago

DK96-OS commented 2 years ago

There is an Integer Range Java interface that can be enhanced by providing two simple implementations.

Fixed Integer Range

This implementation is constructed with the start and end of range values. The values will be declared as final.

Mutable Integer Range

The key difference with this implementation is that the start and end of range values can be modified.

Constructors

The range constructors will ensure that regardless of input values, the start of range value will not be greater than the end of range. No exceptions will be thrown, the values will be swapped.

These implementations can provide optional constructors with one parameter that uses zero as the other range endpoint.

DK96-OS commented 2 years ago

The optional constructors are not practical. They are not going to be added.