Package protelis.coord.metaimport
Class Meta
-
- All Implemented Interfaces:
public final class Meta
-
-
Method Summary
Modifier and Type Method Description final static <T extends Any> TboundSpreading(Boolean region, Function1<Unit, T> f, T null)Constrain the spreading of f only across a region. final static UnitfindSources(Object source)final static UnitfindSourcesWithId(Object source, Object id, Object d, Object k)final static <T extends Any, U extends Any> <Error class: unknown class>,kotlin.jvm.functions.Function1,U)>multiInstance(<Error class: unknown class> sources, Function1<T, U> f, U null)Run an instance of a function for every source id. final static <T extends Any, U extends Any> UmultiRegion(T discriminant, Function1<T, Boolean> filter, Function1<Unit, U> function, U default)Splice devices into regions according to the discriminant and apply f. final static <G extends Any, H extends Any, I extends Any> IpreProcessAndApply(G input, Function1<G, H> pre, Function1<H, I> f)Feed f with pre-processed data. final static <G extends Any, H extends Any, I extends Any, T extends Any> TprocessAndApply(G input, Function1<G, H> pre, Function1<H, I> f, Function1<I, T> post)Feed f with pre-processed data, and then post-process the output. final static <G extends Any, H extends Any, I extends Any, T extends Any> TpostProcessAndApply(G input, Function1<H, I> f, Function1<I, T> post)Apply f, and then post-process the output. final static <T extends Any> TpublishSubscribe(Boolean publisher, Boolean subscriber, T information, T null)Publish/Subscribe pattern. final static <T extends Any> TpublishSubscribeWithPotential(Number potential, Boolean subscriber, T information, T null)Publish/Subscribe pattern. -
-
Method Detail
-
boundSpreading
final static <T extends Any> T boundSpreading(Boolean region, Function1<Unit, T> f, T null)
Constrain the spreading of f only across a region.
- Parameters:
region- whether the function is spreaded or notf- function to be spreadednull- default value where f is not spreaded- Returns:
apply f inside the region, null outside
-
findSources
final static Unit findSources(Object source)
-
multiInstance
final static <T extends Any, U extends Any> <Error class: unknown class> ,kotlin.jvm.functions.Function1,U)>multiInstance(<Error class: unknown class> sources, Function1<T, U> f, U null)
Run an instance of a function for every source id.
- Parameters:
sources- sources in the systemf- function to be applied for every sourcenull- default value- Returns:
list of results coming from the executed instances
-
multiRegion
final static <T extends Any, U extends Any> U multiRegion(T discriminant, Function1<T, Boolean> filter, Function1<Unit, U> function, U default)
Splice devices into regions according to the discriminant and apply f.
- Parameters:
discriminant- split regions according to this valuefilter- how to handle the discriminant valuefunction- what to apply in each regiondefault- default value- Returns:
apply f or default
-
preProcessAndApply
final static <G extends Any, H extends Any, I extends Any> I preProcessAndApply(G input, Function1<G, H> pre, Function1<H, I> f)
Feed f with pre-processed data.
- Parameters:
input- inputpre- how to pre-processf- what to do- Returns:
f(pre(input))
-
processAndApply
final static <G extends Any, H extends Any, I extends Any, T extends Any> T processAndApply(G input, Function1<G, H> pre, Function1<H, I> f, Function1<I, T> post)
Feed f with pre-processed data, and then post-process the output.
- Parameters:
input- inputpre- how to pre-processf- what to dopost- how to post process- Returns:
post(f(pre(input)))
-
postProcessAndApply
final static <G extends Any, H extends Any, I extends Any, T extends Any> T postProcessAndApply(G input, Function1<H, I> f, Function1<I, T> post)
Apply f, and then post-process the output.
- Parameters:
input- inputf- what to dopost- how to post process- Returns:
post(f(input))
-
publishSubscribe
final static <T extends Any> T publishSubscribe(Boolean publisher, Boolean subscriber, T information, T null)
Publish/Subscribe pattern.
- Parameters:
publisher- who publishessubscriber- who is subscribinginformation- what to sharenull- what to share if you are neither a subscriber nor a publisher- Returns:
information if the device is a publisher, a subscriber or is in the shortest path between them. null otherwise
-
publishSubscribeWithPotential
final static <T extends Any> T publishSubscribeWithPotential(Number potential, Boolean subscriber, T information, T null)
Publish/Subscribe pattern.
- Parameters:
potential- aggregation direction (publisher are devices whose potential is 0)subscriber- who is subscribinginformation- what to sharenull- what to share if you are neither a subscriber nor a publisher- Returns:
information if the device is a publisher, a subscriber or is in the shortest path between them. null otherwise
-
-
-
-