Go to reference
Package com.femastudios.dataflow.util
Package that contains common utility functions for Fields.
Types
DataflowCollectionUtils |
A utility class for dataflow collections object DataflowCollectionUtils |
SimpleList |
A simple interface that extends Iterable that can be used when the called is only interested in basic methods. This is for example usable on com.femastudios.dataflow.impl.BaseDependentField.dependencies. interface SimpleList<T> : Iterable<T> |
Functions
coalesce |
fun <T> coalesce(vararg fields: Field<T>): Field<T> fun <T> coalesce(fields: List<Field<T>>): Field<T> |
dataflowTick |
Increments the internal dataflow tick count by one and return the current value. This tick is used to keep track and synchronize the fields changes. fun dataflowTick(): Long |
fieldOf |
Construct a constant Field with the given value. fun <T> fieldOf(value: T): Field<T> |
fieldOfFalse |
Returns a constant Field that holds fun fieldOfFalse(): Field<Boolean> |
fieldOfNull |
Returns a constant Field that holds fun fieldOfNull(): Field<Nothing?> |
fieldOfTrue |
Returns a constant Field that holds fun fieldOfTrue(): Field<Boolean> |
fieldWrapperOf |
Constructs a new FieldWrapper with the given initial value. fun <T> fieldWrapperOf(value: T): FieldWrapper<T>
Constructs a new FieldWrapper, which initially mirrors the given field. fun <T> fieldWrapperOf(field: Field<T>): FieldWrapper<T> |
fieldWrapperOfNull |
Constructs a new FieldWrapper that initially holds fun <T> fieldWrapperOfNull(): FieldWrapper<T?> |
lazyFieldOf |
Constructs a constant lazy Field whose value is computed using initialValueComputer. fun <T> lazyFieldOf(initialValueComputer: () -> T): Field<T> |
listFieldOf |
Returns a constant Field that holds an empty List fun <T> listFieldOf(): Field<List<T>>
Returns a constant Field that holds a List containing the given element fun <T> listFieldOf(element: T): Field<List<T>>
Returns a constant Field that holds a List containing the given elements fun <T> listFieldOf(vararg elements: T): Field<List<T>> |
mapFieldOf |
Returns a constant Field that holds an empty Map fun <K, V> mapFieldOf(): Field<Map<K, V>>
Returns a constant Field that holds a Map containing the given key and value (expressed as a Pair) fun <K, V> mapFieldOf(element: Pair<K, V>): Field<Map<K, V>>
Returns a constant Field that holds a Map containing the given keys and values (expressed as Pairs) fun <K, V> mapFieldOf(vararg elements: Pair<K, V>): Field<Map<K, V>> |
mutableFieldOf |
Constructs a new MutableField with the given initial value. fun <T> mutableFieldOf(value: T): MutableField<T> |
mutableListFieldOf |
Returns a new MutableField that initially holds an empty List fun <T> mutableListFieldOf(): MutableField<List<T>>
Returns a new MutableField that initially holds a List containing the given element fun <T> mutableListFieldOf(element: T): MutableField<List<T>>
Returns a new MutableField that initially holds a List containing the given elements fun <T> mutableListFieldOf(vararg elements: T): MutableField<List<T>> |
mutableMapFieldOf |
Returns a new MutableField that initially holds an empty Map fun <K, V> mutableMapFieldOf(): MutableField<Map<K, V>>
Returns a new MutableField that initially holds a Map containing the given key and value (expressed as a Pair) fun <K, V> mutableMapFieldOf(element: Pair<K, V>): MutableField<Map<K, V>>
Returns a new MutableField that initially holds a Map containing the given keys and values (expressed as Pairs) fun <K, V> mutableMapFieldOf(vararg elements: Pair<K, V>): MutableField<Map<K, V>> |
mutableSetFieldOf |
Returns a new MutableField that initially holds an empty Set fun <T> mutableSetFieldOf(): MutableField<Set<T>>
Returns a new MutableField that initially holds a Set containing the given element fun <T> mutableSetFieldOf(element: T): MutableField<Set<T>>
Returns a new MutableField that initially holds a Set containing the given elements fun <T> mutableSetFieldOf(vararg elements: T): MutableField<Set<T>> |
setFieldOf |
Returns a constant Field that holds an empty Set fun <T> setFieldOf(): Field<Set<T>>
Returns a constant Field that holds a Set containing the given element fun <T> setFieldOf(element: T): Field<Set<T>>
Returns a constant Field that holds a Set containing the given elements fun <T> setFieldOf(vararg elements: T): Field<Set<T>> |
then |
See Field.then fun <I, O> then(field: Field<I>, transformer: (I) -> Field<O>): Field<O>
Returns a Field whose value mirrors the Field returned by transformer. fun <I1, I2, O> then(f1: Field<I1>, f2: Field<I2>, transformer: (I1, I2) -> Field<O>): Field<O> fun <I1, I2, I3, O> then(f1: Field<I1>, f2: Field<I2>, f3: Field<I3>, transformer: (I1, I2, I3) -> Field<O>): Field<O> fun <I1, I2, I3, I4, O> then(f1: Field<I1>, f2: Field<I2>, f3: Field<I3>, f4: Field<I4>, transformer: (I1, I2, I3, I4) -> Field<O>): Field<O> fun <I1, I2, I3, I4, I5, O> then(f1: Field<I1>, f2: Field<I2>, f3: Field<I3>, f4: Field<I4>, f5: Field<I5>, transformer: (I1, I2, I3, I4, I5) -> Field<O>): Field<O> fun <I1, I2, I3, I4, I5, I6, O> then(f1: Field<I1>, f2: Field<I2>, f3: Field<I3>, f4: Field<I4>, f5: Field<I5>, f6: Field<I6>, transformer: (I1, I2, I3, I4, I5, I6) -> Field<O>): Field<O> fun <I1, I2, I3, I4, I5, I6, I7, O> then(f1: Field<I1>, f2: Field<I2>, f3: Field<I3>, f4: Field<I4>, f5: Field<I5>, f6: Field<I6>, f7: Field<I7>, transformer: (I1, I2, I3, I4, I5, I6, I7) -> Field<O>): Field<O> fun <I1, I2, I3, I4, I5, I6, I7, I8, O> then(f1: Field<I1>, f2: Field<I2>, f3: Field<I3>, f4: Field<I4>, f5: Field<I5>, f6: Field<I6>, f7: Field<I7>, f8: Field<I8>, transformer: (I1, I2, I3, I4, I5, I6, I7, I8) -> Field<O>): Field<O> fun <I1, I2, I3, I4, I5, I6, I7, I8, I9, O> then(f1: Field<I1>, f2: Field<I2>, f3: Field<I3>, f4: Field<I4>, f5: Field<I5>, f6: Field<I6>, f7: Field<I7>, f8: Field<I8>, f9: Field<I9>, transformer: (I1, I2, I3, I4, I5, I6, I7, I8, I9) -> Field<O>): Field<O> fun <I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, O> then(f1: Field<I1>, f2: Field<I2>, f3: Field<I3>, f4: Field<I4>, f5: Field<I5>, f6: Field<I6>, f7: Field<I7>, f8: Field<I8>, f9: Field<I9>, f10: Field<I10>, transformer: (I1, I2, I3, I4, I5, I6, I7, I8, I9, I10) -> Field<O>): Field<O> fun <I, O> then(fields: List<Field<I>>, transformer: (List<I>) -> Field<O>): Field<O> |
transform |
See Field.transform fun <I, O> transform(field: Field<I>, transformer: (I) -> O): Field<O>
Returns a Field whose value is the value of the given fields, transformed according to the given transformer. fun <I1, I2, O> transform(f1: Field<I1>, f2: Field<I2>, transformer: (I1, I2) -> O): Field<O> fun <I1, I2, I3, O> transform(f1: Field<I1>, f2: Field<I2>, f3: Field<I3>, transformer: (I1, I2, I3) -> O): Field<O> fun <I1, I2, I3, I4, O> transform(f1: Field<I1>, f2: Field<I2>, f3: Field<I3>, f4: Field<I4>, transformer: (I1, I2, I3, I4) -> O): Field<O> fun <I1, I2, I3, I4, I5, O> transform(f1: Field<I1>, f2: Field<I2>, f3: Field<I3>, f4: Field<I4>, f5: Field<I5>, transformer: (I1, I2, I3, I4, I5) -> O): Field<O> fun <I1, I2, I3, I4, I5, I6, O> transform(f1: Field<I1>, f2: Field<I2>, f3: Field<I3>, f4: Field<I4>, f5: Field<I5>, f6: Field<I6>, transformer: (I1, I2, I3, I4, I5, I6) -> O): Field<O> fun <I1, I2, I3, I4, I5, I6, I7, O> transform(f1: Field<I1>, f2: Field<I2>, f3: Field<I3>, f4: Field<I4>, f5: Field<I5>, f6: Field<I6>, f7: Field<I7>, transformer: (I1, I2, I3, I4, I5, I6, I7) -> O): Field<O> fun <I1, I2, I3, I4, I5, I6, I7, I8, O> transform(f1: Field<I1>, f2: Field<I2>, f3: Field<I3>, f4: Field<I4>, f5: Field<I5>, f6: Field<I6>, f7: Field<I7>, f8: Field<I8>, transformer: (I1, I2, I3, I4, I5, I6, I7, I8) -> O): Field<O> fun <I1, I2, I3, I4, I5, I6, I7, I8, I9, O> transform(f1: Field<I1>, f2: Field<I2>, f3: Field<I3>, f4: Field<I4>, f5: Field<I5>, f6: Field<I6>, f7: Field<I7>, f8: Field<I8>, f9: Field<I9>, transformer: (I1, I2, I3, I4, I5, I6, I7, I8, I9) -> O): Field<O> fun <I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, O> transform(f1: Field<I1>, f2: Field<I2>, f3: Field<I3>, f4: Field<I4>, f5: Field<I5>, f6: Field<I6>, f7: Field<I7>, f8: Field<I8>, f9: Field<I9>, f10: Field<I10>, transformer: (I1, I2, I3, I4, I5, I6, I7, I8, I9, I10) -> O): Field<O> fun <I, O> transform(fields: List<Field<I>>, transformer: (List<I>) -> O): Field<O> |
tuple |
Creates a Field of Pair, given two separate fields fun <A, B> tuple(first: Field<A>, second: Field<B>): Field<Pair<A, B>>
Creates a Field of Triple, given three separate fields fun <A, B, C> tuple(first: Field<A>, second: Field<B>, third: Field<C>): Field<Triple<A, B, C>>
Creates a Field of Quadruple, given four separate fields fun <A, B, C, D> tuple(first: Field<A>, second: Field<B>, third: Field<C>, fourth: Field<D>): Field<Quadruple<A, B, C, D>>
Creates a Field of Quintuple, given five separate fields fun <A, B, C, D, E> tuple(first: Field<A>, second: Field<B>, third: Field<C>, fourth: Field<D>, fifth: Field<E>): Field<Quintuple<A, B, C, D, E>>
Creates a Field of Sixfold, given six separate fields fun <A, B, C, D, E, F> tuple(first: Field<A>, second: Field<B>, third: Field<C>, fourth: Field<D>, fifth: Field<E>, sixth: Field<F>): Field<Sixfold<A, B, C, D, E, F>>
Creates a Field of Sevenfold, given seven separate fields fun <A, B, C, D, E, F, G> tuple(first: Field<A>, second: Field<B>, third: Field<C>, fourth: Field<D>, fifth: Field<E>, sixth: Field<F>, seventh: Field<G>): Field<Sevenfold<A, B, C, D, E, F, G>>
Creates a Field of Eightfold, given eight separate fields fun <A, B, C, D, E, F, G, H> tuple(first: Field<A>, second: Field<B>, third: Field<C>, fourth: Field<D>, fifth: Field<E>, sixth: Field<F>, seventh: Field<G>, eighth: Field<H>): Field<Eightfold<A, B, C, D, E, F, G, H>>
Creates a Field of Ninefold, given nine separate fields fun <A, B, C, D, E, F, G, H, I> tuple(first: Field<A>, second: Field<B>, third: Field<C>, fourth: Field<D>, fifth: Field<E>, sixth: Field<F>, seventh: Field<G>, eighth: Field<H>, ninth: Field<I>): Field<Ninefold<A, B, C, D, E, F, G, H, I>>
Creates a Field of Tenfold, given ten separate fields fun <A, B, C, D, E, F, G, H, I, J> tuple(first: Field<A>, second: Field<B>, third: Field<C>, fourth: Field<D>, fifth: Field<E>, sixth: Field<F>, seventh: Field<G>, eighth: Field<H>, ninth: Field<I>, tenth: Field<J>): Field<Tenfold<A, B, C, D, E, F, G, H, I, J>> |