public interface Reduction<T> extends ExcerptListener
| Modifier and Type | Interface and Description |
|---|---|
static interface |
Reduction.DoubleReductionBuilder |
static interface |
Reduction.LongReductionBuilder |
static interface |
Reduction.ReductionBuilder<E> |
| Modifier and Type | Method and Description |
|---|---|
default long |
accept(@NotNull MarshallableIn tailer)
Accepts the input of the provided
tailer and reduces (folds) the contents of it
into this Reduction returning the last seen index or -1 if no index was seen. |
static <E> Reduction.ReductionBuilder<E> |
of(@NotNull DocumentExtractor<E> extractor)
Creates and returns a new ReductionBuilder that will use the provided
{@code extractor) to extract elements of type E.
|
static Reduction.DoubleReductionBuilder |
ofDouble(@NotNull ToDoubleDocumentExtractor extractor)
Creates and returns a new DoubleReductionBuilder that will use the provided
extractor) to extract elements of type {@code double}.
|
static Reduction.LongReductionBuilder |
ofLong(@NotNull ToLongDocumentExtractor extractor)
Creates and returns a new LongReductionBuilder that will use the provided
extractor) to extract elements of type {@code long}.
|
void |
onExcerpt(@NotNull Wire wire,
long index)
Consumes an excerpt from the provided
wire at the index at the provided index. |
T |
reduction()
Returns a view of the underlying reduction.
|
andThenvoid onExcerpt(@NotNull
@NotNull Wire wire,
long index)
throws net.openhft.chronicle.core.io.InvalidMarshallableException
wire at the index at the provided index.
If this method throws an Exception, it is relayed to the call site. Therefore, care should be taken to minimise the probability of throwing Exceptions.
If this method is referenced as an ExcerptListener then the Reduction must be
thread-safe.
onExcerpt in interface ExcerptListenerwire - representing access to the excerpt that was stored (non-null).index - in the queue where the except was placed (non-negative)net.openhft.chronicle.core.io.InvalidMarshallableException@NotNull T reduction()
default long accept(@NotNull
@NotNull MarshallableIn tailer)
throws net.openhft.chronicle.core.io.InvalidMarshallableException
tailer and reduces (folds) the contents of it
into this Reduction returning the last seen index or -1 if no index was seen.
This method can be used to initialise a Reduction before appending new values.
It is the responsibility of the caller to make sure no simultaneous appenders are using this Reduction during the entire fold operation.
tailer - to reduce (fold) fromNullPointerException - if the provided tailer is nullnet.openhft.chronicle.core.io.InvalidMarshallableExceptionstatic <E> Reduction.ReductionBuilder<E> of(@NotNull @NotNull DocumentExtractor<E> extractor)
E - element typeextractor - (non-null)LongReductionBuilder, DoubleReductionBuilderstatic Reduction.LongReductionBuilder ofLong(@NotNull @NotNull ToLongDocumentExtractor extractor)
extractor - (non-null)#ofLong(ToLongDocumentExtractor)} and {@link #ofDouble(ToDoubleDocumentExtractor)}static Reduction.DoubleReductionBuilder ofDouble(@NotNull @NotNull ToDoubleDocumentExtractor extractor)
extractor - (non-null)#of(DocumentExtractor)} and {@link #ofLong(ToLongDocumentExtractor)}Copyright © 2023. All rights reserved.