DistanceData

@Serializable
data class DistanceData(var fromLoc: String, var toLoc: String, var distance: Double)(source)

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

fromLoc

name of the origin location

toLoc

name of the destination location

distance

non-negative travel distance from fromLoc to toLoc

Constructors

Link copied to clipboard
constructor(fromLoc: String, toLoc: String, distance: Double)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard