Class DoubleScalar<U extends Unit<U>,S extends DoubleScalar<U,S>>

java.lang.Object
java.lang.Number
org.djunits.value.base.Scalar<U,S>
org.djunits.value.vdouble.scalar.base.DoubleScalar<U,S>
Type Parameters:
U - the unit
S - the type
All Implemented Interfaces:
Serializable, Cloneable, Comparable<S>, Value<U,S>
Direct Known Subclasses:
DoubleScalarAbs, DoubleScalarRel

public abstract class DoubleScalar<U extends Unit<U>,S extends DoubleScalar<U,S>> extends Scalar<U,S>
The most basic abstract class for the DoubleScalar.

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 Summary

    Fields
    Modifier and Type
    Field
    Description
    final double
    The value, stored in the standard SI unit.
  • Constructor Summary

    Constructors
    Constructor
    Description
    DoubleScalar(U unit, double si)
    Construct a new DoubleScalar.
  • Method Summary

    Modifier and Type
    Method
    Description
    final int
    static SIScalar
    divide(DoubleScalarRel<?,?> left, DoubleScalarRel<?,?> right)
    Divide two values; the result is a new instance with a different (existing or generated) SI unit.
    double
    final boolean
    eq(S o)
    Test if this DoubleScalar is equal to another DoubleScalar.
    final boolean
    eq0()
    Test if this DoubleScalar is equal to 0.0.
    boolean
    float
    final boolean
    ge(S o)
    Test if this DoubleScalar is greater than or equal to another DoubleScalar.
    final boolean
    ge0()
    Test if this DoubleScalar is greater than or equal to 0.0.
    final double
    Retrieve the value in the original unit.
    final double
    getInUnit(U targetUnit)
    Retrieve the value converted into some specified unit.
    final double
    Retrieve the value in the underlying SI unit.
    final boolean
    gt(S o)
    Test if this DoubleScalar is greater than another DoubleScalar.
    final boolean
    gt0()
    Test if this DoubleScalar is greater than 0.0.
    int
    static <U extends Unit<U>, S extends DoubleScalar<U, S>>
    S
    instantiate(double value, U unit)
    Instantiate the DoubleScalar based on its unit.
    static <S extends DoubleScalar<?, S>>
    S
    instantiateAnonymous(double value, Unit<?> unit)
    Instantiate the DoubleScalar based on its unit.
    static <U extends Unit<U>, S extends DoubleScalar<U, S>>
    S
    instantiateSI(double valueSI, U displayUnit)
    Instantiate the DoubleScalar with an SI value and add the displayUnit later.
    static <AU extends AbsoluteLinearUnit<AU, RU>, RU extends Unit<RU>, R extends DoubleScalarRelWithAbs<AU, A, RU, R>, A extends DoubleScalarAbs<AU, A, RU, R>>
    A
    interpolate(A zero, A one, double ratio)
    Interpolate between two values.
    static <U extends Unit<U>, R extends DoubleScalarRel<U, R>>
    R
    interpolate(R zero, R one, double ratio)
    Interpolate between two values.
    int
    final boolean
    le(S o)
    Test if this DoubleScalar is less than or equal to another DoubleScalar.
    final boolean
    le0()
    Test if this DoubleScalar is less than or equal to 0.0.
    long
    final boolean
    lt(S o)
    Test if this DoubleScalar is less than another DoubleScalar.
    final boolean
    lt0()
    Test if this DoubleScalar is less than 0.0.
    static <U extends Unit<U>, T extends DoubleScalar<U, T>>
    T
    max(T r1, T r2)
    Return the maximum value of two relative scalars.
    static <U extends Unit<U>, T extends DoubleScalar<U, T>>
    T
    max(T r1, T r2, T... rn)
    Return the maximum value of more than two relative scalars.
    static <U extends Unit<U>, T extends DoubleScalar<U, T>>
    T
    min(T r1, T r2)
    Return the minimum value of two relative scalars.
    static <U extends Unit<U>, T extends DoubleScalar<U, T>>
    T
    min(T r1, T r2, T... rn)
    Return the minimum value of more than two relative scalars.
    static <AU extends AbsoluteLinearUnit<AU, RU>, RU extends Unit<RU>, R extends DoubleScalarRelWithAbs<AU, A, RU, R>, A extends DoubleScalarAbs<AU, A, RU, R>>
    R
    minus(A left, A right)
    Subtract two absolute values.
    static <AU extends AbsoluteLinearUnit<AU, RU>, RU extends Unit<RU>, R extends DoubleScalarRelWithAbs<AU, A, RU, R>, A extends DoubleScalarAbs<AU, A, RU, R>>
    A
    minus(A left, R right)
    Subtract a Relative value from an absolute value.
    static <U extends Unit<U>, R extends DoubleScalarRel<U, R>>
    R
    minus(R left, R right)
    Subtract a relative value from a relative value.
    static SIScalar
    multiply(DoubleScalarRel<?,?> left, DoubleScalarRel<?,?> right)
    Multiply two values; the result is a new instance with a different (existing or generated) SI unit.
    final boolean
    ne(S o)
    Test if this DoubleScalar is not equal to another DoubleScalar.
    final boolean
    ne0()
    Test if this DoubleScalar is not equal to 0.0.
    static <AU extends AbsoluteLinearUnit<AU, RU>, RU extends Unit<RU>, R extends DoubleScalarRelWithAbs<AU, A, RU, R>, A extends DoubleScalarAbs<AU, A, RU, R>>
    A
    plus(A left, R right)
    Add a Relative value to an Absolute value.
    static <AU extends AbsoluteLinearUnit<AU, RU>, RU extends Unit<RU>, R extends DoubleScalarRelWithAbs<AU, A, RU, R>, A extends DoubleScalarAbs<AU, A, RU, R>>
    A
    plus(R left, A right)
    Add an Absolute value to a Relative value.
    static <U extends Unit<U>, R extends DoubleScalarRel<U, R>>
    R
    plus(R left, R right)
    Add a Relative value to a Relative value.
    Concise display description of this value, without the engineering formatting, so without trailing zeroes.
    toDisplayString(U displayUnit)
    Concise display description of this value, without the engineering formatting, so without trailing zeroes.
    Concise description of this value.
    toString(boolean verbose, boolean withUnit)
    Somewhat verbose description of this value with optional type and unit information.
    toString(U displayUnit)
    Somewhat verbose description of this value with the values expressed in the specified unit.
    toString(U displayUnit, boolean verbose, boolean withUnit)
    Somewhat verbose description of this value with the values expressed in the specified unit.
    Format this DoubleScalar in SI unit using prefixes when possible.
    toStringSIPrefixed(int smallestPower, int biggestPower)
    Format this DoubleScalar in SI unit using prefixes when possible and within the specified size range.
    Concise textual representation of this value, without the engineering formatting, so without trailing zeroes.
    toTextualString(U displayUnit)
    Concise textual representation of this value, without the engineering formatting, so without trailing zeroes.

    Methods inherited from class org.djunits.value.base.Scalar

    format, format, getDisplayUnit, setDisplayUnit

    Methods inherited from class java.lang.Number

    byteValue, shortValue

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.djunits.value.Value

    abs, ceil, floor, isAbsolute, isRelative, neg, rint
  • Field Details

    • si

      public final double si
      The value, stored in the standard SI unit.
  • Constructor Details

    • DoubleScalar

      public DoubleScalar(U unit, double si)
      Construct a new DoubleScalar.
      Parameters:
      unit - U; the unit
      si - double; the si value to store
  • Method Details

    • getSI

      public final double getSI()
      Retrieve the value in the underlying SI unit.
      Returns:
      double
    • getInUnit

      public final double getInUnit()
      Retrieve the value in the original unit.
      Returns:
      double
    • getInUnit

      public final double getInUnit(U targetUnit)
      Retrieve the value converted into some specified unit.
      Parameters:
      targetUnit - U; the unit to convert the value into
      Returns:
      double
    • lt

      public final boolean lt(S o)
      Test if this DoubleScalar is less than another DoubleScalar.
      Specified by:
      lt in class Scalar<U extends Unit<U>,S extends DoubleScalar<U,S>>
      Parameters:
      o - T, a relative typed DoubleScalar; the right hand side operand of the comparison
      Returns:
      boolean; true if this is less than o; false otherwise
    • le

      public final boolean le(S o)
      Test if this DoubleScalar is less than or equal to another DoubleScalar.
      Specified by:
      le in class Scalar<U extends Unit<U>,S extends DoubleScalar<U,S>>
      Parameters:
      o - T, a relative typed DoubleScalar; the right hand side operand of the comparison
      Returns:
      boolean; true if this is less than or equal to o; false otherwise
    • gt

      public final boolean gt(S o)
      Test if this DoubleScalar is greater than another DoubleScalar.
      Specified by:
      gt in class Scalar<U extends Unit<U>,S extends DoubleScalar<U,S>>
      Parameters:
      o - T, a relative typed DoubleScalar; the right hand side operand of the comparison
      Returns:
      boolean; true if this is greater than o; false otherwise
    • ge

      public final boolean ge(S o)
      Test if this DoubleScalar is greater than or equal to another DoubleScalar.
      Specified by:
      ge in class Scalar<U extends Unit<U>,S extends DoubleScalar<U,S>>
      Parameters:
      o - T, a relative typed DoubleScalar; the right hand side operand of the comparison
      Returns:
      boolean; true if this is greater than or equal to o; false otherwise
    • eq

      public final boolean eq(S o)
      Test if this DoubleScalar is equal to another DoubleScalar.
      Specified by:
      eq in class Scalar<U extends Unit<U>,S extends DoubleScalar<U,S>>
      Parameters:
      o - T, a relative typed DoubleScalar; the right hand side operand of the comparison
      Returns:
      boolean; true if this is equal to o; false otherwise
    • ne

      public final boolean ne(S o)
      Test if this DoubleScalar is not equal to another DoubleScalar.
      Specified by:
      ne in class Scalar<U extends Unit<U>,S extends DoubleScalar<U,S>>
      Parameters:
      o - T, a relative typed DoubleScalar; the right hand side operand of the comparison
      Returns:
      boolean; true if this is not equal to o; false otherwise
    • lt0

      public final boolean lt0()
      Test if this DoubleScalar is less than 0.0.
      Specified by:
      lt0 in class Scalar<U extends Unit<U>,S extends DoubleScalar<U,S>>
      Returns:
      boolean; true if this is less than 0.0; false if this is not less than 0.0
    • le0

      public final boolean le0()
      Test if this DoubleScalar is less than or equal to 0.0.
      Specified by:
      le0 in class Scalar<U extends Unit<U>,S extends DoubleScalar<U,S>>
      Returns:
      boolean; true if this is less than or equal to 0.0; false if this is not less than or equal to 0.0
    • gt0

      public final boolean gt0()
      Test if this DoubleScalar is greater than 0.0.
      Specified by:
      gt0 in class Scalar<U extends Unit<U>,S extends DoubleScalar<U,S>>
      Returns:
      boolean; true if this is greater than 0.0; false if this is not greater than 0.0
    • ge0

      public final boolean ge0()
      Test if this DoubleScalar is greater than or equal to 0.0.
      Specified by:
      ge0 in class Scalar<U extends Unit<U>,S extends DoubleScalar<U,S>>
      Returns:
      boolean; true if this is greater than or equal to 0.0; false if this is not greater than or equal to 0.0
    • eq0

      public final boolean eq0()
      Test if this DoubleScalar is equal to 0.0.
      Specified by:
      eq0 in class Scalar<U extends Unit<U>,S extends DoubleScalar<U,S>>
      Returns:
      boolean; true if this is equal to 0.0; false if this is not equal to 0.0
    • ne0

      public final boolean ne0()
      Test if this DoubleScalar is not equal to 0.0.
      Specified by:
      ne0 in class Scalar<U extends Unit<U>,S extends DoubleScalar<U,S>>
      Returns:
      boolean; true if this is not equal to 0.0; false if this is equal to 0.0
    • compareTo

      public final int compareTo(S o)
    • intValue

      public int intValue()
      Specified by:
      intValue in class Number
    • longValue

      public long longValue()
      Specified by:
      longValue in class Number
    • floatValue

      public float floatValue()
      Specified by:
      floatValue in class Number
    • doubleValue

      public double doubleValue()
      Specified by:
      doubleValue in class Number
    • toString

      public String toString()
      Concise description of this value.
      Specified by:
      toString in interface Value<U extends Unit<U>,S extends DoubleScalar<U,S>>
      Overrides:
      toString in class Object
      Returns:
      a String with the value, non-verbose, with the unit attached.
    • toString

      public String toString(U displayUnit)
      Somewhat verbose description of this value with the values expressed in the specified unit.
      Parameters:
      displayUnit - U; the unit into which the values are converted for display
      Returns:
      String; printable string with the value contents expressed in the specified unit
    • toString

      public String toString(boolean verbose, boolean withUnit)
      Somewhat verbose description of this value with optional type and unit information.
      Parameters:
      verbose - boolean; if true; include type info; if false; exclude type info
      withUnit - boolean; if true; include the unit; of false; exclude the unit
      Returns:
      String; printable string with the value contents
    • toString

      public String toString(U displayUnit, boolean verbose, boolean withUnit)
      Somewhat verbose description of this value with the values expressed in the specified unit.
      Parameters:
      displayUnit - U; the unit into which the values are converted for display
      verbose - boolean; if true; include type info; if false; exclude type info
      withUnit - boolean; if true; include the unit; of false; exclude the unit
      Returns:
      String; printable string with the value contents
    • toStringSIPrefixed

      public String toStringSIPrefixed()
      Format this DoubleScalar in SI unit using prefixes when possible. If the value is too small or too large, e-notation and the plain SI unit are used.
      Returns:
      String; formatted value of this DoubleScalar
    • toStringSIPrefixed

      public String toStringSIPrefixed(int smallestPower, int biggestPower)
      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.
      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
    • toTextualString

      public String toTextualString()
      Concise textual representation of this value, without the engineering formatting, so without trailing zeroes. A space is added between the number and the unit.
      Specified by:
      toTextualString in class Scalar<U extends Unit<U>,S extends DoubleScalar<U,S>>
      Returns:
      a String with the value with the default textual representation of the unit attached.
    • toTextualString

      public String toTextualString(U displayUnit)
      Concise textual representation of this value, without the engineering formatting, so without trailing zeroes. A space is added between the number and the unit.
      Specified by:
      toTextualString in class Scalar<U extends Unit<U>,S extends DoubleScalar<U,S>>
      Parameters:
      displayUnit - U; the display unit for the value
      Returns:
      a String with the value with the default textual representation of the provided unit attached.
    • toDisplayString

      public String toDisplayString()
      Concise display description of this value, without the engineering formatting, so without trailing zeroes. A space is added between the number and the unit.
      Specified by:
      toDisplayString in class Scalar<U extends Unit<U>,S extends DoubleScalar<U,S>>
      Returns:
      a String with the value with the default display representation of the unit attached.
    • toDisplayString

      public String toDisplayString(U displayUnit)
      Concise display description of this value, without the engineering formatting, so without trailing zeroes. A space is added between the number and the unit.
      Specified by:
      toDisplayString in class Scalar<U extends Unit<U>,S extends DoubleScalar<U,S>>
      Parameters:
      displayUnit - U; the display unit for the value
      Returns:
      a String with the value with the default display representation of the provided unit attached.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • instantiate

      public static <U extends Unit<U>, S extends DoubleScalar<U, S>> S instantiate(double value, U unit)
      Instantiate the DoubleScalar based on its unit. Rigid check on types by the compiler.
      Type Parameters:
      U - the unit
      S - the return type
      Parameters:
      value - double; the value
      unit - U; the unit in which the value is expressed
      Returns:
      S; an instantiated DoubleScalar with the value expressed in the unit
    • instantiateSI

      public static <U extends Unit<U>, S extends DoubleScalar<U, S>> S instantiateSI(double valueSI, U displayUnit)
      Instantiate the DoubleScalar with an SI value and add the displayUnit later. Rigid check on types by the compiler.
      Type Parameters:
      U - the unit
      S - the return type
      Parameters:
      valueSI - double; the SIvalue
      displayUnit - U; the unit in which the value will be displayed
      Returns:
      S; an instantiated DoubleScalar with the SI value and the display unit
    • instantiateAnonymous

      public static <S extends DoubleScalar<?, S>> S instantiateAnonymous(double value, Unit<?> unit)
      Instantiate the DoubleScalar based on its unit. Loose check for types on the compiler. This allows the unit to be specified as a Unit<?> type.
      Note that it is possible to make mistakes with anonymous units.
      Type Parameters:
      S - the return type
      Parameters:
      value - double; the value
      unit - Unit<?>; the unit in which the value is expressed
      Returns:
      S; an instantiated DoubleScalar with the value expressed in the unit
    • plus

      public static <AU extends AbsoluteLinearUnit<AU, RU>, RU extends Unit<RU>, R extends DoubleScalarRelWithAbs<AU, A, RU, R>, A extends DoubleScalarAbs<AU, A, RU, R>> A plus(A left, R right)
      Add a Relative value to an Absolute value. Return a new instance of the value. The unit of the return value will be the unit of the left argument.
      Type Parameters:
      AU - Unit; the absolute unit of the parameters and the result
      RU - Unit; the relative unit of the parameters and the result
      R - the relative type
      A - the corresponding absolute type
      Parameters:
      left - A, an absolute typed DoubleScalar; the left argument
      right - R, a relative typed DoubleScalar; the right argument
      Returns:
      A; an absolute typed DoubleScalar; the sum of the values as an Absolute value
    • plus

      public static <AU extends AbsoluteLinearUnit<AU, RU>, RU extends Unit<RU>, R extends DoubleScalarRelWithAbs<AU, A, RU, R>, A extends DoubleScalarAbs<AU, A, RU, R>> A plus(R left, A right)
      Add an Absolute value to a Relative value. Return a new instance of the value. The unit of the return value will be the unit of the left argument.
      Type Parameters:
      AU - Unit; the absolute unit of the parameters and the result
      RU - Unit; the relative unit of the parameters and the result
      R - the relative type
      A - the corresponding absolute type
      Parameters:
      left - A, an absolute typed DoubleScalar; the left argument
      right - R, a relative typed DoubleScalar; the right argument
      Returns:
      A; an absolute typed DoubleScalar; the sum of the values as an Absolute value
    • plus

      public static <U extends Unit<U>, R extends DoubleScalarRel<U, R>> R plus(R left, R right)
      Add a Relative value to a Relative value. Return a new instance of the value. The unit of the return value will be the unit of the left argument.
      Type Parameters:
      U - Unit; the unit of the parameters and the result
      R - the relative type
      Parameters:
      left - R, a relative typed DoubleScalar; the left argument
      right - R, a relative typed DoubleScalar; the right argument
      Returns:
      R; a relative typed DoubleScalar; the sum of the values as a Relative value
    • minus

      public static <AU extends AbsoluteLinearUnit<AU, RU>, RU extends Unit<RU>, R extends DoubleScalarRelWithAbs<AU, A, RU, R>, A extends DoubleScalarAbs<AU, A, RU, R>> A minus(A left, R right)
      Subtract a Relative value from an absolute value. Return a new instance of the value. The unit of the return value will be the unit of the left argument.
      Type Parameters:
      AU - Unit; the absolute unit of the parameters and the result
      RU - Unit; the relative unit of the parameters and the result
      R - the relative type
      A - the corresponding absolute type
      Parameters:
      left - A, an absolute typed DoubleScalar; the left value
      right - R, a relative typed DoubleScalar; the right value
      Returns:
      A; an absolute typed DoubleScalar; the resulting value as an absolute value
    • minus

      public static <U extends Unit<U>, R extends DoubleScalarRel<U, R>> R minus(R left, R right)
      Subtract a relative value from a relative value. Return a new instance of the value. The unit of the value will be the unit of the first argument.
      Type Parameters:
      U - Unit; the unit of the parameters and the result
      R - the relative type
      Parameters:
      left - R, a relative typed DoubleScalar; the left value
      right - R, a relative typed DoubleScalar; the right value
      Returns:
      R; a relative typed DoubleScalar; the resulting value as a relative value
    • minus

      public static <AU extends AbsoluteLinearUnit<AU, RU>, RU extends Unit<RU>, R extends DoubleScalarRelWithAbs<AU, A, RU, R>, A extends DoubleScalarAbs<AU, A, RU, R>> R minus(A left, A right)
      Subtract two absolute values. Return a new instance of a relative value of the difference. The unit of the value will be the unit of the first argument.
      Type Parameters:
      AU - Unit; the absolute unit of the parameters and the result
      RU - Unit; the relative unit of the parameters and the result
      R - the relative type
      A - the corresponding absolute type
      Parameters:
      left - A, an absolute typed DoubleScalar; value 1
      right - A, an absolute typed DoubleScalar; value 2
      Returns:
      R; a relative typed DoubleScalar; the difference of the two absolute values as a relative value
    • multiply

      public static SIScalar multiply(DoubleScalarRel<?,?> left, DoubleScalarRel<?,?> right)
      Multiply two values; the result is a new instance with a different (existing or generated) SI unit.
      Parameters:
      left - DoubleScalarRel<?, ?>; the left operand
      right - DoubleScalarRel<?, ?>; the right operand
      Returns:
      DoubleScalarRel<SIUnit>; the product of the two values
    • divide

      public static SIScalar divide(DoubleScalarRel<?,?> left, DoubleScalarRel<?,?> right)
      Divide two values; the result is a new instance with a different (existing or generated) SI unit.
      Parameters:
      left - DoubleScalarRel<?, ?>; the left operand
      right - DoubleScalarRel<?, ?>; the right operand
      Returns:
      DoubleScalarRel<SIUnit>; the ratio of the two values
    • interpolate

      public static <U extends Unit<U>, R extends DoubleScalarRel<U, R>> R interpolate(R zero, R one, double ratio)
      Interpolate between two values. Made to be able to call e.g., Area a = DoubleScalar.interpolate(a1, a2, 0.4);
      Type Parameters:
      U - Unit; the unit of the parameters and the result
      R - the relative type
      Parameters:
      zero - R; the low value
      one - R; the high value
      ratio - double; the ratio between 0 and 1, inclusive
      Returns:
      R; an Absolute Scalar at the ratio between zero and one
    • interpolate

      public static <AU extends AbsoluteLinearUnit<AU, RU>, RU extends Unit<RU>, R extends DoubleScalarRelWithAbs<AU, A, RU, R>, A extends DoubleScalarAbs<AU, A, RU, R>> A interpolate(A zero, A one, double ratio)
      Interpolate between two values. Made to be able to call e.g., Time t = DoubleScalar.interpolate(t1, t2, 0.4);
      Type Parameters:
      AU - Unit; the absolute unit of the parameters and the result
      RU - Unit; the relative unit of the parameters and the result
      R - the relative type
      A - the corresponding absolute type
      Parameters:
      zero - A; the low value
      one - A; the high value
      ratio - double; the ratio between 0 and 1, inclusive
      Returns:
      R; a Relative Scalar at the ratio between zero and one
    • max

      public static <U extends Unit<U>, T extends DoubleScalar<U, T>> T max(T r1, T r2)
      Return the maximum value of two relative scalars.
      Type Parameters:
      U - Unit; the unit of the parameters and the result
      T - the argument and result type
      Parameters:
      r1 - T; the first scalar
      r2 - T; the second scalar
      Returns:
      T; the maximum value of two relative scalars
    • max

      @SafeVarargs public static <U extends Unit<U>, T extends DoubleScalar<U, T>> T max(T r1, T r2, T... rn)
      Return the maximum value of more than two relative scalars.
      Type Parameters:
      U - Unit; the unit of the parameters and the result
      T - the argument and result type
      Parameters:
      r1 - T; the first scalar
      r2 - T; the second scalar
      rn - T...; the other scalars
      Returns:
      T; the maximum value of more than two relative scalars
    • min

      public static <U extends Unit<U>, T extends DoubleScalar<U, T>> T min(T r1, T r2)
      Return the minimum value of two relative scalars.
      Type Parameters:
      U - Unit; the unit of the parameters and the result
      T - the argument and result type
      Parameters:
      r1 - T; the first scalar
      r2 - T; the second scalar
      Returns:
      T; the minimum value of two relative scalars
    • min

      @SafeVarargs public static <U extends Unit<U>, T extends DoubleScalar<U, T>> T min(T r1, T r2, T... rn)
      Return the minimum value of more than two relative scalars.
      Type Parameters:
      U - Unit; the unit of the parameters and the result
      T - the argument and result type
      Parameters:
      r1 - T; the first scalar
      r2 - T; the second scalar
      rn - T...; the other scalars
      Returns:
      T; the minimum value of more than two relative scalars