Class SegmentIterator
- All Implemented Interfaces:
AutoCloseable
,ParchiveIterator<ParameterValueSegment>
,PeekingIterator<ParameterValueSegment>
Provides objects of type ParameterValueSegment
which contain multiple values of one parameter - suitable to
be used for bulk processing (e.g. downsampling or averaging).
The ParameterIterator
can be used to iterate over parameters value by value (at the expense of consuming more
memory)
This iterator works like a Rocks iterator (with isValid(), next(), and value()) not like a java one. The advantage is that one can look at the current value multiple times. This property is used when merging the iterators using a priority queue.
The iterator has to be closed if it is not used until the end, otherwise a rocks iterator may be left hanging
Note about the raw values retrieval: the retrieval assumes that if raw values are requested, the parameter has raw values (this can be known from the type associated to the parameter id).
Thus, if the raw values are requested and not found in the archive, the engineering values are returned as raw values. This is an optimisation done in case the two are equal.
The iterator also sends data from RealtimeFiller if that is enabled.
-
Constructor Summary
ConstructorDescriptionSegmentIterator
(ParameterArchive parchive, ParameterId parameterId, int parameterGroupId, ParameterRequest req) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close the underlying rocks iterator if not already closedint
boolean
isValid()
Returnstrue
if the iterator has more elements.void
next()
Moves the iterator to the next element.value()
Returns the current value from the iterator without advancing.
-
Constructor Details
-
SegmentIterator
public SegmentIterator(ParameterArchive parchive, ParameterId parameterId, int parameterGroupId, ParameterRequest req)
-
-
Method Details
-
isValid
public boolean isValid()Description copied from interface:PeekingIterator
Returnstrue
if the iterator has more elements.This method allows to verify whether the iterator has a valid value to be fetched.
- Specified by:
isValid
in interfacePeekingIterator<ParameterValueSegment>
- Returns:
true
if the iterator has more elements orfalse
otherwise
-
value
Description copied from interface:PeekingIterator
Returns the current value from the iterator without advancing.This method can only be called if
PeekingIterator.isValid()
returnstrue
. If called afterPeekingIterator.isValid()
returnsfalse
, this method will throw an exception.- Specified by:
value
in interfacePeekingIterator<ParameterValueSegment>
- Returns:
- the current element
-
next
public void next()Description copied from interface:PeekingIterator
Moves the iterator to the next element.If
PeekingIterator.isValid()
returnsfalse
, calling this method has no effect.- Specified by:
next
in interfacePeekingIterator<ParameterValueSegment>
-
close
public void close()Close the underlying rocks iterator if not already closed- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceParchiveIterator<ParameterValueSegment>
-
getParameterGroupId
public int getParameterGroupId() -
getParameterId
-