Package-level declarations

Types

Link copied to clipboard

Represents a finite distance.

Link copied to clipboard

Specifies the Distance unit.

Link copied to clipboard

Represents a finite speed of a vehicle.

Link copied to clipboard

Specifies the Speed unit.

Link copied to clipboard
sealed interface SystemOfMeasurement

Represents a system of measurement (e.g., Metric or Imperial) and provides utility functions to work with scaled DistanceUnits appropriate for the system.

Functions

Link copied to clipboard

Converts receiving Distance to given unit and rounds to exact decimals. Returns are either long or double, depending on whether the resulting value has a fractional component.

fun Speed.roundedValue(unit: SpeedUnit, decimals: Int): Number

Converts the current Speed to the specified unit and rounds it to the specified number of decimals.

Link copied to clipboard
fun Distance.roundToIncrement(unit: DistanceUnit, roundingIncrement: Int): Distance

Returns receiving Distance rounded to roundingIncrement in given unit.

Link copied to clipboard

Determines the appropriate DistanceUnit for a given Distance based on the locale.