UNPKG

unitsnet-js

Version:

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

135 lines (134 loc) 6.11 kB
import { BaseUnit, ToStringOptions } from "../base-unit"; /** API DTO represents a Magnetization */ export interface MagnetizationDto { /** The value of the Magnetization */ value: number; /** The specific unit that the Magnetization value is representing */ unit: MagnetizationUnits; } /** MagnetizationUnits enumeration */ export declare enum MagnetizationUnits { /** */ AmperesPerMeter = "AmperePerMeter" } /** In classical electromagnetism, magnetization is the vector field that expresses the density of permanent or induced magnetic dipole moments in a magnetic material. */ export declare class Magnetization extends BaseUnit { protected value: number; private amperespermeterLazy; /** * Create a new Magnetization. * @param value The value. * @param fromUnit The ‘Magnetization’ unit to create from. * The default unit is AmperesPerMeter */ constructor(value: number, fromUnit?: MagnetizationUnits); /** * The base value of Magnetization is AmperesPerMeter. * 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(): MagnetizationUnits.AmperesPerMeter; /** */ get AmperesPerMeter(): number; /** * Create a new Magnetization instance from a AmperesPerMeter * * @param value The unit as AmperesPerMeter to create a new Magnetization from. * @returns The new Magnetization instance. */ static FromAmperesPerMeter(value: number): Magnetization; /** * Gets the base unit enumeration associated with Magnetization * @returns The unit enumeration that can be used to interact with this type */ protected static getUnitEnum(): typeof MagnetizationUnits; /** * 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(): MagnetizationUnits.AmperesPerMeter; /** * Create API DTO represent a Magnetization unit. * @param holdInUnit The specific Magnetization unit to be used in the unit representation at the DTO */ toDto(holdInUnit?: MagnetizationUnits): MagnetizationDto; /** * Create a Magnetization unit from an API DTO representation. * @param dtoMagnetization The Magnetization API DTO representation */ static FromDto(dtoMagnetization: MagnetizationDto): Magnetization; /** * Convert Magnetization to a specific unit value. * @param toUnit The specific unit to convert to * @returns The value of the specific unit provided. */ convert(toUnit: MagnetizationUnits): number; private convertFromBase; private convertToBase; /** * Format the Magnetization to string. * Note! the default format for Magnetization is AmperesPerMeter. * To specify the unit format set the 'unit' parameter. * @param unit The unit to format the Magnetization. * @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 Magnetization. */ toString(unit?: MagnetizationUnits, options?: number | ToStringOptions): string; /** * Get Magnetization unit abbreviation. * Note! the default abbreviation for Magnetization is AmperesPerMeter. * To specify the unit abbreviation set the 'unitAbbreviation' parameter. * @param unitAbbreviation The unit abbreviation of the Magnetization. * @returns The abbreviation string of Magnetization. */ getUnitAbbreviation(unitAbbreviation?: MagnetizationUnits): string; /** * Check if the given Magnetization are equals to the current Magnetization. * @param magnetization The other Magnetization. * @returns True if the given Magnetization are equal to the current Magnetization. */ equals(magnetization: Magnetization): boolean; /** * Compare the given Magnetization against the current Magnetization. * @param magnetization The other Magnetization. * @returns 0 if they are equal, -1 if the current Magnetization is less then other, 1 if the current Magnetization is greater then other. */ compareTo(magnetization: Magnetization): number; /** * Add the given Magnetization with the current Magnetization. * @param magnetization The other Magnetization. * @returns A new Magnetization instance with the results. */ add(magnetization: Magnetization): Magnetization; /** * Subtract the given Magnetization with the current Magnetization. * @param magnetization The other Magnetization. * @returns A new Magnetization instance with the results. */ subtract(magnetization: Magnetization): Magnetization; /** * Multiply the given Magnetization with the current Magnetization. * @param magnetization The other Magnetization. * @returns A new Magnetization instance with the results. */ multiply(magnetization: Magnetization): Magnetization; /** * Divide the given Magnetization with the current Magnetization. * @param magnetization The other Magnetization. * @returns A new Magnetization instance with the results. */ divide(magnetization: Magnetization): Magnetization; /** * Modulo the given Magnetization with the current Magnetization. * @param magnetization The other Magnetization. * @returns A new Magnetization instance with the results. */ modulo(magnetization: Magnetization): Magnetization; /** * Pow the given Magnetization with the current Magnetization. * @param magnetization The other Magnetization. * @returns A new Magnetization instance with the results. */ pow(magnetization: Magnetization): Magnetization; }