Distance Data
@Serializable
A directed distance between two named locations.
Each instance represents a one-way connection: the travel distance from fromLoc to toLoc. A symmetric route requires two entries (one in each direction), or use DistancesModel.addDistance with symmetric = true.
distance must be non-negative; the init block enforces this with require. Because all three properties are var, individual fields may be updated in place before a DistancesData list is applied to a DistancesModel.
The class is annotated @Serializable so that List<DistanceData> (aliased as DistancesData) round-trips through JSON without extra configuration.
Parameters
from Loc
name of the origin location
to Loc
name of the destination location
distance
non-negative travel distance from fromLoc to toLoc