Class DoubleScalarAbs<AU extends AbsoluteLinearUnit<AU,RU>,A extends DoubleScalarAbs<AU,A,RU,R>,RU extends Unit<RU>,R extends DoubleScalarRelWithAbs<AU,A,RU,R>>

java.lang.Object
java.lang.Number
org.djunits.value.base.Scalar<U,S>
org.djunits.value.vdouble.scalar.base.DoubleScalar<AU,A>
org.djunits.value.vdouble.scalar.base.DoubleScalarAbs<AU,A,RU,R>
Type Parameters:
AU - the absolute unit
A - the Absolute class for reference purposes
RU - the relative unit
R - the Relative class for reference purposes
All Implemented Interfaces:
Serializable, Cloneable, Comparable<A>, Absolute<AU,A,RU,R>, Value<AU,A>
Direct Known Subclasses:
AbsoluteTemperature, Direction, Position, Time

public abstract class DoubleScalarAbs<AU extends AbsoluteLinearUnit<AU,RU>,A extends DoubleScalarAbs<AU,A,RU,R>,RU extends Unit<RU>,R extends DoubleScalarRelWithAbs<AU,A,RU,R>> extends DoubleScalar<AU,A> implements Absolute<AU,A,RU,R>
The typed, abstract DoubleScalarAbs class that forms the basis of all DoubleScalar definitions and extensions.
Note: A relative scalar class can implement the toAbs() method if it has an absolute equivalent.

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:
  • Constructor Details

    • DoubleScalarAbs

      public DoubleScalarAbs(double value, AU unit)
      Construct a new Absolute Immutable DoubleScalar.
      Parameters:
      value - double; the value of the new Absolute Immutable DoubleScalar
      unit - AU; the unit of the new Absolute Immutable DoubleScalar
    • DoubleScalarAbs

      public DoubleScalarAbs(A value)
      Construct a new Absolute Immutable DoubleScalar from an existing Absolute Immutable DoubleScalar.
      Parameters:
      value - A, an absolute typed DoubleScalar; the reference
  • Method Details

    • instantiateRel

      public abstract R instantiateRel(double value, RU 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 - RU; the unit
      Returns:
      R a new relative instance of the DoubleScalar of the right type
    • instantiateAbs

      public abstract A instantiateAbs(double value, AU unit)
      Construct a new Absolute Immutable DoubleScalar of the right type. Each extending class must implement this method.
      Parameters:
      value - double; the double value
      unit - AU; the absolute unit
      Returns:
      A a new absolute instance of the DoubleScalar of the right type
    • plus

      public final A plus(R increment)
      Add a Relative value to this Absolute value. A new value is returned due to immutability.
      Specified by:
      plus in interface Absolute<AU extends AbsoluteLinearUnit<AU,RU>,A extends DoubleScalarAbs<AU,A,RU,R>,RU extends Unit<RU>,R extends DoubleScalarRelWithAbs<AU,A,RU,R>>
      Parameters:
      increment - R; R the right operand
      Returns:
      A; the sum of this value and the operand
    • minus

      public final A minus(R decrement)
      Subtract a Relative value from this Absolute value. A new value is returned due to immutability.
      Specified by:
      minus in interface Absolute<AU extends AbsoluteLinearUnit<AU,RU>,A extends DoubleScalarAbs<AU,A,RU,R>,RU extends Unit<RU>,R extends DoubleScalarRelWithAbs<AU,A,RU,R>>
      Parameters:
      decrement - R; R the right operand
      Returns:
      A; the subtraction of this value and the operand
    • minus

      public final R minus(A decrement)
      Subtract an Absolute value from this Absolute value, resulting in a Relative value. A new value is returned due to immutability.
      Specified by:
      minus in interface Absolute<AU extends AbsoluteLinearUnit<AU,RU>,A extends DoubleScalarAbs<AU,A,RU,R>,RU extends Unit<RU>,R extends DoubleScalarRelWithAbs<AU,A,RU,R>>
      Parameters:
      decrement - A; A the right operand
      Returns:
      R; the subtraction of this value and the operand
    • abs

      public A abs()
      Return a new Scalar/Vector/Matrix with absolute value(s).
      Specified by:
      abs in interface Value<AU extends AbsoluteLinearUnit<AU,RU>,A extends DoubleScalarAbs<AU,A,RU,R>>
      Returns:
      R; a new R with absolute value(s)
    • ceil

      public A ceil()
      Return a new Scalar/Vector/Matrix with the nearest integer value(s) above the current value(s).
      Specified by:
      ceil in interface Value<AU extends AbsoluteLinearUnit<AU,RU>,A extends DoubleScalarAbs<AU,A,RU,R>>
      Returns:
      R; a new R with absolute value(s)
    • floor

      public A floor()
      Return a new Scalar/Vector/Matrix with the nearest integer value(s) below the current value(s).
      Specified by:
      floor in interface Value<AU extends AbsoluteLinearUnit<AU,RU>,A extends DoubleScalarAbs<AU,A,RU,R>>
      Returns:
      R; a new R with absolute value(s)
    • neg

      public A neg()
      Return a new Scalar/Vector/Matrix with negated value(s).
      Specified by:
      neg in interface Value<AU extends AbsoluteLinearUnit<AU,RU>,A extends DoubleScalarAbs<AU,A,RU,R>>
      Returns:
      R; a new R with negated value(s)
    • rint

      public A rint()
      Return a new Scalar/Vector/Matrix with the nearest integer value(s). When the value is exactly in the middle between two integer values, the even one is returned.
      Specified by:
      rint in interface Value<AU extends AbsoluteLinearUnit<AU,RU>,A extends DoubleScalarAbs<AU,A,RU,R>>
      Returns:
      R; a new R with absolute value(s)