unitsnet-js
Version:
A better way to hold unit variables and easily convert to the destination unit
483 lines (482 loc) • 19.3 kB
TypeScript
import { BaseUnit, ToStringOptions } from "../base-unit";
/** API DTO represents a SpecificEnergy */
export interface SpecificEnergyDto {
/** The value of the SpecificEnergy */
value: number;
/** The specific unit that the SpecificEnergy value is representing */
unit: SpecificEnergyUnits;
}
/** SpecificEnergyUnits enumeration */
export declare enum SpecificEnergyUnits {
/** */
JoulesPerKilogram = "JoulePerKilogram",
/** */
MegaJoulesPerTonne = "MegaJoulePerTonne",
/** */
CaloriesPerGram = "CaloriePerGram",
/** */
WattHoursPerKilogram = "WattHourPerKilogram",
/** */
WattDaysPerKilogram = "WattDayPerKilogram",
/** */
WattDaysPerTonne = "WattDayPerTonne",
/** */
WattDaysPerShortTon = "WattDayPerShortTon",
/** */
WattHoursPerPound = "WattHourPerPound",
/** */
BtuPerPound = "BtuPerPound",
/** */
KilojoulesPerKilogram = "KilojoulePerKilogram",
/** */
MegajoulesPerKilogram = "MegajoulePerKilogram",
/** */
KilocaloriesPerGram = "KilocaloriePerGram",
/** */
KilowattHoursPerKilogram = "KilowattHourPerKilogram",
/** */
MegawattHoursPerKilogram = "MegawattHourPerKilogram",
/** */
GigawattHoursPerKilogram = "GigawattHourPerKilogram",
/** */
KilowattDaysPerKilogram = "KilowattDayPerKilogram",
/** */
MegawattDaysPerKilogram = "MegawattDayPerKilogram",
/** */
GigawattDaysPerKilogram = "GigawattDayPerKilogram",
/** */
TerawattDaysPerKilogram = "TerawattDayPerKilogram",
/** */
KilowattDaysPerTonne = "KilowattDayPerTonne",
/** */
MegawattDaysPerTonne = "MegawattDayPerTonne",
/** */
GigawattDaysPerTonne = "GigawattDayPerTonne",
/** */
TerawattDaysPerTonne = "TerawattDayPerTonne",
/** */
KilowattDaysPerShortTon = "KilowattDayPerShortTon",
/** */
MegawattDaysPerShortTon = "MegawattDayPerShortTon",
/** */
GigawattDaysPerShortTon = "GigawattDayPerShortTon",
/** */
TerawattDaysPerShortTon = "TerawattDayPerShortTon",
/** */
KilowattHoursPerPound = "KilowattHourPerPound",
/** */
MegawattHoursPerPound = "MegawattHourPerPound",
/** */
GigawattHoursPerPound = "GigawattHourPerPound"
}
/** The SpecificEnergy */
export declare class SpecificEnergy extends BaseUnit {
protected value: number;
private joulesperkilogramLazy;
private megajoulespertonneLazy;
private caloriespergramLazy;
private watthoursperkilogramLazy;
private wattdaysperkilogramLazy;
private wattdayspertonneLazy;
private wattdayspershorttonLazy;
private watthoursperpoundLazy;
private btuperpoundLazy;
private kilojoulesperkilogramLazy;
private megajoulesperkilogramLazy;
private kilocaloriespergramLazy;
private kilowatthoursperkilogramLazy;
private megawatthoursperkilogramLazy;
private gigawatthoursperkilogramLazy;
private kilowattdaysperkilogramLazy;
private megawattdaysperkilogramLazy;
private gigawattdaysperkilogramLazy;
private terawattdaysperkilogramLazy;
private kilowattdayspertonneLazy;
private megawattdayspertonneLazy;
private gigawattdayspertonneLazy;
private terawattdayspertonneLazy;
private kilowattdayspershorttonLazy;
private megawattdayspershorttonLazy;
private gigawattdayspershorttonLazy;
private terawattdayspershorttonLazy;
private kilowatthoursperpoundLazy;
private megawatthoursperpoundLazy;
private gigawatthoursperpoundLazy;
/**
* Create a new SpecificEnergy.
* @param value The value.
* @param fromUnit The ‘SpecificEnergy’ unit to create from.
* The default unit is JoulesPerKilogram
*/
constructor(value: number, fromUnit?: SpecificEnergyUnits);
/**
* The base value of SpecificEnergy is JoulesPerKilogram.
* 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(): SpecificEnergyUnits.JoulesPerKilogram;
/** */
get JoulesPerKilogram(): number;
/** */
get MegaJoulesPerTonne(): number;
/** */
get CaloriesPerGram(): number;
/** */
get WattHoursPerKilogram(): number;
/** */
get WattDaysPerKilogram(): number;
/** */
get WattDaysPerTonne(): number;
/** */
get WattDaysPerShortTon(): number;
/** */
get WattHoursPerPound(): number;
/** */
get BtuPerPound(): number;
/** */
get KilojoulesPerKilogram(): number;
/** */
get MegajoulesPerKilogram(): number;
/** */
get KilocaloriesPerGram(): number;
/** */
get KilowattHoursPerKilogram(): number;
/** */
get MegawattHoursPerKilogram(): number;
/** */
get GigawattHoursPerKilogram(): number;
/** */
get KilowattDaysPerKilogram(): number;
/** */
get MegawattDaysPerKilogram(): number;
/** */
get GigawattDaysPerKilogram(): number;
/** */
get TerawattDaysPerKilogram(): number;
/** */
get KilowattDaysPerTonne(): number;
/** */
get MegawattDaysPerTonne(): number;
/** */
get GigawattDaysPerTonne(): number;
/** */
get TerawattDaysPerTonne(): number;
/** */
get KilowattDaysPerShortTon(): number;
/** */
get MegawattDaysPerShortTon(): number;
/** */
get GigawattDaysPerShortTon(): number;
/** */
get TerawattDaysPerShortTon(): number;
/** */
get KilowattHoursPerPound(): number;
/** */
get MegawattHoursPerPound(): number;
/** */
get GigawattHoursPerPound(): number;
/**
* Create a new SpecificEnergy instance from a JoulesPerKilogram
*
* @param value The unit as JoulesPerKilogram to create a new SpecificEnergy from.
* @returns The new SpecificEnergy instance.
*/
static FromJoulesPerKilogram(value: number): SpecificEnergy;
/**
* Create a new SpecificEnergy instance from a MegaJoulesPerTonne
*
* @param value The unit as MegaJoulesPerTonne to create a new SpecificEnergy from.
* @returns The new SpecificEnergy instance.
*/
static FromMegaJoulesPerTonne(value: number): SpecificEnergy;
/**
* Create a new SpecificEnergy instance from a CaloriesPerGram
*
* @param value The unit as CaloriesPerGram to create a new SpecificEnergy from.
* @returns The new SpecificEnergy instance.
*/
static FromCaloriesPerGram(value: number): SpecificEnergy;
/**
* Create a new SpecificEnergy instance from a WattHoursPerKilogram
*
* @param value The unit as WattHoursPerKilogram to create a new SpecificEnergy from.
* @returns The new SpecificEnergy instance.
*/
static FromWattHoursPerKilogram(value: number): SpecificEnergy;
/**
* Create a new SpecificEnergy instance from a WattDaysPerKilogram
*
* @param value The unit as WattDaysPerKilogram to create a new SpecificEnergy from.
* @returns The new SpecificEnergy instance.
*/
static FromWattDaysPerKilogram(value: number): SpecificEnergy;
/**
* Create a new SpecificEnergy instance from a WattDaysPerTonne
*
* @param value The unit as WattDaysPerTonne to create a new SpecificEnergy from.
* @returns The new SpecificEnergy instance.
*/
static FromWattDaysPerTonne(value: number): SpecificEnergy;
/**
* Create a new SpecificEnergy instance from a WattDaysPerShortTon
*
* @param value The unit as WattDaysPerShortTon to create a new SpecificEnergy from.
* @returns The new SpecificEnergy instance.
*/
static FromWattDaysPerShortTon(value: number): SpecificEnergy;
/**
* Create a new SpecificEnergy instance from a WattHoursPerPound
*
* @param value The unit as WattHoursPerPound to create a new SpecificEnergy from.
* @returns The new SpecificEnergy instance.
*/
static FromWattHoursPerPound(value: number): SpecificEnergy;
/**
* Create a new SpecificEnergy instance from a BtuPerPound
*
* @param value The unit as BtuPerPound to create a new SpecificEnergy from.
* @returns The new SpecificEnergy instance.
*/
static FromBtuPerPound(value: number): SpecificEnergy;
/**
* Create a new SpecificEnergy instance from a KilojoulesPerKilogram
*
* @param value The unit as KilojoulesPerKilogram to create a new SpecificEnergy from.
* @returns The new SpecificEnergy instance.
*/
static FromKilojoulesPerKilogram(value: number): SpecificEnergy;
/**
* Create a new SpecificEnergy instance from a MegajoulesPerKilogram
*
* @param value The unit as MegajoulesPerKilogram to create a new SpecificEnergy from.
* @returns The new SpecificEnergy instance.
*/
static FromMegajoulesPerKilogram(value: number): SpecificEnergy;
/**
* Create a new SpecificEnergy instance from a KilocaloriesPerGram
*
* @param value The unit as KilocaloriesPerGram to create a new SpecificEnergy from.
* @returns The new SpecificEnergy instance.
*/
static FromKilocaloriesPerGram(value: number): SpecificEnergy;
/**
* Create a new SpecificEnergy instance from a KilowattHoursPerKilogram
*
* @param value The unit as KilowattHoursPerKilogram to create a new SpecificEnergy from.
* @returns The new SpecificEnergy instance.
*/
static FromKilowattHoursPerKilogram(value: number): SpecificEnergy;
/**
* Create a new SpecificEnergy instance from a MegawattHoursPerKilogram
*
* @param value The unit as MegawattHoursPerKilogram to create a new SpecificEnergy from.
* @returns The new SpecificEnergy instance.
*/
static FromMegawattHoursPerKilogram(value: number): SpecificEnergy;
/**
* Create a new SpecificEnergy instance from a GigawattHoursPerKilogram
*
* @param value The unit as GigawattHoursPerKilogram to create a new SpecificEnergy from.
* @returns The new SpecificEnergy instance.
*/
static FromGigawattHoursPerKilogram(value: number): SpecificEnergy;
/**
* Create a new SpecificEnergy instance from a KilowattDaysPerKilogram
*
* @param value The unit as KilowattDaysPerKilogram to create a new SpecificEnergy from.
* @returns The new SpecificEnergy instance.
*/
static FromKilowattDaysPerKilogram(value: number): SpecificEnergy;
/**
* Create a new SpecificEnergy instance from a MegawattDaysPerKilogram
*
* @param value The unit as MegawattDaysPerKilogram to create a new SpecificEnergy from.
* @returns The new SpecificEnergy instance.
*/
static FromMegawattDaysPerKilogram(value: number): SpecificEnergy;
/**
* Create a new SpecificEnergy instance from a GigawattDaysPerKilogram
*
* @param value The unit as GigawattDaysPerKilogram to create a new SpecificEnergy from.
* @returns The new SpecificEnergy instance.
*/
static FromGigawattDaysPerKilogram(value: number): SpecificEnergy;
/**
* Create a new SpecificEnergy instance from a TerawattDaysPerKilogram
*
* @param value The unit as TerawattDaysPerKilogram to create a new SpecificEnergy from.
* @returns The new SpecificEnergy instance.
*/
static FromTerawattDaysPerKilogram(value: number): SpecificEnergy;
/**
* Create a new SpecificEnergy instance from a KilowattDaysPerTonne
*
* @param value The unit as KilowattDaysPerTonne to create a new SpecificEnergy from.
* @returns The new SpecificEnergy instance.
*/
static FromKilowattDaysPerTonne(value: number): SpecificEnergy;
/**
* Create a new SpecificEnergy instance from a MegawattDaysPerTonne
*
* @param value The unit as MegawattDaysPerTonne to create a new SpecificEnergy from.
* @returns The new SpecificEnergy instance.
*/
static FromMegawattDaysPerTonne(value: number): SpecificEnergy;
/**
* Create a new SpecificEnergy instance from a GigawattDaysPerTonne
*
* @param value The unit as GigawattDaysPerTonne to create a new SpecificEnergy from.
* @returns The new SpecificEnergy instance.
*/
static FromGigawattDaysPerTonne(value: number): SpecificEnergy;
/**
* Create a new SpecificEnergy instance from a TerawattDaysPerTonne
*
* @param value The unit as TerawattDaysPerTonne to create a new SpecificEnergy from.
* @returns The new SpecificEnergy instance.
*/
static FromTerawattDaysPerTonne(value: number): SpecificEnergy;
/**
* Create a new SpecificEnergy instance from a KilowattDaysPerShortTon
*
* @param value The unit as KilowattDaysPerShortTon to create a new SpecificEnergy from.
* @returns The new SpecificEnergy instance.
*/
static FromKilowattDaysPerShortTon(value: number): SpecificEnergy;
/**
* Create a new SpecificEnergy instance from a MegawattDaysPerShortTon
*
* @param value The unit as MegawattDaysPerShortTon to create a new SpecificEnergy from.
* @returns The new SpecificEnergy instance.
*/
static FromMegawattDaysPerShortTon(value: number): SpecificEnergy;
/**
* Create a new SpecificEnergy instance from a GigawattDaysPerShortTon
*
* @param value The unit as GigawattDaysPerShortTon to create a new SpecificEnergy from.
* @returns The new SpecificEnergy instance.
*/
static FromGigawattDaysPerShortTon(value: number): SpecificEnergy;
/**
* Create a new SpecificEnergy instance from a TerawattDaysPerShortTon
*
* @param value The unit as TerawattDaysPerShortTon to create a new SpecificEnergy from.
* @returns The new SpecificEnergy instance.
*/
static FromTerawattDaysPerShortTon(value: number): SpecificEnergy;
/**
* Create a new SpecificEnergy instance from a KilowattHoursPerPound
*
* @param value The unit as KilowattHoursPerPound to create a new SpecificEnergy from.
* @returns The new SpecificEnergy instance.
*/
static FromKilowattHoursPerPound(value: number): SpecificEnergy;
/**
* Create a new SpecificEnergy instance from a MegawattHoursPerPound
*
* @param value The unit as MegawattHoursPerPound to create a new SpecificEnergy from.
* @returns The new SpecificEnergy instance.
*/
static FromMegawattHoursPerPound(value: number): SpecificEnergy;
/**
* Create a new SpecificEnergy instance from a GigawattHoursPerPound
*
* @param value The unit as GigawattHoursPerPound to create a new SpecificEnergy from.
* @returns The new SpecificEnergy instance.
*/
static FromGigawattHoursPerPound(value: number): SpecificEnergy;
/**
* Gets the base unit enumeration associated with SpecificEnergy
* @returns The unit enumeration that can be used to interact with this type
*/
protected static getUnitEnum(): typeof SpecificEnergyUnits;
/**
* 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(): SpecificEnergyUnits.JoulesPerKilogram;
/**
* Create API DTO represent a SpecificEnergy unit.
* @param holdInUnit The specific SpecificEnergy unit to be used in the unit representation at the DTO
*/
toDto(holdInUnit?: SpecificEnergyUnits): SpecificEnergyDto;
/**
* Create a SpecificEnergy unit from an API DTO representation.
* @param dtoSpecificEnergy The SpecificEnergy API DTO representation
*/
static FromDto(dtoSpecificEnergy: SpecificEnergyDto): SpecificEnergy;
/**
* Convert SpecificEnergy to a specific unit value.
* @param toUnit The specific unit to convert to
* @returns The value of the specific unit provided.
*/
convert(toUnit: SpecificEnergyUnits): number;
private convertFromBase;
private convertToBase;
/**
* Format the SpecificEnergy to string.
* Note! the default format for SpecificEnergy is JoulesPerKilogram.
* To specify the unit format set the 'unit' parameter.
* @param unit The unit to format the SpecificEnergy.
* @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 SpecificEnergy.
*/
toString(unit?: SpecificEnergyUnits, options?: number | ToStringOptions): string;
/**
* Get SpecificEnergy unit abbreviation.
* Note! the default abbreviation for SpecificEnergy is JoulesPerKilogram.
* To specify the unit abbreviation set the 'unitAbbreviation' parameter.
* @param unitAbbreviation The unit abbreviation of the SpecificEnergy.
* @returns The abbreviation string of SpecificEnergy.
*/
getUnitAbbreviation(unitAbbreviation?: SpecificEnergyUnits): string;
/**
* Check if the given SpecificEnergy are equals to the current SpecificEnergy.
* @param specificEnergy The other SpecificEnergy.
* @returns True if the given SpecificEnergy are equal to the current SpecificEnergy.
*/
equals(specificEnergy: SpecificEnergy): boolean;
/**
* Compare the given SpecificEnergy against the current SpecificEnergy.
* @param specificEnergy The other SpecificEnergy.
* @returns 0 if they are equal, -1 if the current SpecificEnergy is less then other, 1 if the current SpecificEnergy is greater then other.
*/
compareTo(specificEnergy: SpecificEnergy): number;
/**
* Add the given SpecificEnergy with the current SpecificEnergy.
* @param specificEnergy The other SpecificEnergy.
* @returns A new SpecificEnergy instance with the results.
*/
add(specificEnergy: SpecificEnergy): SpecificEnergy;
/**
* Subtract the given SpecificEnergy with the current SpecificEnergy.
* @param specificEnergy The other SpecificEnergy.
* @returns A new SpecificEnergy instance with the results.
*/
subtract(specificEnergy: SpecificEnergy): SpecificEnergy;
/**
* Multiply the given SpecificEnergy with the current SpecificEnergy.
* @param specificEnergy The other SpecificEnergy.
* @returns A new SpecificEnergy instance with the results.
*/
multiply(specificEnergy: SpecificEnergy): SpecificEnergy;
/**
* Divide the given SpecificEnergy with the current SpecificEnergy.
* @param specificEnergy The other SpecificEnergy.
* @returns A new SpecificEnergy instance with the results.
*/
divide(specificEnergy: SpecificEnergy): SpecificEnergy;
/**
* Modulo the given SpecificEnergy with the current SpecificEnergy.
* @param specificEnergy The other SpecificEnergy.
* @returns A new SpecificEnergy instance with the results.
*/
modulo(specificEnergy: SpecificEnergy): SpecificEnergy;
/**
* Pow the given SpecificEnergy with the current SpecificEnergy.
* @param specificEnergy The other SpecificEnergy.
* @returns A new SpecificEnergy instance with the results.
*/
pow(specificEnergy: SpecificEnergy): SpecificEnergy;
}