UNPKG

unitsnet-js

Version:

A better way to hold unit variables and easily convert to the destination unit

267 lines (266 loc) 11.2 kB
import { BaseUnit, ToStringOptions } from "../base-unit"; /** API DTO represents a Frequency */ export interface FrequencyDto { /** The value of the Frequency */ value: number; /** The specific unit that the Frequency value is representing */ unit: FrequencyUnits; } /** FrequencyUnits enumeration */ export declare enum FrequencyUnits { /** */ Hertz = "Hertz", /** In SI units, angular frequency is normally presented with the unit radian per second, and need not express a rotational value. The unit hertz (Hz) is dimensionally equivalent, but by convention it is only used for frequency f, never for angular frequency ω. This convention is used to help avoid the confusion that arises when dealing with quantities such as frequency and angular quantities because the units of measure (such as cycle or radian) are considered to be one and hence may be omitted when expressing quantities in terms of SI units. */ RadiansPerSecond = "RadianPerSecond", /** */ CyclesPerMinute = "CyclePerMinute", /** */ CyclesPerHour = "CyclePerHour", /** */ BeatsPerMinute = "BeatPerMinute", /** */ PerSecond = "PerSecond", /** */ Microhertz = "Microhertz", /** */ Millihertz = "Millihertz", /** */ Kilohertz = "Kilohertz", /** */ Megahertz = "Megahertz", /** */ Gigahertz = "Gigahertz", /** */ Terahertz = "Terahertz" } /** The number of occurrences of a repeating event per unit time. */ export declare class Frequency extends BaseUnit { protected value: number; private hertzLazy; private radianspersecondLazy; private cyclesperminuteLazy; private cyclesperhourLazy; private beatsperminuteLazy; private persecondLazy; private microhertzLazy; private millihertzLazy; private kilohertzLazy; private megahertzLazy; private gigahertzLazy; private terahertzLazy; /** * Create a new Frequency. * @param value The value. * @param fromUnit The ‘Frequency’ unit to create from. * The default unit is Hertz */ constructor(value: number, fromUnit?: FrequencyUnits); /** * The base value of Frequency is Hertz. * 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(): FrequencyUnits.Hertz; /** */ get Hertz(): number; /** In SI units, angular frequency is normally presented with the unit radian per second, and need not express a rotational value. The unit hertz (Hz) is dimensionally equivalent, but by convention it is only used for frequency f, never for angular frequency ω. This convention is used to help avoid the confusion that arises when dealing with quantities such as frequency and angular quantities because the units of measure (such as cycle or radian) are considered to be one and hence may be omitted when expressing quantities in terms of SI units. */ get RadiansPerSecond(): number; /** */ get CyclesPerMinute(): number; /** */ get CyclesPerHour(): number; /** */ get BeatsPerMinute(): number; /** */ get PerSecond(): number; /** */ get Microhertz(): number; /** */ get Millihertz(): number; /** */ get Kilohertz(): number; /** */ get Megahertz(): number; /** */ get Gigahertz(): number; /** */ get Terahertz(): number; /** * Create a new Frequency instance from a Hertz * * @param value The unit as Hertz to create a new Frequency from. * @returns The new Frequency instance. */ static FromHertz(value: number): Frequency; /** * Create a new Frequency instance from a RadiansPerSecond * In SI units, angular frequency is normally presented with the unit radian per second, and need not express a rotational value. The unit hertz (Hz) is dimensionally equivalent, but by convention it is only used for frequency f, never for angular frequency ω. This convention is used to help avoid the confusion that arises when dealing with quantities such as frequency and angular quantities because the units of measure (such as cycle or radian) are considered to be one and hence may be omitted when expressing quantities in terms of SI units. * @param value The unit as RadiansPerSecond to create a new Frequency from. * @returns The new Frequency instance. */ static FromRadiansPerSecond(value: number): Frequency; /** * Create a new Frequency instance from a CyclesPerMinute * * @param value The unit as CyclesPerMinute to create a new Frequency from. * @returns The new Frequency instance. */ static FromCyclesPerMinute(value: number): Frequency; /** * Create a new Frequency instance from a CyclesPerHour * * @param value The unit as CyclesPerHour to create a new Frequency from. * @returns The new Frequency instance. */ static FromCyclesPerHour(value: number): Frequency; /** * Create a new Frequency instance from a BeatsPerMinute * * @param value The unit as BeatsPerMinute to create a new Frequency from. * @returns The new Frequency instance. */ static FromBeatsPerMinute(value: number): Frequency; /** * Create a new Frequency instance from a PerSecond * * @param value The unit as PerSecond to create a new Frequency from. * @returns The new Frequency instance. */ static FromPerSecond(value: number): Frequency; /** * Create a new Frequency instance from a Microhertz * * @param value The unit as Microhertz to create a new Frequency from. * @returns The new Frequency instance. */ static FromMicrohertz(value: number): Frequency; /** * Create a new Frequency instance from a Millihertz * * @param value The unit as Millihertz to create a new Frequency from. * @returns The new Frequency instance. */ static FromMillihertz(value: number): Frequency; /** * Create a new Frequency instance from a Kilohertz * * @param value The unit as Kilohertz to create a new Frequency from. * @returns The new Frequency instance. */ static FromKilohertz(value: number): Frequency; /** * Create a new Frequency instance from a Megahertz * * @param value The unit as Megahertz to create a new Frequency from. * @returns The new Frequency instance. */ static FromMegahertz(value: number): Frequency; /** * Create a new Frequency instance from a Gigahertz * * @param value The unit as Gigahertz to create a new Frequency from. * @returns The new Frequency instance. */ static FromGigahertz(value: number): Frequency; /** * Create a new Frequency instance from a Terahertz * * @param value The unit as Terahertz to create a new Frequency from. * @returns The new Frequency instance. */ static FromTerahertz(value: number): Frequency; /** * Gets the base unit enumeration associated with Frequency * @returns The unit enumeration that can be used to interact with this type */ protected static getUnitEnum(): typeof FrequencyUnits; /** * 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(): FrequencyUnits.Hertz; /** * Create API DTO represent a Frequency unit. * @param holdInUnit The specific Frequency unit to be used in the unit representation at the DTO */ toDto(holdInUnit?: FrequencyUnits): FrequencyDto; /** * Create a Frequency unit from an API DTO representation. * @param dtoFrequency The Frequency API DTO representation */ static FromDto(dtoFrequency: FrequencyDto): Frequency; /** * Convert Frequency to a specific unit value. * @param toUnit The specific unit to convert to * @returns The value of the specific unit provided. */ convert(toUnit: FrequencyUnits): number; private convertFromBase; private convertToBase; /** * Format the Frequency to string. * Note! the default format for Frequency is Hertz. * To specify the unit format set the 'unit' parameter. * @param unit The unit to format the Frequency. * @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 Frequency. */ toString(unit?: FrequencyUnits, options?: number | ToStringOptions): string; /** * Get Frequency unit abbreviation. * Note! the default abbreviation for Frequency is Hertz. * To specify the unit abbreviation set the 'unitAbbreviation' parameter. * @param unitAbbreviation The unit abbreviation of the Frequency. * @returns The abbreviation string of Frequency. */ getUnitAbbreviation(unitAbbreviation?: FrequencyUnits): string; /** * Check if the given Frequency are equals to the current Frequency. * @param frequency The other Frequency. * @returns True if the given Frequency are equal to the current Frequency. */ equals(frequency: Frequency): boolean; /** * Compare the given Frequency against the current Frequency. * @param frequency The other Frequency. * @returns 0 if they are equal, -1 if the current Frequency is less then other, 1 if the current Frequency is greater then other. */ compareTo(frequency: Frequency): number; /** * Add the given Frequency with the current Frequency. * @param frequency The other Frequency. * @returns A new Frequency instance with the results. */ add(frequency: Frequency): Frequency; /** * Subtract the given Frequency with the current Frequency. * @param frequency The other Frequency. * @returns A new Frequency instance with the results. */ subtract(frequency: Frequency): Frequency; /** * Multiply the given Frequency with the current Frequency. * @param frequency The other Frequency. * @returns A new Frequency instance with the results. */ multiply(frequency: Frequency): Frequency; /** * Divide the given Frequency with the current Frequency. * @param frequency The other Frequency. * @returns A new Frequency instance with the results. */ divide(frequency: Frequency): Frequency; /** * Modulo the given Frequency with the current Frequency. * @param frequency The other Frequency. * @returns A new Frequency instance with the results. */ modulo(frequency: Frequency): Frequency; /** * Pow the given Frequency with the current Frequency. * @param frequency The other Frequency. * @returns A new Frequency instance with the results. */ pow(frequency: Frequency): Frequency; }