unitsnet-js
Version:
A better way to hold unit variables and easily convert to the destination unit
159 lines (158 loc) • 7.14 kB
TypeScript
import { BaseUnit, ToStringOptions } from "../base-unit";
/** API DTO represents a AreaDensity */
export interface AreaDensityDto {
/** The value of the AreaDensity */
value: number;
/** The specific unit that the AreaDensity value is representing */
unit: AreaDensityUnits;
}
/** AreaDensityUnits enumeration */
export declare enum AreaDensityUnits {
/** */
KilogramsPerSquareMeter = "KilogramPerSquareMeter",
/** Also known as grammage for paper industry. In fiber industry used with abbreviation 'gsm'. */
GramsPerSquareMeter = "GramPerSquareMeter",
/** */
MilligramsPerSquareMeter = "MilligramPerSquareMeter"
}
/** The area density of a two-dimensional object is calculated as the mass per unit area. For paper this is also called grammage. */
export declare class AreaDensity extends BaseUnit {
protected value: number;
private kilogramspersquaremeterLazy;
private gramspersquaremeterLazy;
private milligramspersquaremeterLazy;
/**
* Create a new AreaDensity.
* @param value The value.
* @param fromUnit The ‘AreaDensity’ unit to create from.
* The default unit is KilogramsPerSquareMeter
*/
constructor(value: number, fromUnit?: AreaDensityUnits);
/**
* The base value of AreaDensity is KilogramsPerSquareMeter.
* This accessor used when needs a value for calculations and it's better to use directly the base value
*/
get BaseValue(): number;
/** Gets the default unit used when creating instances of the unit or its DTO */
protected get baseUnit(): AreaDensityUnits.KilogramsPerSquareMeter;
/** */
get KilogramsPerSquareMeter(): number;
/** Also known as grammage for paper industry. In fiber industry used with abbreviation 'gsm'. */
get GramsPerSquareMeter(): number;
/** */
get MilligramsPerSquareMeter(): number;
/**
* Create a new AreaDensity instance from a KilogramsPerSquareMeter
*
* @param value The unit as KilogramsPerSquareMeter to create a new AreaDensity from.
* @returns The new AreaDensity instance.
*/
static FromKilogramsPerSquareMeter(value: number): AreaDensity;
/**
* Create a new AreaDensity instance from a GramsPerSquareMeter
* Also known as grammage for paper industry. In fiber industry used with abbreviation 'gsm'.
* @param value The unit as GramsPerSquareMeter to create a new AreaDensity from.
* @returns The new AreaDensity instance.
*/
static FromGramsPerSquareMeter(value: number): AreaDensity;
/**
* Create a new AreaDensity instance from a MilligramsPerSquareMeter
*
* @param value The unit as MilligramsPerSquareMeter to create a new AreaDensity from.
* @returns The new AreaDensity instance.
*/
static FromMilligramsPerSquareMeter(value: number): AreaDensity;
/**
* Gets the base unit enumeration associated with AreaDensity
* @returns The unit enumeration that can be used to interact with this type
*/
protected static getUnitEnum(): typeof AreaDensityUnits;
/**
* Gets the default unit used when creating instances of the unit or its DTO
* @returns The unit enumeration value used as a default parameter in constructor and DTO methods
*/
protected static getBaseUnit(): AreaDensityUnits.KilogramsPerSquareMeter;
/**
* Create API DTO represent a AreaDensity unit.
* @param holdInUnit The specific AreaDensity unit to be used in the unit representation at the DTO
*/
toDto(holdInUnit?: AreaDensityUnits): AreaDensityDto;
/**
* Create a AreaDensity unit from an API DTO representation.
* @param dtoAreaDensity The AreaDensity API DTO representation
*/
static FromDto(dtoAreaDensity: AreaDensityDto): AreaDensity;
/**
* Convert AreaDensity to a specific unit value.
* @param toUnit The specific unit to convert to
* @returns The value of the specific unit provided.
*/
convert(toUnit: AreaDensityUnits): number;
private convertFromBase;
private convertToBase;
/**
* Format the AreaDensity to string.
* Note! the default format for AreaDensity is KilogramsPerSquareMeter.
* To specify the unit format set the 'unit' parameter.
* @param unit The unit to format the AreaDensity.
* @param options The ToString options, it also can be the number of fractional digits to keep that deprecated and moved to the options object. support in number will be dropped in the upcoming versions.
* @returns The string format of the AreaDensity.
*/
toString(unit?: AreaDensityUnits, options?: number | ToStringOptions): string;
/**
* Get AreaDensity unit abbreviation.
* Note! the default abbreviation for AreaDensity is KilogramsPerSquareMeter.
* To specify the unit abbreviation set the 'unitAbbreviation' parameter.
* @param unitAbbreviation The unit abbreviation of the AreaDensity.
* @returns The abbreviation string of AreaDensity.
*/
getUnitAbbreviation(unitAbbreviation?: AreaDensityUnits): string;
/**
* Check if the given AreaDensity are equals to the current AreaDensity.
* @param areaDensity The other AreaDensity.
* @returns True if the given AreaDensity are equal to the current AreaDensity.
*/
equals(areaDensity: AreaDensity): boolean;
/**
* Compare the given AreaDensity against the current AreaDensity.
* @param areaDensity The other AreaDensity.
* @returns 0 if they are equal, -1 if the current AreaDensity is less then other, 1 if the current AreaDensity is greater then other.
*/
compareTo(areaDensity: AreaDensity): number;
/**
* Add the given AreaDensity with the current AreaDensity.
* @param areaDensity The other AreaDensity.
* @returns A new AreaDensity instance with the results.
*/
add(areaDensity: AreaDensity): AreaDensity;
/**
* Subtract the given AreaDensity with the current AreaDensity.
* @param areaDensity The other AreaDensity.
* @returns A new AreaDensity instance with the results.
*/
subtract(areaDensity: AreaDensity): AreaDensity;
/**
* Multiply the given AreaDensity with the current AreaDensity.
* @param areaDensity The other AreaDensity.
* @returns A new AreaDensity instance with the results.
*/
multiply(areaDensity: AreaDensity): AreaDensity;
/**
* Divide the given AreaDensity with the current AreaDensity.
* @param areaDensity The other AreaDensity.
* @returns A new AreaDensity instance with the results.
*/
divide(areaDensity: AreaDensity): AreaDensity;
/**
* Modulo the given AreaDensity with the current AreaDensity.
* @param areaDensity The other AreaDensity.
* @returns A new AreaDensity instance with the results.
*/
modulo(areaDensity: AreaDensity): AreaDensity;
/**
* Pow the given AreaDensity with the current AreaDensity.
* @param areaDensity The other AreaDensity.
* @returns A new AreaDensity instance with the results.
*/
pow(areaDensity: AreaDensity): AreaDensity;
}