DataPoint

public data final class DataPoint


A data point containing a value of type dataType from either a single point in time: DataType.TimeType.SAMPLE, or a range in time: DataType.TimeType.INTERVAL.

Summary

Nested types

DataPoint.Companion

Public fields

final @NonNull DataType
final @NonNull Duration

Elapsed end time of this DataPoint.

final @NonNull Bundle

Returns any provided metadata of this DataPoint.

final @NonNull Duration

Elapsed start time of this DataPoint.

final @NonNull Value

Public methods

int
boolean
final @NonNull Instant

Returns the end Instant of this DataPoint, knowing the time at which the system booted.

final @NonNull Instant

Returns the start Instant of this DataPoint, knowing the time at which the system booted.

int
void
writeToParcel(@NonNull Parcel dest, int flags)

Public fields

dataType

@NonNull
public final @NonNull DataType dataType

endDurationFromBoot

@NonNull
public final @NonNull Duration endDurationFromBoot

Elapsed end time of this DataPoint.

This represents the time at which this DataPoint ends, as a Duration since boot time. This is not exposed as a timestamp as the clock may drift between when the data is generated and when it is read out. Use getStartInstant to get the start time of this DataPoint as an Instant.

For instantaneous data points, this is equal to startDurationFromBoot.

metadata

@NonNull
public final @NonNull Bundle metadata

Returns any provided metadata of this DataPoint.

startDurationFromBoot

@NonNull
public final @NonNull Duration startDurationFromBoot

Elapsed start time of this DataPoint.

This represents the time at which this DataPoint originated, as a Duration since boot time. This is not exposed as a timestamp as the clock may drift between when the data is generated and when it is read out. Use getStartInstant to get the start time of this DataPoint as an Instant.

value

@NonNull
public final @NonNull Value value

Public methods

describeContents

@NonNull
public int describeContents()

equals

@NonNull
public boolean equals(@Nullable Object other)

getEndInstant

@NonNull
public final Instant getEndInstant(@NonNull Instant bootInstant)

Returns the end Instant of this DataPoint, knowing the time at which the system booted.

Parameters
@NonNull Instant bootInstant

the Instant at which the system booted, this can be computed by Instant.ofEpochMilli(System.currentTimeMillis() - SystemClock.elapsedRealtime())

getStartInstant

@NonNull
public final Instant getStartInstant(@NonNull Instant bootInstant)

Returns the start Instant of this DataPoint, knowing the time at which the system booted.

Parameters
@NonNull Instant bootInstant

the Instant at which the system booted, this can be computed by Instant.ofEpochMilli(System.currentTimeMillis() - SystemClock.elapsedRealtime())

hashCode

@NonNull
public int hashCode()

writeToParcel

@NonNull
public void writeToParcel(@NonNull Parcel dest, int flags)