Package-level declarations

Functions

Link copied to clipboard
inline fun <ID : Any, Data> Aggregate<ID>.convergeCast(local: Data, sink: Boolean, crossinline accumulateData: (Data, Data) -> Data): Data

Aggregate a field of local into the closest sink along a spanning tree built using hopDistanceTo. Data is accumulated using the accumulateData function.

inline fun <ID : Any, Data, Potential : Comparable<Potential>> Aggregate<ID>.convergeCast(local: Data, potential: Potential, selectParent: Comparator<FieldEntry<ID, Potential>> = defaultComparator(), crossinline accumulateData: (Data, Data) -> Data): Data
inline fun <ID : Any, Data, Potential : Comparable<Potential>> Aggregate<ID>.convergeCast(local: Data, potential: Field<ID, Potential>, selectParent: Comparator<FieldEntry<ID, Potential>> = defaultComparator(), crossinline accumulateData: (Data, Data) -> Data): Data

Aggregate a field of local along a spanning tree built according descending the provided potential field. The parent of the current node is selected by picking the minimum as provided by the selectParent comparator which, by default, selects the parent with lowest potential. Data is accumulated using the accumulateData function.

Link copied to clipboard
inline fun <ID : Any> Aggregate<ID>.convergeMean(local: Double, sink: Boolean): Double

Computes the mean of all local values into the selected sink along a spanning tree built by descending the potential built using hopDistanceTo.

inline fun <ID : Any, Potential : Comparable<Potential>> Aggregate<ID>.convergeMean(local: Double, potential: Potential, selectParent: Comparator<FieldEntry<ID, Potential>> = defaultComparator()): Double
inline fun <ID : Any, Potential : Comparable<Potential>> Aggregate<ID>.convergeMean(local: Double, potential: Field<ID, Potential>, selectParent: Comparator<FieldEntry<ID, Potential>> = defaultComparator()): Double

Computes the mean of all local values along a spanning tree built descending the provided potential field using selectParent.

Link copied to clipboard
inline fun <ID : Any> Aggregate<ID>.convergeSum(local: Double, sink: Boolean): Double

Sums all locals into the closest sink along a spanning tree built using hopDistanceTo.

inline fun <ID : Any> Aggregate<ID>.convergeSum(local: Int, sink: Boolean): Int

Sums all locals into the closest sink along a spanning tree built using hopDistanceTo.

inline fun <ID : Any, Potential : Comparable<Potential>> Aggregate<ID>.convergeSum(local: Double, potential: Potential, selectParent: Comparator<FieldEntry<ID, Potential>> = defaultComparator()): Double
inline fun <ID : Any, Potential : Comparable<Potential>> Aggregate<ID>.convergeSum(local: Double, potential: Field<ID, Potential>, selectParent: Comparator<FieldEntry<ID, Potential>> = defaultComparator()): Double

Sums all locals along a spanning tree built according descending the provided potential field. The parent of the current node is selected by picking the minimum as provided by the selectParent comparator.

inline fun <ID : Any, Potential : Comparable<Potential>> Aggregate<ID>.convergeSum(local: Int, potential: Potential, selectParent: Comparator<FieldEntry<ID, Potential>> = defaultComparator()): Int
inline fun <ID : Any, Potential : Comparable<Potential>> Aggregate<ID>.convergeSum(local: Int, potential: Field<ID, Potential>, selectParent: Comparator<FieldEntry<ID, Potential>> = defaultComparator()): Int

Sums all locals along a spanning tree built according descending the provided potential field. The parent of the current node is selected by picking the minimum as provided by the selectParent comparator.

Link copied to clipboard
inline fun <ID : Any> Aggregate<ID>.countDevices(sink: Boolean): Int

Counts the number of devices in the network along a spanning tree built using hopDistanceTo starting from sink. For all devices to get counted, there must be a single sink.

inline fun <ID : Any, Potential : Comparable<Potential>> Aggregate<ID>.countDevices(potential: Potential, selectParent: Comparator<FieldEntry<ID, Potential>> = defaultComparator()): Int
inline fun <ID : Any, Potential : Comparable<Potential>> Aggregate<ID>.countDevices(potential: Field<ID, Potential>, selectParent: Comparator<FieldEntry<ID, Potential>> = defaultComparator()): Int

Counts the number of devices in the network along a spanning tree built descending the provided potential field using the selectParent. For all devices to get counted, there must be a single global minimum.

Link copied to clipboard
inline fun <ID : Any, Potential : Comparable<Potential>> Aggregate<ID>.findParent(potential: Potential, comparator: Comparator<FieldEntry<ID, Potential>> = defaultComparator()): ID
inline fun <ID : Any, Potential : Comparable<Potential>> Aggregate<ID>.findParent(potential: Field<ID, Potential>, comparator: Comparator<FieldEntry<ID, Potential>> = defaultComparator()): ID

Find the best neighbor of the current device along a potential field, selecting it with the provided comparator function by returning the minimum.

Link copied to clipboard
inline fun <ID : Any, Potential : Comparable<Potential>> Aggregate<ID>.findParents(potential: Potential, crossinline isParent: Predicate<FieldEntry<ID, Potential>> = { potential > it.value }): Set<ID>
inline fun <ID : Any, Potential : Comparable<Potential>> Aggregate<ID>.findParents(potential: Field<ID, Potential>, crossinline isParent: Predicate<FieldEntry<ID, Potential>> = { potential.local.value > it.value }): Set<ID>

Find the parents of the current device along a potential field. Only neighbors that satisfy isParent are considered as parents. By default, isParent returns all devices with a potential smaller than the local one.