All Downloads are FREE. Search and download functionalities are using the official Maven repository.

protelis.coord.nonselfstabilizing.accumulation.pt Maven / Gradle / Ivy

There is a newer version: 17.3.45
Show newest version
module protelis:coord:nonselfstabilizing:accumulation
import protelis:coord:spreading
import protelis:coord:accumulation

/**
 * Gossip a value manipulated according to f.
 *
 * @param value T, what to gossip
 * @param f     (T, T) -> T, how to manipulate value
 * @return      T the value resulting from gossip
 */
public def gossip(value, f) {
    share (v <- value) {
        f(value, hood(f, value, v))
    }
}

/**
 * Gossip whether the device has ever experienced a given condition.
 *
 * @param a bool, condition
 * @return  bool, true if the device has experienced the condition, false otherwise
 */
public def gossipEver(a) {
    share (ever <- false) {
        a || anyHood(ever)
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy