public interface ObservationStream extends ThrowingIterator<OmObservation,OwsExceptionReport>, java.lang.AutoCloseable
| Modifier and Type | Method and Description |
|---|---|
default void |
close() |
default <T extends java.util.Collection<OmObservation>> |
collect(java.util.function.Supplier<T> supplier) |
static ObservationStream |
empty()
Creates an empty observation stream.
|
default ObservationStream |
filter(java.util.function.Predicate<OmObservation> predicate)
Creates a new observation stream that filters the observatons from the
original stream using the supplied predicate.
|
default java.util.Optional<OmObservation> |
findAny()
As this stream is always serial this is the same as
findFirst()
. |
default java.util.Optional<OmObservation> |
findFirst()
Gets the next value that is in the stream.
|
default ObservationStream |
flatMap(ThrowingFunction<OmObservation,ObservationStream,OwsExceptionReport> mapper)
Creates a new observation stream from a mapping function that produces a
stream for every observation in this stream.
|
default void |
forEach(ThrowingConsumer<OmObservation,OwsExceptionReport> consumer)
Deprecated.
use
ThrowingIterator.forEachRemaining(org.n52.janmayen.function.ThrowingConsumer)
as the name makes it more clear that this object can only be
iterated once. |
default ObservationStream |
map(ThrowingUnaryOperator<OmObservation,OwsExceptionReport> operator)
Produces a observation new stream from a mapping function that produces a
new observation for every observation in this stream.
|
default ObservationStream |
merge()
Creates a new stream out of this stream in which observations with the
same observation constellation are merged.
|
default ObservationStream |
merge(ObservationMergeIndicator indicator)
Creates a new stream out of this stream in which observations with the
same observation constellation are merged.
|
default ObservationStream |
modify(ThrowingConsumer<OmObservation,OwsExceptionReport> consumer)
Creates a new observation stream from an consumer that consumes every
observation before it is emitted by the stream.
|
static ObservationStream |
of(java.lang.Iterable<OmObservation> observations)
Creates a new observation stream from the supplied iterable.
|
static ObservationStream |
of(java.util.Iterator<OmObservation> observations)
Creates a new observation stream from the supplied iterator.
|
static ObservationStream |
of(OmObservation observation)
Creates a new observation stream from the supplied observation.
|
default java.util.stream.Stream<OmObservation> |
toStream()
Creates a new stream of this observation stream.
|
forEachRemaining, hasNext, next, removedefault void close()
close in interface java.lang.AutoCloseabledefault <T extends java.util.Collection<OmObservation>> T collect(java.util.function.Supplier<T> supplier) throws OwsExceptionReport
OwsExceptionReportdefault java.util.Optional<OmObservation> findFirst() throws OwsExceptionReport
OwsExceptionReport - if an error occurs during observation retrievaldefault java.util.stream.Stream<OmObservation> toStream()
RuntimeExceptions.default java.util.Optional<OmObservation> findAny() throws OwsExceptionReport
findFirst()
.OwsExceptionReport - if an error occurs during observation retrieval@CheckReturnValue default ObservationStream modify(ThrowingConsumer<OmObservation,OwsExceptionReport> consumer)
consumer - the consumer@CheckReturnValue default ObservationStream flatMap(ThrowingFunction<OmObservation,ObservationStream,OwsExceptionReport> mapper)
mapper - the mapping function@CheckReturnValue default ObservationStream map(ThrowingUnaryOperator<OmObservation,OwsExceptionReport> operator)
operator - the mapping function@CheckReturnValue default ObservationStream filter(java.util.function.Predicate<OmObservation> predicate)
predicate - the filter@CheckReturnValue default ObservationStream merge() throws OwsExceptionReport
OwsExceptionReport - if an error occurs during observation retrievalOmObservation.checkForMerge(org.n52.shetland.ogc.om.OmObservation),
OmObservation.mergeWithObservation(org.n52.shetland.ogc.om.OmObservation)@CheckReturnValue default ObservationStream merge(ObservationMergeIndicator indicator) throws OwsExceptionReport
indicator - OwsExceptionReport - if an error occurs during observation retrievalOmObservation.checkForMerge(org.n52.shetland.ogc.om.OmObservation),
OmObservation.mergeWithObservation(org.n52.shetland.ogc.om.OmObservation)@Deprecated default void forEach(ThrowingConsumer<OmObservation,OwsExceptionReport> consumer) throws OwsExceptionReport
ThrowingIterator.forEachRemaining(org.n52.janmayen.function.ThrowingConsumer)
as the name makes it more clear that this object can only be
iterated once.consumer - the consumerOwsExceptionReport - if the consumer throws an errorstatic ObservationStream empty()
static ObservationStream of(java.util.Iterator<OmObservation> observations)
observations - the observationsstatic ObservationStream of(java.lang.Iterable<OmObservation> observations)
observations - the observationsstatic ObservationStream of(OmObservation observation)
observation - the observationCopyright © 2015–2018 52°North Initiative for Geospatial Open Source Software GmbH. All rights reserved.