T - the data type carried by field valuespublic interface Field<T>
extends java.io.Serializable
| Modifier and Type | Interface and Description |
|---|---|
static interface |
Field.Builder<T>
Builder for Fields.
|
| Modifier and Type | Method and Description |
|---|---|
default boolean |
containsKey(DeviceUID id)
Verifies if some device has an entry in this field.
|
default java.util.Map.Entry<DeviceUID,T> |
foldExcludingLocal(java.util.Map.Entry<DeviceUID,T> base,
java.util.function.BinaryOperator<java.util.Map.Entry<DeviceUID,T>> combiner)
Reduction operation with base value (fold), which does not consider the local
value, and whose computation has base as initial element.
|
default <R> R |
foldExcludingLocal(R base,
java.util.function.Function<java.util.Map.Entry<DeviceUID,T>,R> mapper,
java.util.function.BinaryOperator<R> combiner)
Reduction operation with base value (fold), which does not consider the local
value, and whose computation has base as initial element.
|
default java.util.Map.Entry<DeviceUID,T> |
foldIncludingLocal(java.util.function.BinaryOperator<java.util.Map.Entry<DeviceUID,T>> combiner)
Reduction operation with base value (fold), which uses the local value as
initial element.
|
default <R> R |
foldIncludingLocal(java.util.function.Function<java.util.Map.Entry<DeviceUID,T>,R> mapper,
java.util.function.BinaryOperator<R> combiner)
Reduction operation with base value (fold), which uses the local value as
initial element.
|
default DeviceUID |
foldKeysExcludingLocal(DeviceUID base,
java.util.function.BinaryOperator<DeviceUID> combiner)
Reduction operation over keys with base value (fold), which does not consider the local
key, and whose computation has base as initial element.
|
default DeviceUID |
foldKeysIncludingLocal(java.util.function.BinaryOperator<DeviceUID> combiner)
Reduction operation over keys with base value (fold), which uses the local
value as initial element.
|
default T |
foldValuesExcludingLocal(T base,
java.util.function.BinaryOperator<T> combiner)
Reduction operation over values with base value (fold), which does not consider the local
key, and whose computation has base as initial element.
|
default T |
foldValuesIncludingLocal(java.util.function.BinaryOperator<T> combiner)
Reduction operation over values with base value (fold), which uses the local
value as initial element.
|
default T |
get(DeviceUID id) |
default java.lang.Class<? extends T> |
getExpectedType() |
default java.util.Optional<T> |
getIfPresent(DeviceUID id) |
default java.util.Map.Entry<DeviceUID,T> |
getLocal() |
DeviceUID |
getLocalDevice() |
default T |
getLocalValue() |
default boolean |
isEmpty() |
java.lang.Iterable<? extends java.util.Map.Entry<DeviceUID,T>> |
iterable() |
default java.lang.Iterable<DeviceUID> |
keys() |
default java.util.stream.Stream<DeviceUID> |
keyStream() |
default <R> Field<R> |
map(java.util.function.Function<DeviceUID,R> mapper)
Map operation over this field, returning a new field whose values are
provided by the mapper function.
|
default Field<T> |
projectOn(Field<?> restricted)
Project this field over a restricted domain.
|
default Option<java.util.Map.Entry<DeviceUID,T>> |
reduce(java.util.function.BinaryOperator<java.util.Map.Entry<DeviceUID,T>> combiner)
Reduction operation over the field.
|
default <R> Option<R> |
reduce(java.util.function.Function<java.util.Map.Entry<DeviceUID,T>,R> mapper,
java.util.function.BinaryOperator<R> combiner)
Reduction operation over the field.
|
default Option<DeviceUID> |
reduceKeys(java.util.function.BinaryOperator<DeviceUID> combiner)
Reduction operation over the field's keys.
|
default Option<T> |
reduceValues(java.util.function.BinaryOperator<T> combiner)
Reduction operation over the field's values.
|
default int |
size()
The number of neighbors in this field.
|
default java.util.stream.Stream<? extends java.util.Map.Entry<DeviceUID,T>> |
stream() |
default java.util.Map<DeviceUID,T> |
toMap() |
default java.lang.Iterable<T> |
values() |
default java.util.stream.Stream<T> |
valueStream() |
default boolean containsKey(DeviceUID id)
id - a device UIDdefault java.util.Map.Entry<DeviceUID,T> foldExcludingLocal(java.util.Map.Entry<DeviceUID,T> base, java.util.function.BinaryOperator<java.util.Map.Entry<DeviceUID,T>> combiner)
base - base value for the computationcombiner - reduction function, takes two R and returns a single Rdefault <R> R foldExcludingLocal(R base,
java.util.function.Function<java.util.Map.Entry<DeviceUID,T>,R> mapper,
java.util.function.BinaryOperator<R> combiner)
R - Return typebase - base value for the computationmapper - mapping function for pre-processing field entriescombiner - reduction function, takes two R and returns a single Rdefault java.util.Map.Entry<DeviceUID,T> foldIncludingLocal(java.util.function.BinaryOperator<java.util.Map.Entry<DeviceUID,T>> combiner)
combiner - reduction function, takes two R and returns a single Rdefault <R> R foldIncludingLocal(java.util.function.Function<java.util.Map.Entry<DeviceUID,T>,R> mapper, java.util.function.BinaryOperator<R> combiner)
R - Return typemapper - mapping function for pre-processing field entriescombiner - reduction function, takes two R and returns a single Rdefault DeviceUID foldKeysExcludingLocal(DeviceUID base, java.util.function.BinaryOperator<DeviceUID> combiner)
base - base value for the computationcombiner - reduction function, takes two DeviceUID and returns a single onedefault DeviceUID foldKeysIncludingLocal(java.util.function.BinaryOperator<DeviceUID> combiner)
combiner - reduction function, takes two DeviceUID and returns a single
onedefault T foldValuesExcludingLocal(T base, java.util.function.BinaryOperator<T> combiner)
base - base value for the computationcombiner - reduction function, takes two Ts and returns a single onedefault T foldValuesIncludingLocal(java.util.function.BinaryOperator<T> combiner)
combiner - reduction function, takes two Ts and returns a single onedefault T get(@Nonnull DeviceUID id)
id - the DeviceUIDjava.util.NoSuchElementException - if the field does not have the provided id
among its keysdefault java.lang.Class<? extends T> getExpectedType()
default java.util.Optional<T> getIfPresent(@Nonnull DeviceUID id)
id - the DeviceUIDOptional,
or an Optional.empty() if the device is not aligned.DeviceUID getLocalDevice()
default T getLocalValue()
default boolean isEmpty()
java.lang.Iterable<? extends java.util.Map.Entry<DeviceUID,T>> iterable()
default java.lang.Iterable<DeviceUID> keys()
Iterable for the field keysdefault java.util.stream.Stream<DeviceUID> keyStream()
Stream for the field keysdefault <R> Field<R> map(@Nonnull java.util.function.Function<DeviceUID,R> mapper)
R - data type yield by the resulting fieldmapper - mapping functiondefault Field<T> projectOn(@Nonnull Field<?> restricted)
restricted - the restricted domaindefault Option<java.util.Map.Entry<DeviceUID,T>> reduce(@Nonnull java.util.function.BinaryOperator<java.util.Map.Entry<DeviceUID,T>> combiner)
Option.combiner - the reduction function, taking two entries and returning a
single one.Option with the computed value, or an empty option if the
field was containing only the local valuedefault <R> Option<R> reduce(@Nonnull java.util.function.Function<java.util.Map.Entry<DeviceUID,T>,R> mapper, @Nonnull java.util.function.BinaryOperator<R> combiner)
Option. This is the most general version, operating a map + reduce
operation.R - resulting option typemapper - the mapping functioncombiner - the reduction function, taking two Rs and returning a
single one.Option with the computed value, or an empty option if the
field was containing only the local valuedefault Option<DeviceUID> reduceKeys(@Nonnull java.util.function.BinaryOperator<DeviceUID> combiner)
Option.combiner - the reduction function, taking two entries and returning a
single one.Option with the computed value, or an empty option if the
field was containing only the local valuedefault Option<T> reduceValues(@Nonnull java.util.function.BinaryOperator<T> combiner)
Option.combiner - the reduction function, taking two entries and returning a
single one.Option with the computed value, or an empty option if the
field was containing only the local valuedefault int size()
default java.util.stream.Stream<? extends java.util.Map.Entry<DeviceUID,T>> stream()
Stream over the set of neighbor/value pairsdefault java.util.Map<DeviceUID,T> toMap()
default java.lang.Iterable<T> values()
Iterable set of valuesdefault java.util.stream.Stream<T> valueStream()
Stream over the set of values