Abstract Class: AbstractUnit<F>
Defined in: src/sdk/math/NumberUnit.ts:750
A unit of measurement.
Extended by
Type Parameters
Type Parameter |
---|
F extends string |
Implements
Unit
<F
>
Constructors
Constructor
new AbstractUnit<
F
>(name
):AbstractUnit
<F
>
Defined in: src/sdk/math/NumberUnit.ts:757
Constructor.
Parameters
Parameter | Type | Description |
---|---|---|
name | string | The name of this unit. |
Returns
AbstractUnit
<F
>
Properties
family
abstract
readonly
family:F
Defined in: src/sdk/math/NumberUnit.ts:751
This unit's family.
Implementation of
name
readonly
name:string
Defined in: src/sdk/math/NumberUnit.ts:757
The name of this unit.
Implementation of
Methods
canConvert()
canConvert(
otherUnit
):boolean
Defined in: src/sdk/math/NumberUnit.ts:761
Checks whether conversions between this unit and another unit are possible.
Parameters
Parameter | Type | Description |
---|---|---|
otherUnit | Unit <string > | The other unit. |
Returns
boolean
Whether conversions between this unit and another unit are possible.
Implementation of
convertFrom()
abstract
convertFrom(value
,fromUnit
):number
Defined in: src/sdk/math/NumberUnit.ts:769
Converts a value of another unit to this unit.
Parameters
Parameter | Type | Description |
---|---|---|
value | number | The value to convert. |
fromUnit | Unit <F > | The unit from which to convert. |
Returns
number
The converted value.
Throws
Error if attempting an invalid conversion.
Implementation of
convertTo()
abstract
convertTo(value
,toUnit
):number
Defined in: src/sdk/math/NumberUnit.ts:766
Converts a value of this unit to another unit.
Parameters
Parameter | Type | Description |
---|---|---|
value | number | The value to convert. |
toUnit | Unit <F > | The unit to which to convert. |
Returns
number
The converted value.
Throws
Error if attempting an invalid conversion.
Implementation of
createNumber()
createNumber(
value
):NumberUnit
<F
,AbstractUnit
<F
>>
Defined in: src/sdk/math/NumberUnit.ts:772
Creates a NumberUnit with a specified initial value of this unit type.
Parameters
Parameter | Type | Description |
---|---|---|
value | number | The numeric value of the new NumberUnit. |
Returns
NumberUnit
<F
, AbstractUnit
<F
>>
A NumberUnit of this unit type.
Implementation of
equals()
equals(
other
):boolean
Defined in: src/sdk/math/NumberUnit.ts:777
Checks whether this unit is equal to another unit. Returns true if and only if the other unit belongs to the same family and has the same name as this unit.
Parameters
Parameter | Type | Description |
---|---|---|
other | Unit <string > | The other unit to which to compare. |
Returns
boolean
Whether this unit is equal to the comparison.