Skip to content

Commit

Permalink
allow values to be represented as suppliers
Browse files Browse the repository at this point in the history
  • Loading branch information
sswadkar committed Feb 1, 2023
1 parent c8f8de3 commit 77c370c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ publishing {
release(MavenPublication) {
groupId = 'org.team4099'
artifactId = 'falconutils'
version = '1.1.8'
version = '1.1.9'

from(components["kotlin"])
}
Expand Down
4 changes: 4 additions & 0 deletions src/main/kotlin/org/team4099/lib/units/Value.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.team4099.lib.units

import java.util.function.Supplier
import kotlin.math.absoluteValue
import kotlin.math.sign

Expand All @@ -20,6 +21,9 @@ value class Value<T : UnitKey>(val value: Double) : Comparable<Value<T>> {
inline val cubed: Value<Cubed<T>>
get() = Value(value * value * value)

inline val asSupplier: Supplier<Value<T>>
get() = Supplier { Value(value) }

inline operator fun plus(o: Value<T>): Value<T> = Value(value + o.value)
inline operator fun minus(o: Value<T>): Value<T> = Value(value - o.value)

Expand Down

0 comments on commit 77c370c

Please sign in to comment.