Skip to content
Merged
42 changes: 21 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# Kotlin Multiplatform Bounded Open/Closed Generic Intervals

[![Publish snapshots](https://github.com/Whathecode/kotlinx.interval/actions/workflows/publish-snapshots.yml/badge.svg)](https://github.com/Whathecode/kotlinx.interval/actions/workflows/ci.yml)
[![Sonatype Nexus (Snapshots)](https://img.shields.io/nexus/s/io.github.whathecode.kotlinx.interval/kotlinx-interval?server=https%3A%2F%2Fs01.oss.sonatype.org)](https://s01.oss.sonatype.org/content/repositories/snapshots/io/github/whathecode/kotlinx/interval)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.github.whathecode.kotlinx.interval/kotlinx-interval/badge.svg?color=orange)](https://mvnrepository.com/artifact/io.github.whathecode.kotlinx.interval)
[![Build](https://img.shields.io/github/actions/workflow/status/Whathecode/kotlinx.interval/publish-snapshots.yml
)](https://github.com/Whathecode/kotlinx.interval/actions/workflows/publish-snapshots.yml)
[![Snapshot](https://img.shields.io/maven-metadata/v?metadataUrl=https%3A%2F%2Fcentral.sonatype.com%2Frepository%2Fmaven-snapshots%2Fio%2Fgithub%2Fwhathecode%2Fkotlinx%2Finterval%2Fkotlinx-interval%2Fmaven-metadata.xml
)](https://central.sonatype.com/repository/maven-snapshots/io/github/whathecode/kotlinx/interval/kotlinx-interval/maven-metadata.xml)
[![Maven Central](https://img.shields.io/maven-central/v/io.github.whathecode.kotlinx.interval/kotlinx-interval
)](https://central.sonatype.com/artifact/io.github.whathecode.kotlinx.interval/kotlinx-interval)

Represent closed, open, or half-open, bounded intervals in Kotlin and perform common operations on them.
_Values_ covered by the interval can be of a different type than _distances_ between those values.
Expand All @@ -18,7 +21,7 @@ val shifted = interval shr 10u // Shifted right by 10: [10, 20)
```

This protects against overflows (e.g. if `size > Int.MAX_VALUE`) but also offers better semantics.
For example, this library supports [kotlinx datetime](https://github.com/Kotlin/kotlinx-datetime) `Instant` values which are a `Duration` apart.
For example, this library supports `Instant` values which are a `Duration` apart.

```kotlin
val now = Clock.System.now()
Expand Down Expand Up @@ -120,20 +123,17 @@ To achieve this, it directs type operations to `IntervalTypeOperations` which th

The following interval types are included in `io.github.whathecode.kotlinx.interval:kotlinx-interval` on Maven:

| Type | Values (`T`) | Distances (`TSize`) |
|:----------------:|:------------:|:-------------------:|
| `ByteInterval` | `Byte` | `UByte` |
| `ShortInterval` | `Short` | `UShort` |
| `IntInterval` | `Int` | `UInt` |
| `LongInterval` | `Long` | `ULong` |
| `FloatInterval` | `Float` | `Double` |
| `DoubleInterval` | `Double` | `Double` |
| `UByteInterval` | `UByte` | `UByte` |
| `UShortInterval` | `UShort` | `UShort` |
| `UIntInterval` | `UInt` | `UInt` |
| `ULongInterval` | `ULong` | `ULong` |
| `CharInterval` | `Char` | `UShort` |

### Date/time intervals
Date/time intervals are implemented as `InstantInterval` using the [kotlinx datetime](https://github.com/Kotlin/kotlinx-datetime) library.
Since you may not always want to pull in this dependency, this class is published separately in `io.github.whathecode.kotlinx.interval:kotlinx-interval-datetime`.
| Type | Values (`T`) | Distances (`TSize`) |
|:------------------:|:------------:|:-------------------:|
| `ByteInterval` | `Byte` | `UByte` |
| `ShortInterval` | `Short` | `UShort` |
| `IntInterval` | `Int` | `UInt` |
| `LongInterval` | `Long` | `ULong` |
| `FloatInterval` | `Float` | `Double` |
| `DoubleInterval` | `Double` | `Double` |
| `UByteInterval` | `UByte` | `UByte` |
| `UShortInterval` | `UShort` | `UShort` |
| `UIntInterval` | `UInt` | `UInt` |
| `ULongInterval` | `ULong` | `ULong` |
| `CharInterval` | `Char` | `UShort` |
| `InstantInterval` | `Instant` | `Duration` |
2 changes: 1 addition & 1 deletion build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ repositories {
}

dependencies {
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:2.1.21")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:2.3.10")
implementation("org.jetbrains.dokka:dokka-gradle-plugin:2.0.0")
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,6 @@ kotlin {


// Documentation.
dokka {
dokkaSourceSets {
register("jvm") {
analysisPlatform.set(KotlinPlatform.JVM)
sourceRoots.from(kotlin.sourceSets.getByName("jvmMain").kotlin.srcDirs)
}
}
}
tasks.withType<DokkaGenerateTask>().configureEach {
// HACK: Dokka 2.0.0 exposes this debug file by default (https://github.com/Kotlin/dokka/issues/3958)
@OptIn( InternalDokkaGradlePluginApi::class )
Expand Down
6 changes: 3 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ if (publishPropertiesFile.exists()) {
publishProperties.load(java.io.FileInputStream(publishPropertiesFile))
}
group = "io.github.whathecode.kotlinx.interval"
version = "2.1.0"
version = "2.2.0"
if (properties.containsKey("snapshot"))
{
val versionSplit = version.toString().split("-")
Expand All @@ -32,8 +32,8 @@ if (properties.containsKey("snapshot"))
nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/"))
username.set(publishProperties["repository.username"] as? String)
password.set(publishProperties["repository.password"] as? String)
}
Expand Down
Loading