Class FloatScalarRelWithAbs<AU extends AbsoluteLinearUnit<AU,RU>,A extends FloatScalarAbs<AU,A,RU,R>,RU extends Unit<RU>,R extends FloatScalarRelWithAbs<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<R>, Relative<RU,R>, RelWithAbs<AU,A,RU,R>, Value<RU,R>
Direct Known Subclasses:
FloatAngle, FloatDuration, FloatLength, FloatTemperature

public abstract class FloatScalarRelWithAbs<AU extends AbsoluteLinearUnit<AU,RU>,A extends FloatScalarAbs<AU,A,RU,R>,RU extends Unit<RU>,R extends FloatScalarRelWithAbs<AU,A,RU,R>> extends FloatScalarRel<RU,R> implements RelWithAbs<AU,A,RU,R>
The typed, abstract FloatScalarRelWithAbs class that forms the basis of the relative FloatScalars suck as Duration that have an absolute equivalent such as Time.

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

    • FloatScalarRelWithAbs

      public FloatScalarRelWithAbs(float value, RU unit)
      Construct a new Relative Immutable FloatScalar.
      Parameters:
      value - float; the value of the new Relative Immutable FloatScalar
      unit - RU; the unit of the new Relative Immutable FloatScalar
    • FloatScalarRelWithAbs

      public FloatScalarRelWithAbs(R value)
      Construct a new Relative Immutable FloatScalar from an existing Relative Immutable FloatScalar.
      Parameters:
      value - R, a relative typed FloatScalar; the reference
  • Method Details

    • instantiateAbs

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

      public A plus(A increment)
      Add an Absolute value to this relative value. A new value is returned due to immutability. The unit of the result is the unit of the absolute operand.
      Specified by:
      plus in interface RelWithAbs<AU extends AbsoluteLinearUnit<AU,RU>,A extends FloatScalarAbs<AU,A,RU,R>,RU extends Unit<RU>,R extends FloatScalarRelWithAbs<AU,A,RU,R>>
      Parameters:
      increment - A; A the right operand
      Returns:
      A; the sum of this value and the operand