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
Nested ClassesModifier and TypeClassDescriptionstatic final recordstatic enum -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a new element to this series.booleangetBegin()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.inthashCode()intsize()Get the number of elements in this series.
-
Constructor Details
-
TimeSeries
-
-
Method Details
-
getPolicy
Get the persistence policy of this series.TimeSeries.Policy.ADDadd the content to the persistence,TimeSeries.Policy.REPLACEfirst removes all persisted elements in the timespan given bygetBegin()andgetEnd().- Returns:
-
getBegin
Get the timestamp of the first element in this series.- Returns:
- the
Instantof the first element
-
getEnd
Get the timestamp of the last element in this series.- Returns:
- the
Instantof 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()
-