org.hnau.emitter.extensions.double.EmitterDoubleWithDoubleExtensions.kt Maven / Gradle / Ivy
package org.hnau.emitter.extensions.double
import org.hnau.emitter.Emitter
import org.hnau.emitter.observing.value.possible.state.combine.combineWith
import org.hnau.emitter.extensions.map
fun Emitter.toDouble() = map(Double::toDouble)
operator fun Emitter.plus(other: Emitter) = combineWith(other, Double::plus)
operator fun Emitter.minus(other: Emitter) = combineWith(other, Double::minus)
operator fun Emitter.times(other: Emitter) = combineWith(other, Double::times)
operator fun Emitter.div(other: Emitter) = combineWith(other, Double::div)
operator fun Emitter.rem(other: Emitter) = combineWith(other, Double::rem)
operator fun Emitter.plus(other: Double) = map { it + other }
operator fun Emitter.minus(other: Double) = map { it - other }
operator fun Emitter.times(other: Double) = map { it * other }
operator fun Emitter.div(other: Double) = map { it / other }
operator fun Emitter.rem(other: Double) = map { it % other }
operator fun Double.plus(other: Emitter) = other.map { this + it }
operator fun Double.minus(other: Emitter) = other.map { this - it }
operator fun Double.times(other: Emitter) = other.map { this * it }
operator fun Double.div(other: Emitter) = other.map { this / it }
operator fun Double.rem(other: Emitter) = other.map { this % it }
© 2015 - 2025 Weber Informatics LLC | Privacy Policy