UNPKG

@qudtlib/core

Version:

Data model for QUDTLib

84 lines (83 loc) 3.37 kB
import { SupportsEquals } from "./baseTypes.js"; import { FactorUnit } from "./factorUnit.js"; import { Unit } from "./unit.js"; import { Decimal } from "decimal.js"; import { DimensionVector } from "./dimensionVector.js"; /** * Class representing a set of FactorUnits and a conversionMultiplier, so the units can be * used to replace any other unit of the same dimensionality. */ export declare class FactorUnits implements SupportsEquals<FactorUnits> { private static readonly EMPTY_FACTOR_UNITS; readonly factorUnits: FactorUnit[]; readonly scaleFactor: Decimal; private normalized?; private dimensionVector?; constructor(factorUnits: FactorUnit[], scaleFactor?: Decimal); static ofUnit(unit: Unit): FactorUnits; static ofFactorUnitSpecWithScaleFactor(scalar: Decimal, ...factorUnitSpec: (Unit | number)[]): FactorUnits; static ofFactorUnitSpec(...factorUnitSpec: (Unit | number)[]): FactorUnits; static empty(): FactorUnits; /** * Returns this ScaledFactorUnits object, raised to the specified power. * @param power */ pow(power: number): FactorUnits; /** * * @param other */ combineWith(other: FactorUnits | undefined): FactorUnits; /** * Returns this ScaledFactorUnits object, with its conversionMultiplier multiplied by the specified value. * * @param by */ scale(by: Decimal): FactorUnits; isRatioOfSameUnits(): boolean; reduceExponents(): FactorUnits; contractExponents(): FactorUnits; hasFactorUnits(): boolean; /** * Returns true iff this factorUnits object has exactly one factor unit, which has exponent 1. */ isOneOtherUnitWithExponentOne(): boolean; normalize(): FactorUnits; expand(): FactorUnit[]; static expandFactors(factorUnits: FactorUnits): FactorUnit[]; getAllPossibleFactorUnitCombinations(): FactorUnit[][]; /** * Returns a FactorUnits object containing the scaleFactor and the factors in the numerator of * this FactorUnits object. Note that any derived units in the numerator are returned without * recursive decomposition. For example, for `5.0 * M2-PER-N` a FactorUnit object representing * `N` is returned. * * @return a FactorUnits object representing the scaleFactor and the numerator units of this * unit. */ numerator(): FactorUnits; private numeratorFactors; /** * Returns a FactorUnits object containing the factors in the denominator of this FactorUnits * object. Note that any derived units in the denominator are returned without recursive * decomposition. For example, for `5.0 * ` a FactorUnit object representing `5.0 * N` is * returned. * * @return a FactorUnits object representing the scaleFactor and the numerator units of this * unit. */ denominator(): FactorUnits; getDimensionVector(): DimensionVector; private computeDimensionVector; private denominatorFactors; getLocalname(): string; private static isEmptyOrNullish; private generateLocalname; private static factorUnitLocalname; private static permutate; private permutateFactorUnitLocalnames; generateAllLocalnamePossibilities(): string[]; equals(other?: FactorUnits): boolean; toString(): string; } //# sourceMappingURL=factorUnits.d.ts.map