Options
All
  • Public
  • Public/Protected
  • All
Menu

Module ria/uom/UnitOfMeasureRegistry

A registry that maintains the known UnitOfMeasure.

Two possible Units of Measure exist

You can specify new UnitOfMeasure using the respective register methods (registerStandardUnit and registerConversionUnit).

Overview

Functions

getUnitOfMeasure

  • Retrieves the Unit of Measure that is identified with a given name.

    throws

    Error if the requested Unit Of Measure does not exist

    Parameters

    • name: string

      The name that identifies the Unit of Measure being requested.

    Returns UnitOfMeasure

    The requested Unit Of measure

registerConversionUnit

  • (name: string, symbol: string, quantityKindName: string, conversionMultiplier: number, conversionOffset: number): UnitOfMeasure
  • Register a non-standard unit-of-measure, with given conversion factors and offsets, to be able to map to the standard unit-of-measure for that specific quantity kind.

    var yardUOM = UnitOfMeasureRegistry.registerConversionUnit("Yard", "yd", "Length", 0.9144, 0);

    Parameters

    • name: string
    • symbol: string

      The symbol of the UnitOfMeasure

    • quantityKindName: string

      The name of the QuantityKind of this UnitOfMeasure. A QuantityKind with this name MUST exist in the QuantityKindRegistry.

    • conversionMultiplier: number

      The conversion multiplier (Number) of the UnitOfMeasure

    • conversionOffset: number

      The conversion offset of the UnitOfMeasure

    Returns UnitOfMeasure

    the registered UnitOfMeasure

registerStandardUnit

  • (name: string, symbol: string, quantityKindName: string): UnitOfMeasure
  • Register a new unit of measure that acts as a standard for a quantity kind. All non-standard unit of measures of the same quantity kind will map to this standard unit of measure.

    var squareMeterUOM = UnitOfMeasureRegistry.registerStandardUnit("SquareMeter", "m2", "Area");
    var acreUOM = UnitOfMeasureRegistry.registerConversionUnit("Acre", "ac", "Area", 4046.68, 0);

    Parameters

    • name: string
    • symbol: string

      The symbol of the UnitOfMeasure

    • quantityKindName: string

      The name of the QuantityKind of this UnitOfMeasure. A QuantityKind with this name MUST exist in the QuantityKindRegistry.

    Returns UnitOfMeasure

    the registered UnitOfMeasure

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method