Snapshot

@Serializable
data class Snapshot(source)

Immutable (timestamp, value) tuple representing one observation captured by a DataPoint.

The constructor is private so the two factory invocations on Companion own the trimming / numeric-formatting policy:

  • Snapshot(ts, "raw text") — strings are trimmed of incidental whitespace.

  • Snapshot(ts, 42.5) — doubles are stringified via Kotlin's default formatter ("42.5"), preserving precision for round-trip parsing.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Capture time, epoch milliseconds. 0L means "no observation yet".

Link copied to clipboard

Stringly-typed value. Numeric DataPoints should round-trip via value.toDouble() (see doubleValue); other DataTypes (TEXT, JSON, DIGITAL, COLOR) carry their natural string form.

Functions

Link copied to clipboard

Returns this snapshot's Snapshot.value parsed as a Double, or 0.0 if the value isn't a parseable number. Defensive default keeps downstream math (graphs, calculations, threshold triggers) free of NumberFormatException handling boilerplate.