All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hnau.emitter.extensions.long.EmitterLongWithShortExtensions.kt Maven / Gradle / Ivy

There is a newer version: 2.1.3
Show newest version
package org.hnau.emitter.extensions.long

import org.hnau.emitter.Emitter
import org.hnau.emitter.extensions.map
import org.hnau.emitter.observing.push.lateinit.combineWith


fun Emitter.toShort() = map(Long::toShort)

operator fun Emitter.plus(other: Emitter) = combineWith(other, Long::plus)
operator fun Emitter.minus(other: Emitter) = combineWith(other, Long::minus)
operator fun Emitter.times(other: Emitter) = combineWith(other, Long::times)
operator fun Emitter.div(other: Emitter) = combineWith(other, Long::div)
operator fun Emitter.rem(other: Emitter) = combineWith(other, Long::rem)
operator fun Emitter.rangeTo(other: Emitter) = combineWith(other, Long::rangeTo)

operator fun Emitter.plus(other: Short) = map { it + other }
operator fun Emitter.minus(other: Short) = map { it - other }
operator fun Emitter.times(other: Short) = map { it * other }
operator fun Emitter.div(other: Short) = map { it / other }
operator fun Emitter.rem(other: Short) = map { it % other }
operator fun Emitter.rangeTo(other: Short) = map { it .. other }

operator fun Long.plus(other: Emitter) = other.map { this + it }
operator fun Long.minus(other: Emitter) = other.map { this - it }
operator fun Long.times(other: Emitter) = other.map { this * it }
operator fun Long.div(other: Emitter) = other.map { this / it }
operator fun Long.rem(other: Emitter) = other.map { this % it }
operator fun Long.rangeTo(other: Emitter) = other.map { this .. it }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy