Class Mass

    • Field Detail

      • 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 Detail

      • 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 Detail

      • instantiateRel

        public final Mass instantiateRel​(double value,
                                         MassUnit unit)
        Construct a new Relative Immutable DoubleScalar of the right type. Each extending class must implement this method.
        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 the official 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.
        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
      • 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