UNPKG

unitsnet-js

Version:

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

171 lines (170 loc) 7.86 kB
import { BaseUnit, ToStringOptions } from "../base-unit"; /** API DTO represents a FuelEfficiency */ export interface FuelEfficiencyDto { /** The value of the FuelEfficiency */ value: number; /** The specific unit that the FuelEfficiency value is representing */ unit: FuelEfficiencyUnits; } /** FuelEfficiencyUnits enumeration */ export declare enum FuelEfficiencyUnits { /** */ LitersPer100Kilometers = "LiterPer100Kilometers", /** */ MilesPerUsGallon = "MilePerUsGallon", /** */ MilesPerUkGallon = "MilePerUkGallon", /** */ KilometersPerLiter = "KilometerPerLiter" } /** In the context of transport, fuel economy is the energy efficiency of a particular vehicle, given as a ratio of distance traveled per unit of fuel consumed. In most countries, using the metric system, fuel economy is stated as "fuel consumption" in liters per 100 kilometers (L/100 km) or kilometers per liter (km/L or kmpl). In countries using non-metric system, fuel economy is expressed in miles per gallon (mpg) (imperial galon or US galon). */ export declare class FuelEfficiency extends BaseUnit { protected value: number; private litersper100kilometersLazy; private milesperusgallonLazy; private milesperukgallonLazy; private kilometersperliterLazy; /** * Create a new FuelEfficiency. * @param value The value. * @param fromUnit The ‘FuelEfficiency’ unit to create from. * The default unit is KilometersPerLiter */ constructor(value: number, fromUnit?: FuelEfficiencyUnits); /** * The base value of FuelEfficiency is KilometersPerLiter. * 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(): FuelEfficiencyUnits.KilometersPerLiter; /** */ get LitersPer100Kilometers(): number; /** */ get MilesPerUsGallon(): number; /** */ get MilesPerUkGallon(): number; /** */ get KilometersPerLiter(): number; /** * Create a new FuelEfficiency instance from a LitersPer100Kilometers * * @param value The unit as LitersPer100Kilometers to create a new FuelEfficiency from. * @returns The new FuelEfficiency instance. */ static FromLitersPer100Kilometers(value: number): FuelEfficiency; /** * Create a new FuelEfficiency instance from a MilesPerUsGallon * * @param value The unit as MilesPerUsGallon to create a new FuelEfficiency from. * @returns The new FuelEfficiency instance. */ static FromMilesPerUsGallon(value: number): FuelEfficiency; /** * Create a new FuelEfficiency instance from a MilesPerUkGallon * * @param value The unit as MilesPerUkGallon to create a new FuelEfficiency from. * @returns The new FuelEfficiency instance. */ static FromMilesPerUkGallon(value: number): FuelEfficiency; /** * Create a new FuelEfficiency instance from a KilometersPerLiter * * @param value The unit as KilometersPerLiter to create a new FuelEfficiency from. * @returns The new FuelEfficiency instance. */ static FromKilometersPerLiter(value: number): FuelEfficiency; /** * Gets the base unit enumeration associated with FuelEfficiency * @returns The unit enumeration that can be used to interact with this type */ protected static getUnitEnum(): typeof FuelEfficiencyUnits; /** * 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(): FuelEfficiencyUnits.KilometersPerLiter; /** * Create API DTO represent a FuelEfficiency unit. * @param holdInUnit The specific FuelEfficiency unit to be used in the unit representation at the DTO */ toDto(holdInUnit?: FuelEfficiencyUnits): FuelEfficiencyDto; /** * Create a FuelEfficiency unit from an API DTO representation. * @param dtoFuelEfficiency The FuelEfficiency API DTO representation */ static FromDto(dtoFuelEfficiency: FuelEfficiencyDto): FuelEfficiency; /** * Convert FuelEfficiency to a specific unit value. * @param toUnit The specific unit to convert to * @returns The value of the specific unit provided. */ convert(toUnit: FuelEfficiencyUnits): number; private convertFromBase; private convertToBase; /** * Format the FuelEfficiency to string. * Note! the default format for FuelEfficiency is KilometersPerLiter. * To specify the unit format set the 'unit' parameter. * @param unit The unit to format the FuelEfficiency. * @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 FuelEfficiency. */ toString(unit?: FuelEfficiencyUnits, options?: number | ToStringOptions): string; /** * Get FuelEfficiency unit abbreviation. * Note! the default abbreviation for FuelEfficiency is KilometersPerLiter. * To specify the unit abbreviation set the 'unitAbbreviation' parameter. * @param unitAbbreviation The unit abbreviation of the FuelEfficiency. * @returns The abbreviation string of FuelEfficiency. */ getUnitAbbreviation(unitAbbreviation?: FuelEfficiencyUnits): string; /** * Check if the given FuelEfficiency are equals to the current FuelEfficiency. * @param fuelEfficiency The other FuelEfficiency. * @returns True if the given FuelEfficiency are equal to the current FuelEfficiency. */ equals(fuelEfficiency: FuelEfficiency): boolean; /** * Compare the given FuelEfficiency against the current FuelEfficiency. * @param fuelEfficiency The other FuelEfficiency. * @returns 0 if they are equal, -1 if the current FuelEfficiency is less then other, 1 if the current FuelEfficiency is greater then other. */ compareTo(fuelEfficiency: FuelEfficiency): number; /** * Add the given FuelEfficiency with the current FuelEfficiency. * @param fuelEfficiency The other FuelEfficiency. * @returns A new FuelEfficiency instance with the results. */ add(fuelEfficiency: FuelEfficiency): FuelEfficiency; /** * Subtract the given FuelEfficiency with the current FuelEfficiency. * @param fuelEfficiency The other FuelEfficiency. * @returns A new FuelEfficiency instance with the results. */ subtract(fuelEfficiency: FuelEfficiency): FuelEfficiency; /** * Multiply the given FuelEfficiency with the current FuelEfficiency. * @param fuelEfficiency The other FuelEfficiency. * @returns A new FuelEfficiency instance with the results. */ multiply(fuelEfficiency: FuelEfficiency): FuelEfficiency; /** * Divide the given FuelEfficiency with the current FuelEfficiency. * @param fuelEfficiency The other FuelEfficiency. * @returns A new FuelEfficiency instance with the results. */ divide(fuelEfficiency: FuelEfficiency): FuelEfficiency; /** * Modulo the given FuelEfficiency with the current FuelEfficiency. * @param fuelEfficiency The other FuelEfficiency. * @returns A new FuelEfficiency instance with the results. */ modulo(fuelEfficiency: FuelEfficiency): FuelEfficiency; /** * Pow the given FuelEfficiency with the current FuelEfficiency. * @param fuelEfficiency The other FuelEfficiency. * @returns A new FuelEfficiency instance with the results. */ pow(fuelEfficiency: FuelEfficiency): FuelEfficiency; }