A
- the type of values produced by the signal sourcespublic interface SignalSourceVector<A,S extends SignalSource<A>> extends List<S>
This interface is intended for grouping signal sources and routing parallel data flow at contruction time of a network. Objects that implement this interface should not themselves contribute to realtime behavior.
SignalSource
Modifier and Type | Interface and Description |
---|---|
static interface |
SignalSourceVector.Mutable<A,S extends SignalSource<A>>
Interface of mutable aggregates of signal sources of a fixed
object type.
|
Modifier and Type | Method and Description |
---|---|
default SignalSourceVector<A,S> |
append(SignalSourceVector<A,S> other)
Returns a new aggregate that combines the components of this and the given
other aggregate in order.
|
static <A,S extends SignalSource<A>> |
empty()
Creates a new aggregate with zero components.
|
static <A,S extends SignalSource<A>> |
iterate(int size,
Supplier<? extends S> producer)
Creates a new aggregate with a given number components obtained from a producer.
|
default SignalSourceVector<A,SignalSource<A>> |
map(UnaryOperator<A> op)
Returns a new aggregate that is obtained by uniformly transforming the
values of the corresponding components of this aggregate.
|
static <A,S extends SignalSource<A>> |
of(int size)
Creates a mutable aggregate of the given size.
|
static <A,S extends SignalSource<A>> |
of(int size,
IntFunction<? extends S> components)
Creates a new aggregate from the given component-valued function.
|
static <A,S extends SignalSource<A>> |
of(List<? extends S> components)
Creates a new aggregate from the given list of components.
|
static <A,S extends SignalSource<A>> |
of(S... components)
Creates a new aggregate from the given array of components.
|
static <A,S extends SignalSource<A>> |
repeat(int size,
S source)
Creates a new aggregate with a given number of identical references to the
same given signal source.
|
static <A,S extends SignalSource<A>> |
singleton(S source)
Creates a new aggregate with one component.
|
default int |
sizeCompatibleWith(int expected)
Returns the number of components of this aggregate if equal to the
expected value.
|
default int |
sizeCompatibleWith(List<?> expected) |
default int |
sizeCompatibleWith(Object... expected) |
default ClockedSignalSourceVector<A> |
stored()
Returns a new aggegate whose components take snapshots of the
corresponding components of this aggregate.
|
default SignalSourceVector<A,SignalSource<A>> |
zipWith(BinaryOperator<A> op,
SignalSourceVector<A,?> other)
Returns a new aggregate that is obtained by uniformly combining the values
of the corresponding components of this and another aggregate.
|
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray
parallelStream, removeIf, stream
@Undocumented default int sizeCompatibleWith(List<?> expected)
@Undocumented default int sizeCompatibleWith(Object... expected)
default int sizeCompatibleWith(int expected)
expected
- the expected number of componentsIllegalArgumentException
- if the number of components of
this aggregate is not equal to the expected number@SafeVarargs static <A,S extends SignalSource<A>> SignalSourceVector<A,S> of(S... components)
The resulting object is a view of the passed array; concurrent mutation of array elements is observed. For immutable aggregates, no reference to the array should be shared.
components
- the componentsNullPointerException
- if components == null
static <A,S extends SignalSource<A>> SignalSourceVector<A,S> of(List<? extends S> components)
The specified list is copied internally; later mutations of the original are not reflected.
components
- the componentsNullPointerException
- if components == null
static <A,S extends SignalSource<A>> SignalSourceVector.Mutable<A,S> of(int size)
null
and must be set before use.size
- the number of components of the new aggregatestatic <A,S extends SignalSource<A>> SignalSourceVector<A,S> of(int size, IntFunction<? extends S> components)
The given function is evaluated for all valid indices, from 0
to
size-1
, in unspecified order.
components
- the component functionNullPointerException
- if components == null
static <A,S extends SignalSource<A>> SignalSourceVector<A,S> repeat(int size, S source)
size
- the number of elements of the new aggregatesource
- the signal source to use as componentIllegalArgumentException
- if size < 0
static <A,S extends SignalSource<A>> SignalSourceVector<A,S> iterate(int size, Supplier<? extends S> producer)
size
- the number of elements of the new aggregateproducer
- the producer of signal source componentsIllegalArgumentException
- if size < 0
static <A,S extends SignalSource<A>> SignalSourceVector<A,S> empty()
static <A,S extends SignalSource<A>> SignalSourceVector<A,S> singleton(S source)
source
- the component of the new aggregatedefault SignalSourceVector<A,S> append(SignalSourceVector<A,S> other)
For app = this.append(other)
, it holds that app.size() ==
this.size() + other.size()
; furthermore, for m = this.size()
,
app.get(i) == this.get(i)
holds for i < m
, and app.get(i) == other.get(i - m)
holds for i >= m
.
other
- the other aggregatedefault SignalSourceVector<A,SignalSource<A>> map(UnaryOperator<A> op)
For that = this.map(f)
, it holds that that.size() ==
this.size()
; furthermore, at any point in time, that.get(i).get() ==
op.apply(this.get(i).get())
holds.
op
- the operator to apply to the values of all componentsSignalSource.map(UnaryOperator)
default SignalSourceVector<A,SignalSource<A>> zipWith(BinaryOperator<A> op, SignalSourceVector<A,?> other)
For that = this.map(f)
, it holds that that.size() ==
this.size() == other.size()
; furthermore, at any point in time, that.get(i).get() ==
op.apply(this.get(i).get(),
other.get(i).get())
holds.
op
- the operator to apply to the values of all componentsIllegalArgumentException
- if the two aggregates are of different sizeSignalSource.zipWith(BinaryOperator, SignalSource)
default ClockedSignalSourceVector<A> stored()
SignalSource.stored()