Companion

object Companion

Base operations on Fields.

Functions

Link copied to clipboard
fun checkAligned(field1: Field<*, *>, field2: Field<*, *>, vararg fields: Field<*, *>)

Check if two or more fields are aligned, throwing an IllegalStateException otherwise.

Link copied to clipboard
inline fun <ID : Any, T, R> Field<ID, T>.fold(initial: R, crossinline transform: (R, T) -> R): R

Accumulates the elements of a field starting from an initial through a transform function. The local value of the field is not considered.

Link copied to clipboard
inline fun <ID : Any, T, R> Field<ID, T>.foldWithId(initial: R, crossinline transform: (R, ID, T) -> R): R

Accumulates the elements of a field starting from an initial through a transform function that includes the ID of the element. The local value of the field is not considered.

Link copied to clipboard
inline fun <ID : Any, T> Field<ID, T>.hood(default: T, crossinline reduce: (T, T) -> T): T

Reduce the elements of the field using the reduce function, returning the default value if the field to transform is empty. The local value is not considered.

Link copied to clipboard
inline fun <ID : Any, T> Field<ID, T>.hoodWithId(default: T, crossinline reduce: (Pair<ID, T>, Pair<ID, T>) -> Pair<ID, T>): T

Reduce the elements of the field using the reduce function, returning the default value if the field to transform is empty. The local value is not considered.

inline fun <ID : Any, T> Field<ID, T>.hoodWithId(default: T, crossinline transform: (T, ID, T) -> T): T

Reduce the elements of the field using the transform function, it includes the ID of the element whenever it should be considered in the transform function, but the ID is not returned. The local value of the field is not considered. Returns the default if the field to transform is empty.

inline fun <ID : Any, T, R> Field<ID, T>.hoodWithId(default: R, crossinline reduce: (Pair<ID, T>, Pair<ID, T>) -> Pair<ID, T>, crossinline select: Pair<ID, T>.() -> R): R

Reduce the entries of the field using the reduce function, and finally transforming them to a Result using select.

inline fun <ID : Any, T, I, R> Field<ID, T>.hoodWithId(default: R, crossinline transform: (ID, T) -> I, crossinline reduce: (I, I) -> I, crossinline select: I.() -> R): R

Reduce the elements of the field by transforming them to Iintermediates selecting the Intermediates using the reduce function, and finally transforming the Intermediates to Results using select.