Class Spreading
-
- All Implemented Interfaces:
public final class Spreading
-
-
Method Summary
Modifier and Type Method Description final static Unit
addRange(Object v)
final static Unit
addRangeHop()
final static Unit
addRangeWithLag(Object v, Object metric, Object speed)
final static Unit
addRangeWithMetric(Object v, Object metric)
final static <T extends Any> T
boundBroadcast(Boolean region, T null, Boolean source, Object value)
Constrain the spreading of broadcast function only within a region. final static <T extends Any> T
boundG(Boolean region, T null, Boolean source, T initial, Function1<Unit, Number> metric, Function1<T, T> accumulate)
Constrain the spreading of G function only within a region. final static Unit
boundDistanceTo(Object region, Object source)
final static Unit
broadcast(Object source, Object value)
final static Unit
broadcastWithMetric(Object source, Object value, Object metric)
final static Boolean
channel(Boolean source, Boolean dest, Number thr)
Dynamically computes distributed routes between regions of a network, and dynamically adapts to shape and changes of the network topology. final static Boolean
channelWithObstacle(Boolean source, Boolean dest, Boolean obstacle, Number thr)
Dynamically computes distributed routes between regions of a network, and dynamically adapts to shape and changes of the network topology. final static Boolean
channel2(Boolean source, Object destination, Number width)
Channel pattern. final static Boolean
channel2WithObstacle(Boolean source, Object destination, Boolean obstacle, Number width)
Channel pattern. final static Boolean
closerThan(Boolean source, Number range)
final static Boolean
closerThanWithMetric(Boolean source, Function1<Unit, Number> metric, Number range)
final static Number
crfGradient(Boolean source, Number maxHop)
Self-healing gradient algorithm that reconfigures in O(diameter) time. final static Number
crfGradientWithMetric(Boolean source, Function1<Unit, Number> metric, Number maxHop)
Self-healing gradient algorithm that reconfigures in O(diameter) time. final static Number
bisGradient(Boolean source, Number radius, Number speed)
Self-healing gradient algorithm with single-path reaction speed. final static Number
bisGradientWithMetric(Boolean source, Function1<Unit, Number> metric, Number radius, Number speed)
Self-healing gradient algorithm with single-path reaction speed. final static Boolean
dilate(Boolean region, Number width)
Dilate a spatial region. final static Boolean
dilateWithMetric(Boolean region, Function1<Unit, Number> metric, Number width)
Dilate a spatial region. final static Boolean
directProjection(Boolean source, Boolean obstacle)
Forecast obstacles along a path to the source. final static Boolean
directProjectionWithMetric(Boolean source, Boolean obstacle, Function1<Unit, Number> metric)
Forecast obstacles along a path to the source. final static Number
distanceBetween(Boolean source, Boolean dest)
Smallest distance between source and destination devices. final static Number
distanceBetweenWithMetric(Boolean source, Boolean dest, Function1<Unit, Number> metric)
Smallest distance between source and destination devices. final static Unit
distanceTo(Object source)
final static Unit
distanceToWithMetric(Object source, Object metric)
final static Unit
roundTripTime(Number d)
Estimate worst propagation time considering a message round trip. final static Unit
flex_distorce(Object minD, Object metric)
final static Unit
flex_slope(Object d, Object nbrD, Object minD, Object metric)
final static Unit
flexGradient(Boolean source, Number epsilon, Number rate, Number range, Number distortion)
Flex-Gradient. final static Unit
flexGradientWithMetric(Boolean source, Number epsilon, Number rate, Number range, Number distortion, Function1<Unit, Number> metric)
Flex-Gradient. final static Unit
G(Object source, Object initial, Object metric, Object accumulate)
final static <T extends Any> T
Gnull(T v, T default)
Wrapper for G error. final static <T extends Any> T
gradcast(Boolean source, T local, Number gradient, Function1<T, T> accumulate)
Gradcast. final static <T extends Any> <Error class: unknown class>
gradient(Boolean source, T init, Function1<Unit, Number> metric, Function1<T, T> accumulate)
Spread and extend information with distance from the source region. final static Unit
hopBroadcast(Object source, Object value)
final static Unit
hopDistanceTo(Object source)
final static <U extends Any, I extends Any, D extends Any, T extends Any> <Error class: unknown class>
,T,kotlin.jvm.functions.Function1,kotlin.jvm.functions.Function1)>multiG(<Error class: unknown class> sources, T init, Function1<Unit, Number> metric, Function1<T, T> accumulate)
Run an instance of G from every source. final static <U extends Any, I extends Any, D extends Any, T extends Any> <Error class: unknown class>
,T,kotlin.jvm.functions.Function1,kotlin.jvm.functions.Function1)>multiGradient(<Error class: unknown class> sources, T init, Function1<Unit, Number> metric, Function1<T, T> accumulate)
Spread and extend information with distance from multiple source regions. final static Number
neighborhood()
Count the number of neighbors. final static Number
nbrDelay()
Time forward view. final static Number
nbrLag()
Time backward view. final static Unit
nbrRange()
final static Unit
nbrRangeHop()
final static Unit
nbrRangeLag(Object metric, Object lagMetric, Object speed)
final static Boolean
descend(Boolean source, Number potential)
Shortest path according to a potential. final static Boolean
rendezvous(Boolean source, Boolean dest)
Shortest path. final static Boolean
shortestPath(Boolean source, Object destination)
Dynamically computes the shortest route between regions of a network, and dynamically adapts to shape and changes of the network topology. final static <T extends Any> T
vm(Boolean source, Number range, Function1<Unit, T> f, T null)
Entry point for a computation. final static <T extends Any> T
vmWithMetric(Boolean source, Function1<Unit, Number> metric, Number range, Function1<Unit, T> f, T null)
Entry point for a computation. final static <T extends Any> T
voronoiPatitioning(Boolean source, T id)
Computing a Voronoi partition is an operation that is frequently useful in distributed systems. final static <T extends Any> T
voronoiPatitioningWithMetric(Object seed, T id, Function1<Unit, Number> metric)
Computing a Voronoi partition is an operation that is frequently useful in distributed systems. -
-
Method Detail
-
addRangeHop
final static Unit addRangeHop()
-
addRangeWithLag
final static Unit addRangeWithLag(Object v, Object metric, Object speed)
-
addRangeWithMetric
final static Unit addRangeWithMetric(Object v, Object metric)
-
boundBroadcast
final static <T extends Any> T boundBroadcast(Boolean region, T null, Boolean source, Object value)
Constrain the spreading of broadcast function only within a region.
- Parameters:
region
- whether the function is spreaded or notnull
- default value where f is not spreadedsource
- whether the current device is a source- Returns:
broadcast inside the region, return null otherwise
-
boundG
final static <T extends Any> T boundG(Boolean region, T null, Boolean source, T initial, Function1<Unit, Number> metric, Function1<T, T> accumulate)
Constrain the spreading of G function only within a region.
- Parameters:
region
- whether the function is spreaded or notnull
- default value where f is not spreadedsource
- whether the current device is a sourceinitial
- initial value of the computationmetric
- estimate distance from other devicesaccumulate
- how to manage the value- Returns:
accumulated value
-
boundDistanceTo
final static Unit boundDistanceTo(Object region, Object source)
-
broadcastWithMetric
final static Unit broadcastWithMetric(Object source, Object value, Object metric)
-
channel
final static Boolean channel(Boolean source, Boolean dest, Number thr)
Dynamically computes distributed routes between regions of a network, and dynamically adapts to shape and changes of the network topology. The channel is a Boolean field that is true for devices near the shortest route from a given (distributed) source to a (distributed) destination.
- Parameters:
source
- whether the device is a sourcedest
- whether the device is a destinationthr
- threshold for Double comparison (e.g.- Returns:
true if the device is on the shortest path, false otherwise
-
channelWithObstacle
final static Boolean channelWithObstacle(Boolean source, Boolean dest, Boolean obstacle, Number thr)
Dynamically computes distributed routes between regions of a network, and dynamically adapts to shape and changes of the network topology. The channel is a Boolean field that is true for devices near the shortest route from a given (distributed) source to a (distributed) destination.
- Parameters:
source
- whether the device is a sourcedest
- whether the device is a destinationobstacle
- whether the device is an obstaclethr
- threshold for Double comparison (e.g.- Returns:
true if the device is on the shortest path, false otherwise
-
channel2
final static Boolean channel2(Boolean source, Object destination, Number width)
Channel pattern.
- Parameters:
source
- whether the device is a sourcewidth
- how much to dilate the channel- Returns:
true if the device is on the shortest path, false otherwise
-
channel2WithObstacle
final static Boolean channel2WithObstacle(Boolean source, Object destination, Boolean obstacle, Number width)
Channel pattern.
- Parameters:
source
- whether the device is a sourceobstacle
- whether the device is an obstaclewidth
- how much to dilate the channel- Returns:
true if the device is on the shortest path, false otherwise
-
closerThan
final static Boolean closerThan(Boolean source, Number range)
- Parameters:
source
- whether the device is a sourcerange
- range- Returns:
true if the device is closer than range to the source
-
closerThanWithMetric
final static Boolean closerThanWithMetric(Boolean source, Function1<Unit, Number> metric, Number range)
- Parameters:
source
- whether the device is a sourcemetric
- how to estimate the distancerange
- range- Returns:
true if the device is closer than range to the source
-
crfGradient
final static Number crfGradient(Boolean source, Number maxHop)
Self-healing gradient algorithm that reconfigures in O(diameter) time. Requires euclidean metric.
- Parameters:
source
- whether the device is a sourcemaxHop
- communication max range- Returns:
minimum distance from the source
-
crfGradientWithMetric
final static Number crfGradientWithMetric(Boolean source, Function1<Unit, Number> metric, Number maxHop)
Self-healing gradient algorithm that reconfigures in O(diameter) time. Requires euclidean metric.
- Parameters:
source
- whether the device is a sourcemetric
- how to estimate distances without lagmaxHop
- communication max range- Returns:
minimum distance from the source
-
bisGradient
final static Number bisGradient(Boolean source, Number radius, Number speed)
Self-healing gradient algorithm with single-path reaction speed.
- Parameters:
source
- whether the device is a sourceradius
- communication max rangespeed
- estimate of single-path speed- Returns:
minimum distance from the source
-
bisGradientWithMetric
final static Number bisGradientWithMetric(Boolean source, Function1<Unit, Number> metric, Number radius, Number speed)
Self-healing gradient algorithm with single-path reaction speed.
- Parameters:
source
- whether the device is a sourcemetric
- how to estimate distances without lagradius
- communication max rangespeed
- estimate of single-path speed- Returns:
minimum distance from the source
-
dilate
final static Boolean dilate(Boolean region, Number width)
Dilate a spatial region.
- Parameters:
region
- whether the device is inside the regionwidth
- how much to dilate- Returns:
dilated region
-
dilateWithMetric
final static Boolean dilateWithMetric(Boolean region, Function1<Unit, Number> metric, Number width)
Dilate a spatial region.
- Parameters:
region
- whether the device is inside the regionmetric
- how to estimate the distance between deviceswidth
- how much to dilate- Returns:
dilated region
-
directProjection
final static Boolean directProjection(Boolean source, Boolean obstacle)
Forecast obstacles along a path to the source.
- Parameters:
source
- whether the device is a sourceobstacle
- whether the device is an obstacle- Returns:
true if the device encounter an obstacle within the shortest path towards the closest source, false otherwise
-
directProjectionWithMetric
final static Boolean directProjectionWithMetric(Boolean source, Boolean obstacle, Function1<Unit, Number> metric)
Forecast obstacles along a path to the source.
- Parameters:
source
- whether the device is a sourceobstacle
- whether the device is an obstaclemetric
- how to estimate neighbors distances- Returns:
true if the device encounter an obstacle within the shortest path towards the closest source, false otherwise
-
distanceBetween
final static Number distanceBetween(Boolean source, Boolean dest)
Smallest distance between source and destination devices.
- Parameters:
source
- whether the current device is a sourcedest
- whether the current device is a destination- Returns:
smallest distance between source and destination devices
-
distanceBetweenWithMetric
final static Number distanceBetweenWithMetric(Boolean source, Boolean dest, Function1<Unit, Number> metric)
Smallest distance between source and destination devices.
- Parameters:
source
- whether the current device is a sourcedest
- whether the current device is a destinationmetric
- estimate distance from other devices- Returns:
smallest distance between source and destination devices
-
distanceTo
final static Unit distanceTo(Object source)
-
distanceToWithMetric
final static Unit distanceToWithMetric(Object source, Object metric)
-
roundTripTime
final static Unit roundTripTime(Number d)
Estimate worst propagation time considering a message round trip.
- Parameters:
d
- network diameter
-
flex_distorce
final static Unit flex_distorce(Object minD, Object metric)
-
flexGradient
final static Unit flexGradient(Boolean source, Number epsilon, Number rate, Number range, Number distortion)
Flex-Gradient.
- Parameters:
source
- whether the device is a sourceepsilon
- tolerancerate
- communication raterange
- communication rangedistortion
- distortion
-
flexGradientWithMetric
final static Unit flexGradientWithMetric(Boolean source, Number epsilon, Number rate, Number range, Number distortion, Function1<Unit, Number> metric)
Flex-Gradient.
- Parameters:
source
- whether the device is a sourceepsilon
- tolerancerate
- communication raterange
- communication rangedistortion
- distortionmetric
- estimate distance from other devices
-
Gnull
final static <T extends Any> T Gnull(T v, T default)
Wrapper for G error. For example: G(aBool, aBool, aMetric, (v) -> { Gnull(v, false) ... } assure that G is not broken in case minHood(..., ...) returns Infinity.
- Parameters:
v
- value to be checkeddefault
- default value to avoid to broke G- Returns:
v or default
-
gradcast
final static <T extends Any> T gradcast(Boolean source, T local, Number gradient, Function1<T, T> accumulate)
Gradcast.
- Parameters:
source
- whether the device is a sourcelocal
- local valuegradient
- gradient to followaccumulate
- how to accumulate local values- Returns:
accumulated value
-
gradient
final static <T extends Any> <Error class: unknown class> gradient(Boolean source, T init, Function1<Unit, Number> metric, Function1<T, T> accumulate)
Spread and extend information with distance from the source region.
- Parameters:
source
- whether the current device is a sourceinit
- initial value of the computationmetric
- estimate distance from other devicesaccumulate
- how to accumulate the value- Returns:
distance value and accumulated value
-
hopBroadcast
final static Unit hopBroadcast(Object source, Object value)
-
hopDistanceTo
final static Unit hopDistanceTo(Object source)
-
multiG
final static <U extends Any, I extends Any, D extends Any, T extends Any> <Error class: unknown class> ,T,kotlin.jvm.functions.Function1,kotlin.jvm.functions.Function1)>multiG(<Error class: unknown class> sources, T init, Function1<Unit, Number> metric, Function1<T, T> accumulate)
Run an instance of G from every source.
- Parameters:
sources
- list of active sourcesinit
- initial value of the computationmetric
- estimate distance from other devicesaccumulate
- how to accumulate the value- Returns:
list of information from multiple sources
-
multiGradient
final static <U extends Any, I extends Any, D extends Any, T extends Any> <Error class: unknown class> ,T,kotlin.jvm.functions.Function1,kotlin.jvm.functions.Function1)>multiGradient(<Error class: unknown class> sources, T init, Function1<Unit, Number> metric, Function1<T, T> accumulate)
Spread and extend information with distance from multiple source regions.
- Parameters:
sources
- list of active sourcesinit
- initial value of the computationmetric
- estimate distance from other devicesaccumulate
- how to accumulate the value- Returns:
list of information from multiple gradients
-
neighborhood
final static Number neighborhood()
Count the number of neighbors.
- Returns:
number of neighbors
-
nbrDelay
final static Number nbrDelay()
Time forward view.
- Returns:
expected time from the device computation to neighbor's next computation incorporating that information.
-
nbrLag
final static Number nbrLag()
Time backward view.
- Returns:
how long ago information from neighbors was received.
-
nbrRangeHop
final static Unit nbrRangeHop()
-
nbrRangeLag
final static Unit nbrRangeLag(Object metric, Object lagMetric, Object speed)
-
descend
final static Boolean descend(Boolean source, Number potential)
Shortest path according to a potential.
- Parameters:
source
- whether the device is a sourcepotential
- potential- Returns:
true if the device is in the shortest path
-
rendezvous
final static Boolean rendezvous(Boolean source, Boolean dest)
Shortest path.
- Parameters:
source
- whether the device is the sourcedest
- whether the device is the destination- Returns:
true if the device is in the shortest path
-
shortestPath
final static Boolean shortestPath(Boolean source, Object destination)
Dynamically computes the shortest route between regions of a network, and dynamically adapts to shape and changes of the network topology. The shortest path is a Boolean field that is true for devices near the shortest route from a given (distributed) source to a (distributed) destination.
- Parameters:
source
- whether the device is the source- Returns:
true if the device is in the shortest path
-
vm
final static <T extends Any> T vm(Boolean source, Number range, Function1<Unit, T> f, T null)
Entry point for a computation.
- Parameters:
source
- whether the device is a sourcerange
- spreading constraintf
- entry pointnull
- default value- Returns:
apply f if device is inside the spreading region, null outside
-
vmWithMetric
final static <T extends Any> T vmWithMetric(Boolean source, Function1<Unit, Number> metric, Number range, Function1<Unit, T> f, T null)
Entry point for a computation.
- Parameters:
source
- whether the device is a sourcemetric
- how to estimate neighbors distancesrange
- spreading constraintf
- entry pointnull
- default value- Returns:
apply f if device is inside the spreading region, null outside
-
voronoiPatitioning
final static <T extends Any> T voronoiPatitioning(Boolean source, T id)
Computing a Voronoi partition is an operation that is frequently useful in distributed systems. Given an initial set of seed devices, a Voronoi partition assigns each device to the partition of the nearest seed, effectively breaking the network up into zones of influence around key elements.
- Parameters:
source
- whether the device is a seedid
- partition id- Returns:
partition of the nearest seed
-
voronoiPatitioningWithMetric
final static <T extends Any> T voronoiPatitioningWithMetric(Object seed, T id, Function1<Unit, Number> metric)
Computing a Voronoi partition is an operation that is frequently useful in distributed systems. Given an initial set of seed devices, a Voronoi partition assigns each device to the partition of the nearest seed, effectively breaking the network up into zones of influence around key elements.
- Parameters:
id
- partition idmetric
- how to estimate the distances of the neighbors- Returns:
partition of the nearest seed
-
-
-
-