Class LinearDensity

All Implemented Interfaces:
Serializable, Comparable<LinearDensity>, Additive<LinearDensity>, Scalable<LinearDensity>, Value<LinearDensity.Unit,LinearDensity>

public class LinearDensity extends Quantity<LinearDensity,LinearDensity.Unit>
Linear density is mass per unit length of an object, measured in kilograms per meter (kg/m).

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
See Also:
  • Field Details

    • ZERO

      public static final LinearDensity ZERO
      Constant with value zero.
    • ONE

      public static final LinearDensity ONE
      Constant with value one.
    • NaN

      public static final LinearDensity NaN
      Constant with value NaN.
    • POSITIVE_INFINITY

      public static final LinearDensity POSITIVE_INFINITY
      Constant with value POSITIVE_INFINITY.
    • NEGATIVE_INFINITY

      public static final LinearDensity NEGATIVE_INFINITY
      Constant with value NEGATIVE_INFINITY.
    • POS_MAXVALUE

      public static final LinearDensity POS_MAXVALUE
      Constant with value MAX_VALUE.
    • NEG_MAXVALUE

      public static final LinearDensity NEG_MAXVALUE
      Constant with value -MAX_VALUE.
  • Constructor Details

    • LinearDensity

      public LinearDensity(double value, LinearDensity.Unit unit)
      Instantiate a LinearDensity quantity with a unit.
      Parameters:
      value - the value, expressed in the unit
      unit - the unit in which the value is expressed
    • LinearDensity

      public LinearDensity(double value, String abbreviation)
      Instantiate a LinearDensity quantity with a unit, expressed as a String.
      Parameters:
      value - the value, expressed in the unit
      abbreviation - the String abbreviation of the unit in which the value is expressed
    • LinearDensity

      public LinearDensity(LinearDensity value)
      Construct LinearDensity quantity.
      Parameters:
      value - Scalar from which to construct this instance
  • Method Details

    • ofSi

      public static LinearDensity ofSi(double si)
      Return a LinearDensity instance based on an SI value.
      Parameters:
      si - the si value
      Returns:
      the LinearDensity instance based on an SI value
    • instantiate

      public LinearDensity instantiate(double si)
      Description copied from class: Quantity
      Instantiate a quantity with an SI or base value.
      Specified by:
      instantiate in class Quantity<LinearDensity,LinearDensity.Unit>
      Parameters:
      si - the value expressed in the base (SI) unit
      Returns:
      a quantity with the given SI-value and base (SI) unit
    • siUnit

      public SIUnit siUnit()
      Description copied from class: Quantity
      Return the SI unit of this quantity.
      Overrides:
      siUnit in class Quantity<LinearDensity,LinearDensity.Unit>
      Returns:
      the SI unit of this quantity
    • valueOf

      public static LinearDensity valueOf(String text)
      Returns a LinearDensity representation of a textual representation of a value with a unit. The String representation that can be parsed is the double value in the unit, followed by a localized or English abbreviation of the unit. Spaces are allowed, but not required, between the value and the unit.
      Parameters:
      text - the textual representation to parse into a LinearDensity
      Returns:
      the Scalar representation of the value in its unit
      Throws:
      IllegalArgumentException - when the text cannot be parsed
      NullPointerException - when the text argument is null
    • of

      public static LinearDensity of(double value, String unitString)
      Returns a LinearDensity based on a value and the textual representation of the unit, which can be localized.
      Parameters:
      value - the value to use
      unitString - the textual representation of the unit
      Returns:
      the Scalar representation of the value in its unit
      Throws:
      IllegalArgumentException - when the unit cannot be parsed or is incorrect
      NullPointerException - when the unitString argument is null
    • divide

      public final Dimensionless divide(LinearDensity v)
      Calculate the division of LinearDensity and LinearDensity, which results in a Dimensionless quantity.
      Parameters:
      v - quantity
      Returns:
      quantity as a division of LinearDensity and LinearDensity
    • divide

      public final LinearObjectDensity divide(Mass mass)
      Divides this linear density by a mass to yield a linear object density.

      Formula: (kg/m) / kg = 1/m.

      Parameters:
      mass - the mass divisor; must not be null.
      Returns:
      the resulting linear object density in SI (1/m).
      Throws:
      NullPointerException - if mass is null.
    • divide

      public final Mass divide(LinearObjectDensity lod)
      Divides this linear density by a linear object density to yield a mass.

      Formula: (kg/m) / (1/m) = kg.

      Parameters:
      lod - the linear object density divisor; must not be null.
      Returns:
      the resulting mass in SI (kg).
      Throws:
      NullPointerException - if lod is null.
    • multiply

      public final Mass multiply(Length length)
      Multiplies this linear density by a length to yield a mass.

      Formula: (kg/m) * m = kg.

      Parameters:
      length - the length multiplier; must not be null.
      Returns:
      the resulting mass in SI (kg).
      Throws:
      NullPointerException - if length is null.
    • multiply

      public final FlowMass multiply(Speed speed)
      Multiplies this linear density by a speed to yield a mass flow.

      Formula: (kg/m) * (m/s) = kg/s.

      Parameters:
      speed - the speed multiplier; must not be null.
      Returns:
      the resulting mass flow in SI (kg/s).
      Throws:
      NullPointerException - if speed is null.