Speed

Represents a finite speed of a vehicle.

The type stores speed values in a km/h up to Double.MAX_VALUE rounded to hundred-thousandths (.00001).

To construct a speed use either the extension function toSpeed, or the extension properties kph, mph or m_s available on all Number types.

To get the value of this speed expressed in a particular speed unit use the functions toInt, toLong, toDouble and toFloat.

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open operator override fun compareTo(other: Speed): Int
Link copied to clipboard
operator fun div(other: Speed): Double

Returns a number that is the ratio of this and other speed value.

operator fun div(scale: Number): Speed

Returns a speed whose value is this speed value divided by the given scale number.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
operator fun minus(other: Speed): Speed

Returns a speed whose value is the difference between this and other speed value.

Link copied to clipboard
operator fun plus(other: Speed): Speed

Returns a speed whose value is the sum of this and other speed value.

Link copied to clipboard

Returns the value of this speed expressed as an Int number of the specified unit rounded to the nearest integer.

Link copied to clipboard

Returns the value of this speed expressed as an Long number of the specified unit rounded to the nearest integer.

Link copied to clipboard
operator fun times(scale: Number): Speed

Returns a speed whose value is this speed value multiplied by the given scale number.

Link copied to clipboard

Returns the value of this speed expressed as an Double number of the specified unit.

Link copied to clipboard
fun toFloat(unit: SpeedUnit): Float

Returns the value of this speed expressed as an Float number of the specified unit.

Link copied to clipboard
fun toInt(unit: SpeedUnit): Int

Returns the value of this speed expressed as an Int number of the specified unit.

Link copied to clipboard
fun toLong(unit: SpeedUnit): Long

Returns the value of this speed expressed as an Long number of the specified unit.

Link copied to clipboard
open override fun toString(): String

Returns a string representation of this speed value in SpeedUnit.KILOMETERS_PER_HOUR.

Returns a string representation of this speed value expressed in the given unit.

Link copied to clipboard
operator fun unaryMinus(): Speed

Returns the negative of this value.