public abstract class AbstractField extends Object implements Field
Modifier and Type | Field and Description |
---|---|
private static long |
serialVersionUID |
Constructor and Description |
---|
AbstractField() |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
int |
hashCode() |
protected static <T> T |
reduce(Iterable<T> c,
BinaryOperator<T> op,
T exclude,
T defaultVal)
Reduce the desired
Iterable using the provided
BinaryOperator , excluding an element and returning a default
value if the Iterable is empty or only contains the value to
exclude. |
DeviceUID |
reduceKeys(BinaryOperator<DeviceUID> op,
DeviceUID exclude)
Apply an operator to reduce over the set of all devices, selecting a
single device.
|
Pair<DeviceUID,Object> |
reducePairs(BinaryOperator<Pair<DeviceUID,Object>> accumulator,
DeviceUID exclude)
Apply an operator to reduce over the set of all device/value pairs,
selecting a single pair.
|
Object |
reduceVals(BinaryOperator<Object> op,
DeviceUID exclude,
Object defaultVal)
Apply an operator to reduce over the set of all values, selecting a
single value.
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addSample, containsNode, coupleIterator, getExpectedType, getSample, isEmpty, nodeIterator, removeSample, size, valIterator
private static final long serialVersionUID
public DeviceUID reduceKeys(BinaryOperator<DeviceUID> op, DeviceUID exclude)
Field
reduceKeys
in interface Field
op
- Order-insensitive operator to reduce devices in pairsexclude
- Device to be excluded (typically self), or null if all devices
are to be consideredpublic Object reduceVals(BinaryOperator<Object> op, DeviceUID exclude, Object defaultVal)
Field
reduceVals
in interface Field
op
- Order-insensitive operator to reduce values, two at a time,
starting with the defaultexclude
- Device to be excluded (typically self), or null if all devices
are to be considereddefaultVal
- The value to return if the field contains no devices or only
the excluded devicepublic Pair<DeviceUID,Object> reducePairs(BinaryOperator<Pair<DeviceUID,Object>> accumulator, DeviceUID exclude)
Field
reducePairs
in interface Field
accumulator
- Order-insensitive operator to reduce pairs, two at a time,
starting with the defaultexclude
- Device to be excluded (typically self), or null if all devices
are to be consideredprotected static <T> T reduce(Iterable<T> c, BinaryOperator<T> op, T exclude, T defaultVal)
Iterable
using the provided
BinaryOperator
, excluding an element and returning a default
value if the Iterable
is empty or only contains the value to
exclude. If multiple elements to exclude are present in the iterable,
only the first will be discarded.T
- return typec
- the Iterable
op
- the BinaryOperator
that selects which element should
be keptexclude
- element not to consider (can be null)defaultVal
- the value to return if the iterator is empty or only contains
the value to ignore