Package-level declarations

Types

Link copied to clipboard
abstract class DerivedUnit(var value: Number, formula: Expression) : Expression
Link copied to clipboard
data class Dimensions(val factors: Set<Factor>) : UnitPresentation

Describes dimensions of an unit with help of factors. A factor describe one separate dimension.

Link copied to clipboard
open class Expression(var value: Double, val dimensions: Dimensions) : Comparable<Expression> , UnitPresentation

Implements expression of unit with given value and dimensions

Link copied to clipboard
data class Factor(val specification: UnitSpecification<*>, val powerValue: Double = 1.0) : Comparable<Factor>

Describes one dimension of unit as logical pair of specification and powerValue.

Link copied to clipboard

Defines functions for pretty printing and dimensional analysis of measured units.

Link copied to clipboard
data class UnitSpecification<T : Expression>(val unitSymbol: String, val categorySymbol: String, val presentationPriority: Int = 0, val creator: (v: Double) -> T)

Specifies unit with properties as unitSymbol e.g. 'm', categorySymbol as 'L', presentationPriority for pretty printing e.g. by metre and second should be 'ms' ans not 'sm'. and creation function creator.

Functions

Link copied to clipboard
infix fun Expression.^(degree: Number): Expression

Allows to power an expression to given degree

infix fun Number.^(degree: Number): Number

Allows to power an number to given degree

Link copied to clipboard

Allows to divide expressions.

operator fun Expression.div(x: Number): Expression

Allows to divide expression to number.

operator fun Number.div(p: Expression): Expression

Allows to divide number to expression.

Link copied to clipboard

Allows to subtract expressions.

Link copied to clipboard
operator fun Dimensions.plus(other: Dimensions): Dimensions

Allows to add dimensions.

operator fun Expression.plus(other: Expression): Expression

Allows to add expressions.

Link copied to clipboard

Allows to calculate dimension's power.

Allows to power an expression to given degree

Link copied to clipboard
operator fun Expression.rem(other: Expression): Expression

Allows to calculate the remainder of truncating division of this value by the other value.

Link copied to clipboard
operator fun Dimensions.times(other: Dimensions): Dimensions

Allows to multiply dimensions.

operator fun Expression.times(other: Expression): Expression

Allows to multiply expressions.

operator fun Expression.times(multiplicative: Number): Expression

Allows to multiply expression and number.

operator fun Number.times(p: Expression): Expression

Allows to multiply number and expressions.

Link copied to clipboard

Implementation of -=

Link copied to clipboard

Implementation of +=

Properties

Link copied to clipboard

Prefix for mostly run-time errors.

Link copied to clipboard
const val ε: Double = 1.0E-12

Tolerance by double comparison