Class Direction

All Implemented Interfaces:
Serializable, Cloneable, Comparable<Direction>, Absolute, Scalar<DirectionUnit,​Direction>, Scalar.Abs<DirectionUnit,​Direction,​AngleUnit,​Angle>, ValueFunctions<DirectionUnit,​Direction>, Value<DirectionUnit,​Direction>, DoubleScalarInterface<DirectionUnit,​Direction>, DoubleScalarInterface.Abs<DirectionUnit,​Direction,​AngleUnit,​Angle>

@Generated(value="org.djunits.generator.GenerateDJUNIT",
           date="2019-10-18T12:12:25.568Z")
public class Direction
extends AbstractDoubleScalarAbs<DirectionUnit,​Direction,​AngleUnit,​Angle>
Easy access methods for the Absolute Direction DoubleScalar.

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

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

    • ZERO

      public static final Direction ZERO
      Constant with value zero.
  • Constructor Details

    • Direction

      public Direction​(double value, DirectionUnit unit)
      Construct Direction scalar.
      Parameters:
      value - double; value
      unit - DirectionUnit; unit for the double value
    • Direction

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

    • instantiateAbs

      public final Direction instantiateAbs​(double value, DirectionUnit 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
    • instantiateRel

      public final Angle instantiateRel​(double value, AngleUnit 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 Direction instantiateSI​(double value)
      Construct Direction scalar.
      Parameters:
      value - double; value in SI units
      Returns:
      Direction; the new scalar with the SI value
    • interpolate

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

      public static Direction max​(Direction a1, Direction a2)
      Return the maximum value of two absolute scalars.
      Parameters:
      a1 - Direction; the first scalar
      a2 - Direction; the second scalar
      Returns:
      Direction; the maximum value of two absolute scalars
    • max

      public static Direction max​(Direction a1, Direction a2, Direction... an)
      Return the maximum value of more than two absolute scalars.
      Parameters:
      a1 - Direction; the first scalar
      a2 - Direction; the second scalar
      an - Direction...; the other scalars
      Returns:
      the maximum value of more than two absolute scalars
    • min

      public static Direction min​(Direction a1, Direction a2)
      Return the minimum value of two absolute scalars.
      Parameters:
      a1 - Direction; the first scalar
      a2 - Direction; the second scalar
      Returns:
      the minimum value of two absolute scalars
    • min

      public static Direction min​(Direction a1, Direction a2, Direction... an)
      Return the minimum value of more than two absolute scalars.
      Parameters:
      a1 - Direction; the first scalar
      a2 - Direction; the second scalar
      an - Direction...; the other scalars
      Returns:
      the minimum value of more than two absolute scalars
    • valueOf

      public static Direction valueOf​(String text)
      Returns a Direction 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 Direction
      Returns:
      Direction; 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 Direction of​(double value, String unitString)
      Returns a Direction 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:
      Direction; 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