Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

New hierarchy of integers #132

Closed
13 tasks done
LVMVRQUXL opened this issue Dec 18, 2022 · 2 comments
Closed
13 tasks done

New hierarchy of integers #132

LVMVRQUXL opened this issue Dec 18, 2022 · 2 comments
Assignees
Labels
common Should work on all platforms. enhancement New feature or request. types Related to Kotools Types library.
Milestone

Comments

@LVMVRQUXL
Copy link
Contributor

LVMVRQUXL commented Dec 18, 2022

Description

Introduce a new hierarchy of integers in the kotools.types.number package with the following types:

  • AnyInt representing all integers
  • NonZeroInt representing integers other than zero
  • PositiveInt representing positive integers
  • NegativeInt representing negative integers
  • StrictlyPositiveInt representing strictly positive integers
  • StrictlyNegativeInt representing strictly negative integers
  • ZeroInt representing the zero integer.

Code example

sealed interface AnyInt
sealed interface NonZeroInt : AnyInt
sealed interface PositiveInt : AnyInt
sealed interface NegativeInt : AnyInt
class StrictlyPositiveInt : NonZeroInt, PositiveInt
class StrictlyNegativeInt : NonZeroInt, NegativeInt
object ZeroInt : PositiveInt, NegativeInt

Checklist

  • Design the hierarchy.
  • Implement the ZeroInt type.
  • Implement the StrictlyPositiveInt type.
  • Implement the StrictlyNegativeInt type.
  • Implement the NonZeroInt type.
  • Implement the PositiveInt type.
  • Implement the NegativeInt type.
  • Make all types serializable.
  • Make all types comparable with an AnyInt.
  • Remove the old types from the kotools.types package.
  • Refactor.
  • Update Work in progress section in changelog.
  • Complete tasks of this comment.
@LVMVRQUXL LVMVRQUXL added enhancement New feature or request. common Should work on all platforms. types Related to Kotools Types library. labels Dec 18, 2022
@LVMVRQUXL LVMVRQUXL added this to the Types v4.0.0 milestone Dec 18, 2022
@LVMVRQUXL LVMVRQUXL self-assigned this Dec 18, 2022
LVMVRQUXL added a commit that referenced this issue Dec 18, 2022
Impacted types: NonZeroInt, PositiveInt, NegativeInt, StrictlyPositiveInt and StrictlyNegativeInt
@LVMVRQUXL
Copy link
Contributor Author

Done.

@LVMVRQUXL
Copy link
Contributor Author

LVMVRQUXL commented Dec 21, 2022

Make the following types serializable:

  • ZeroInt
  • AnyInt.

Update the serialization of the following types:

  • StrictlyPositiveInt
  • StrictlyNegativeInt
  • NonZeroInt
  • PositiveInt
  • NegativeInt.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
common Should work on all platforms. enhancement New feature or request. types Related to Kotools Types library.
Projects
None yet
Development

No branches or pull requests

1 participant