Snapshot
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.
Properties
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
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.