Class Mass

All Implemented Interfaces:
Serializable, Cloneable, Comparable<Mass>, Relative<MassUnit,Mass>, Value<MassUnit,Mass>

@Generated(value="org.djunits.generator.GenerateDJUNIT", date="2023-07-23T14:06:38.224104100Z") public class Mass extends DoubleScalarRel<MassUnit,Mass>
Easy access methods for the Mass DoubleScalar, which is relative by definition.

Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See DJUNITS License.

Author:
Alexander Verbraeck, Peter Knoppers
See Also:
  • Field Details

    • ZERO

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

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

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

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

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

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

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

    • Mass

      public Mass(double value, MassUnit unit)
      Construct Mass scalar.
      Parameters:
      value - double; the double value
      unit - MassUnit; unit for the double value
    • Mass

      public Mass(Mass value)
      Construct Mass scalar.
      Parameters:
      value - Mass; Scalar from which to construct this instance
  • Method Details

    • instantiateRel

      public final Mass instantiateRel(double value, MassUnit unit)
      Description copied from class: DoubleScalarRel
      Construct a new Relative Immutable DoubleScalar of the right type. Each extending class must implement this method.
      Specified by:
      instantiateRel in class DoubleScalarRel<MassUnit,Mass>
      Parameters:
      value - double; the double value
      unit - U; the unit
      Returns:
      R a new relative instance of the DoubleScalar of the right type
    • instantiateSI

      public static final Mass instantiateSI(double value)
      Construct Mass scalar.
      Parameters:
      value - double; the double value in SI units
      Returns:
      Mass; the new scalar with the SI value
    • interpolate

      public static Mass interpolate(Mass zero, Mass one, double ratio)
      Interpolate between two values.
      Parameters:
      zero - Mass; the low value
      one - Mass; the high value
      ratio - double; the ratio between 0 and 1, inclusive
      Returns:
      Mass; a Scalar at the ratio between
    • max

      public static Mass max(Mass r1, Mass r2)
      Return the maximum value of two relative scalars.
      Parameters:
      r1 - Mass; the first scalar
      r2 - Mass; the second scalar
      Returns:
      Mass; the maximum value of two relative scalars
    • max

      public static Mass max(Mass r1, Mass r2, Mass... rn)
      Return the maximum value of more than two relative scalars.
      Parameters:
      r1 - Mass; the first scalar
      r2 - Mass; the second scalar
      rn - Mass...; the other scalars
      Returns:
      Mass; the maximum value of more than two relative scalars
    • min

      public static Mass min(Mass r1, Mass r2)
      Return the minimum value of two relative scalars.
      Parameters:
      r1 - Mass; the first scalar
      r2 - Mass; the second scalar
      Returns:
      Mass; the minimum value of two relative scalars
    • min

      public static Mass min(Mass r1, Mass r2, Mass... rn)
      Return the minimum value of more than two relative scalars.
      Parameters:
      r1 - Mass; the first scalar
      r2 - Mass; the second scalar
      rn - Mass...; the other scalars
      Returns:
      Mass; the minimum value of more than two relative scalars
    • valueOf

      public static Mass valueOf(String text)
      Returns a Mass 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 - String; the textual representation to parse into a Mass
      Returns:
      Mass; 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 Mass of(double value, String unitString)
      Returns a Mass based on a value and the textual representation of the unit, which can be localized.
      Parameters:
      value - double; the value to use
      unitString - String; the textual representation of the unit
      Returns:
      Mass; 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
    • toStringSIPrefixed

      public String toStringSIPrefixed(int smallestPower, int biggestPower)
      Description copied from class: DoubleScalar
      Format this DoubleScalar in SI unit using prefixes when possible and within the specified size range. If the value is too small or too large, e-notation and the plain SI unit are used.
      Overrides:
      toStringSIPrefixed in class DoubleScalar<MassUnit,Mass>
      Parameters:
      smallestPower - int; the smallest exponent value that will be written using an SI prefix
      biggestPower - int; the largest exponent value that will be written using an SI prefix
      Returns:
      String; formatted value of this DoubleScalar
    • divide

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

      public final Duration divide(FlowMass v)
      Calculate the division of Mass and FlowMass, which results in a Duration scalar.
      Parameters:
      v - Mass; scalar
      Returns:
      Duration; scalar as a division of Mass and FlowMass
    • divide

      public final FlowMass divide(Duration v)
      Calculate the division of Mass and Duration, which results in a FlowMass scalar.
      Parameters:
      v - Mass; scalar
      Returns:
      FlowMass; scalar as a division of Mass and Duration
    • times

      public final Force times(Acceleration v)
      Calculate the multiplication of Mass and Acceleration, which results in a Force scalar.
      Parameters:
      v - Mass; scalar
      Returns:
      Force; scalar as a multiplication of Mass and Acceleration
    • times

      public final FlowMass times(Frequency v)
      Calculate the multiplication of Mass and Frequency, which results in a FlowMass scalar.
      Parameters:
      v - Mass; scalar
      Returns:
      FlowMass; scalar as a multiplication of Mass and Frequency
    • divide

      public final Volume divide(Density v)
      Calculate the division of Mass and Density, which results in a Volume scalar.
      Parameters:
      v - Mass; scalar
      Returns:
      Volume; scalar as a division of Mass and Density
    • divide

      public final Density divide(Volume v)
      Calculate the division of Mass and Volume, which results in a Density scalar.
      Parameters:
      v - Mass; scalar
      Returns:
      Density; scalar as a division of Mass and Volume
    • times

      public final Momentum times(Speed v)
      Calculate the multiplication of Mass and Speed, which results in a Momentum scalar.
      Parameters:
      v - Mass; scalar
      Returns:
      Momentum; scalar as a multiplication of Mass and Speed
    • reciprocal

      public SIScalar reciprocal()
      Description copied from class: DoubleScalarRel
      Create the reciprocal of this scalar with the correct dimensions.
      Specified by:
      reciprocal in class DoubleScalarRel<MassUnit,Mass>
      Returns:
      DoubleScalar<?>; a new scalar instance with correct SI dimensions