Package org.openhab.core.types
Class TimeSeries
java.lang.Object
org.openhab.core.types.TimeSeries
The
TimeSeries
is used to transport a set of states together with their timestamp.
It can be used for persisting historic state or forecasts.- Author:
- Jan N. Klug - Initial contribution
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final record
static enum
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a new element to this series.boolean
getBegin()
Get the timestamp of the first element in this series.getEnd()
Get the timestamp of the last element in this series.Get the persistence policy of this series.Get the content of this series.int
hashCode()
int
size()
Get the number of elements in this series.
-
Constructor Details
-
TimeSeries
-
-
Method Details
-
getPolicy
Get the persistence policy of this series.TimeSeries.Policy.ADD
add the content to the persistence,TimeSeries.Policy.REPLACE
first removes all persisted elements in the timespan given bygetBegin()
andgetEnd()
.- Returns:
-
getBegin
Get the timestamp of the first element in this series.- Returns:
- the
Instant
of the first element
-
getEnd
Get the timestamp of the last element in this series.- Returns:
- the
Instant
of the last element
-
size
public int size()Get the number of elements in this series.- Returns:
- the number of elements
-
add
Add a new element to this series. Elements can be added in an arbitrary order and are sorted chronologically. -
getStates
Get the content of this series. The entries are returned in chronological order, earlier entries before later entries.- Returns:
- a
Stream<TimeSeries.Entry>
with the content of this series.
-
equals
-
hashCode
public int hashCode()
-