[orx-delegate-magic] Update docstrings
This commit is contained in:
@@ -4,7 +4,13 @@ package org.openrndr.extra.delegatemagic.aggregation
|
|||||||
|
|
||||||
import kotlin.math.abs
|
import kotlin.math.abs
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return element with largest magnitude
|
||||||
|
* @since 0.4.3
|
||||||
|
*/
|
||||||
fun List<Double>.maxMag(): Double {
|
fun List<Double>.maxMag(): Double {
|
||||||
|
|
||||||
|
this.max()
|
||||||
if (isEmpty()) {
|
if (isEmpty()) {
|
||||||
error("list is empty")
|
error("list is empty")
|
||||||
}
|
}
|
||||||
@@ -21,6 +27,10 @@ fun List<Double>.maxMag(): Double {
|
|||||||
return maxMagWithSign
|
return maxMagWithSign
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return element with smallest magnitude
|
||||||
|
* @since 0.4.3
|
||||||
|
*/
|
||||||
fun List<Double>.minMag(): Double {
|
fun List<Double>.minMag(): Double {
|
||||||
if (isEmpty()) {
|
if (isEmpty()) {
|
||||||
error("list is empty")
|
error("list is empty")
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ import org.openrndr.Clock
|
|||||||
import kotlin.reflect.KProperty
|
import kotlin.reflect.KProperty
|
||||||
import kotlin.reflect.KProperty0
|
import kotlin.reflect.KProperty0
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Property delegation by list aggregation
|
||||||
|
*/
|
||||||
class ListPropertyAggregation<T, R>(
|
class ListPropertyAggregation<T, R>(
|
||||||
private val clock: Clock,
|
private val clock: Clock,
|
||||||
private val property: KProperty0<List<T>>,
|
private val property: KProperty0<List<T>>,
|
||||||
@@ -29,6 +32,12 @@ class ListPropertyAggregation<T, R>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Aggregate list property
|
||||||
|
* @param property the list property to aggregate
|
||||||
|
* @param aggregationFunction the function that is
|
||||||
|
* @since 0.4.3
|
||||||
|
*/
|
||||||
fun <T, R> Clock.aggregating(
|
fun <T, R> Clock.aggregating(
|
||||||
property: KProperty0<List<T>>,
|
property: KProperty0<List<T>>,
|
||||||
aggregationFunction: (List<T>) -> R
|
aggregationFunction: (List<T>) -> R
|
||||||
|
|||||||
Reference in New Issue
Block a user