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

org.hnau.emitter.extensions.float.EmitterFloatWithIntExtensions.kt Maven / Gradle / Ivy

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

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


fun Emitter.toInt() = map(Float::toInt)

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy