Class Mass.Unit

All Implemented Interfaces:
UnitInterface<Mass.Unit,Mass>
Enclosing class:
Mass

public static class Mass.Unit extends AbstractUnit<Mass.Unit,Mass>
Mass.Unit encodes the unit of the amount of matter in an object.

Copyright (c) 2025-2026 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://djunits.org. The DJUNITS project is distributed under a three-clause BSD-style license.

Author:
Alexander Verbraeck
  • Field Details

    • CONST_LB

      public static final double CONST_LB
      Constant for pound (lb).
      See Also:
    • CONST_OUNCE

      public static final double CONST_OUNCE
      Constant for ounce.
      See Also:
    • CONST_TON_SHORT

      public static final double CONST_TON_SHORT
      Constant for short ton.
      See Also:
    • CONST_TON_LONG

      public static final double CONST_TON_LONG
      Constant for long ton.
      See Also:
    • SI_UNIT

      public static final SIUnit SI_UNIT
      The dimensions of mass: kg.
    • kg

      public static final Mass.Unit kg
      kilogram.
    • SI

      public static final Mass.Unit SI
      The SI or BASE unit.
    • g

      public static final Mass.Unit g
      gram.
    • mug

      public static final Mass.Unit mug
      microgram.
    • mg

      public static final Mass.Unit mg
      milligram.
    • lb

      public static final Mass.Unit lb
      pound.
    • oz

      public static final Mass.Unit oz
      ounce.
    • long_tn

      public static final Mass.Unit long_tn
      long ton = 2240 lb.
    • sh_tn

      public static final Mass.Unit sh_tn
      short ton = 2000 lb.
    • t

      public static final Mass.Unit t
      metric ton = 1000 kg.
    • t_mts

      public static final Mass.Unit t_mts
      metric ton = 1000 kg.
    • Da

      public static final Mass.Unit Da
      Dalton, according to CODATA 2018.
    • eV

      public static final Mass.Unit eV
      electronvolt = 1.782661907E-36 kg. See http://physics.nist.gov/cuu/Constants/Table/allascii.txt.
    • mueV

      public static final Mass.Unit mueV
      microelectronvolt.
    • meV

      public static final Mass.Unit meV
      millielectronvolt (note, no dash between milli and electron; the SI style guide forbids spaces or hyphens).
    • keV

      public static final Mass.Unit keV
      kiloelectronvolt.
    • MeV

      public static final Mass.Unit MeV
      megaelectronvolt.
    • GeV

      public static final Mass.Unit GeV
      gigaelectronvolt.
  • Constructor Details

    • Unit

      public Unit(String id, String name, double scaleFactorToBaseUnit, UnitSystem unitSystem)
      Create a new Mass unit.
      Parameters:
      id - the id or main abbreviation of the unit
      name - the full name of the unit
      scaleFactorToBaseUnit - the scale factor of the unit to convert it TO the base (SI) unit
      unitSystem - the unit system such as SI or IMPERIAL
    • Unit

      public Unit(String textualAbbreviation, String displayAbbreviation, String name, Scale scale, UnitSystem unitSystem)
      Return a derived unit for this unit, with textual abbreviation(s) and a display abbreviation.
      Parameters:
      textualAbbreviation - the textual abbreviation of the unit, which doubles as the id
      displayAbbreviation - the display abbreviation of the unit
      name - the full name of the unit
      scale - the scale to use to convert between this unit and the standard (e.g., SI, BASE) unit
      unitSystem - unit system, e.g. SI or Imperial
  • Method Details

    • siUnit

      public SIUnit siUnit()
      Description copied from interface: UnitInterface
      Return the SI unit for this unit.
      Returns:
      the SI unit for this unit
    • getBaseUnit

      public Mass.Unit getBaseUnit()
      Description copied from interface: UnitInterface
      Return the base unit for this unit.
      Returns:
      the base unit for this unit
    • ofSi

      public Mass ofSi(double si)
      Description copied from interface: UnitInterface
      Return an SI-quantity for this unit with a value.
      Parameters:
      si - the value in SI or BASE units
      Returns:
      an SI-quantity for this unit with the given si-value
    • deriveUnit

      public Mass.Unit deriveUnit(String textualAbbreviation, String displayAbbreviation, String name, double scaleFactor, UnitSystem unitSystem)
      Description copied from class: AbstractUnit
      Return a linearly scaled derived unit for this unit, with textual abbreviation(s) and a display abbreviation.
      Specified by:
      deriveUnit in class AbstractUnit<Mass.Unit,Mass>
      Parameters:
      textualAbbreviation - the textual abbreviation of the unit, which doubles as the id
      displayAbbreviation - the display abbreviation of the unit
      name - the full name of the unit
      scaleFactor - the (linear) scale factor to multiply with the current (linear) scale factor
      unitSystem - unit system, e.g. SI or Imperial
      Returns:
      a derived unit for this unit