Quantity
interface Quantity<Q : Quantity<Q, U>, U : Enum<*>> : Comparable<Q> , Parcelable
Content copied to clipboard
A base interface for quantities. Outlines the common operations to retrieve values and perform mathematical operations.
Parameters
Q
The quantity type implementing this interface.
U
An enum type that contains the units that the quantity's values can be in.
Types
Link copied to clipboard
The options for how decimals should be treated in a string representation of a quantity.
Link copied to clipboard
The options for how a unit should be suffixed in a string representation of a quantity.
Functions
Link copied to clipboard
abstract fun toString(unit: U, decimals: Int = 0, suffixMode: Quantity.SuffixMode = SuffixMode.NOT_SEPARATED, decimalsMode: Quantity.DecimalsMode = DecimalsMode.EXACT): String
Content copied to clipboard
Returns a string representation for the value from this
with the given unit. Depending on decimalsMode, it will show either exactly or at most decimals amount of decimals after the separator. The unit will be suffixed depending on suffixMode.
Link copied to clipboard
Returns a new instance with the value from this
as negative.