Class Volume.Unit

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

public static class Volume.Unit extends AbstractUnit<Volume.Unit,Volume>
Volume.Unit encodes the volume unit (length x length x length).

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_CUBIC_INCH

      public static final double CONST_CUBIC_INCH
      Constant for the cubic inch.
    • CONST_CUBIC_FOOT

      public static final double CONST_CUBIC_FOOT
      Constant for the cubic foot.
    • CONST_CUBIC_YARD

      public static final double CONST_CUBIC_YARD
      Constant for the cubic yard.
    • CONST_GALLON_IMP

      public static final double CONST_GALLON_IMP
      Constant for the imperial gallon.
      See Also:
    • CONST_OZ_IMP

      public static final double CONST_OZ_IMP
      Constant for imperial fluid ounce.
      See Also:
    • CONST_GALLON_US

      public static final double CONST_GALLON_US
      Constant for US gallon.
    • CONST_OZ_US

      public static final double CONST_OZ_US
      Constant for US fluid ounce.
    • SI_UNIT

      public static final SIUnit SI_UNIT
      The dimensions of Volume: m3.
    • m3

      public static final Volume.Unit m3
      Cubic meter.
    • SI

      public static final Volume.Unit SI
      The SI or BASE unit.
    • mm3

      public static final Volume.Unit mm3
      mm^3.
    • cm3

      public static final Volume.Unit cm3
      cm^3.
    • dm3

      public static final Volume.Unit dm3
      dm^3.
    • dam3

      public static final Volume.Unit dam3
      dam^3.
    • hm3

      public static final Volume.Unit hm3
      hm^3.
    • km3

      public static final Volume.Unit km3
      km^3.
    • in3

      public static final Volume.Unit in3
      in^3.
    • ft3

      public static final Volume.Unit ft3
      ft^3.
    • yd3

      public static final Volume.Unit yd3
      yd^3.
    • mi3

      public static final Volume.Unit mi3
      mile^3.
    • NM3

      public static final Volume.Unit NM3
      Nautical mile^3.
    • L

      public static final Volume.Unit L
      liter.
    • gal_US

      public static final Volume.Unit gal_US
      gallon (US), fluids.
    • gal_imp

      public static final Volume.Unit gal_imp
      gallon (imperial).
    • qt_US

      public static final Volume.Unit qt_US
      quart (fluid US) = 1/4 US gallon.
    • qt_imp

      public static final Volume.Unit qt_imp
      quart (imperial) = 1/4 imp gallon.
    • pt_US

      public static final Volume.Unit pt_US
      pint (fluid US) = 1/2 US quart.
    • pt_imp

      public static final Volume.Unit pt_imp
      pint (imperial) = 1/2 imp quart.
    • fl_oz_US

      public static final Volume.Unit fl_oz_US
      ounce (fluid US) = 1/16 US pint.
    • fl_oz_imp

      public static final Volume.Unit fl_oz_imp
      ounce (fluid imperial) = 1/20 imp pint.
    • ly3

      public static final Volume.Unit ly3
      Cubic lightyear.
    • pc3

      public static final Volume.Unit pc3
      Cubic Parsec.
  • Constructor Details

    • Unit

      public Unit(String id, String name, double scaleFactorToBaseUnit, UnitSystem unitSystem)
      Create a new Volume 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 Volume.Unit getBaseUnit()
      Description copied from interface: UnitInterface
      Return the base unit for this unit.
      Returns:
      the base unit for this unit
    • ofSi

      public Volume 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 Volume.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<Volume.Unit,Volume>
      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