Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ New PositiveInteger type #661

Open
LVMVRQUXL opened this issue May 18, 2024 · 0 comments
Open

✨ New PositiveInteger type #661

LVMVRQUXL opened this issue May 18, 2024 · 0 comments
Assignees
Labels
common Item related to all platforms. feature New feature or request.
Milestone

Comments

@LVMVRQUXL
Copy link
Contributor

📝 Description

We want to introduce a PositiveInteger type in the org.kotools.types package for representing an integer that is greater than zero. This type should be available for all platforms and serializable as String.

Here's the Application Programming Interface (API) goal:

interface PositiveInteger {
    override fun equals(other: Any?): Boolean
    override fun hashCode(): Int
    fun toByte(): Byte
    fun toByteOrNull(): Byte?
    fun toShort(): Short
    fun toShortOrNull(): Short?
    fun toInt(): Int
    fun toIntOrNull(): Int?
    fun toLong(): Long
    fun toLongOrNull(): Long?
    override fun toString(): String
    companion object {
        fun fromByte(number: Byte): PositiveInteger = TODO()
        fun fromByteOrNull(number: Byte): PositiveInteger? = TODO()
        fun fromShort(number: Short): PositiveInteger = TODO()
        fun fromShortOrNull(number: Short): PositiveInteger? = TODO()
        fun fromInt(number: Int): PositiveInteger = TODO()
        fun fromIntOrNull(number: Int): PositiveInteger? = TODO()
        fun fromLong(number: Long): PositiveInteger = TODO()
        fun fromLongOrNull(number: Long): PositiveInteger? = TODO()
        fun fromString(number: Any): PositiveInteger = TODO()
        fun fromStringOrNull(number: Any): PositiveInteger? = TODO()
        fun random(): PositiveInteger = TODO()
    }
}
@LVMVRQUXL LVMVRQUXL added feature New feature or request. common Item related to all platforms. labels May 18, 2024
@LVMVRQUXL LVMVRQUXL modified the milestone: 4.6.0 May 21, 2024
@LVMVRQUXL LVMVRQUXL added this to the 4.6.0 milestone Jun 7, 2024
@LVMVRQUXL LVMVRQUXL self-assigned this Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
common Item related to all platforms. feature New feature or request.
Projects
None yet
Development

No branches or pull requests

1 participant