Enum LongitudinalDirectionality

java.lang.Object
java.lang.Enum<LongitudinalDirectionality>
org.opentrafficsim.core.network.LongitudinalDirectionality
All Implemented Interfaces:
Serializable, Comparable<LongitudinalDirectionality>, java.lang.constant.Constable

public enum LongitudinalDirectionality
extends Enum<LongitudinalDirectionality>
Permitted longitudinal driving directions.

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

$LastChangedDate: 2020-01-23 11:14:19 +0100 (Thu, 23 Jan 2020) $, @version $Revision: 6010 $, by $Author: averbraeck $, initial version Oct 15, 2014

Author:
Alexander Verbraeck, Peter Knoppers, Guus Tamminga
  • Enum Constant Details

  • Method Details

    • values

      public static LongitudinalDirectionality[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static LongitudinalDirectionality valueOf​(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null
    • getDirectionalities

      public final ImmutableSet<GTUDirectionality> getDirectionalities()
      Retrieve the permitted driving directions.
      Returns:
      ImmutableSet<GTUDirectionality>; immutable set containing the permitted driving directions
    • contains

      public final boolean contains​(LongitudinalDirectionality directionality)
      This method looks if this directionality "contains" the provided other directionality. The logic table looks as follows:
       
      THIS ↓   OTHER → DIR_BOTH      DIR_PLUS    DIR_MINUS DIR_NONE     
      DIR_BOTH true true true true
      DIR_PLUS false true false true
      DIR_MINUS false false true true
      DIR_NONE false false false true
      Parameters:
      directionality - LongitudinalDirectionality; the directionality to compare with
      Returns:
      whether this directionality "contains" the provided other directionality
    • isForwardOrBoth

      public final boolean isForwardOrBoth()
      Easy access method to test if the directionality is FORWARD or BOTH.
      Returns:
      whether the directionality is FORWARD or BOTH
    • isBackwardOrBoth

      public final boolean isBackwardOrBoth()
      Easy access method to test if the directionality is BACKWARD or BOTH.
      Returns:
      whether the directionality is BACKWARD or BOTH
    • isForward

      public final boolean isForward()
      Easy access method to test if the directionality is FORWARD.
      Returns:
      whether the directionality is FORWARD
    • isBackward

      public final boolean isBackward()
      Easy access method to test if the directionality is BACKWARD.
      Returns:
      whether the directionality is BACKWARD
    • isBoth

      public final boolean isBoth()
      Easy access method to test if the directionality is BACKWARD or BOTH.
      Returns:
      whether the directionality is BACKWARD or BOTH
    • isNone

      public final boolean isNone()
      Easy access method to test if the directionality is NONE.
      Returns:
      whether the directionality is NONE
    • intersect

      public final LongitudinalDirectionality intersect​(LongitudinalDirectionality other)
      Compute the intersection of this LongitudinalDirectionality with another LongitudinalDirectionality.
      Parameters:
      other - LongitudinalDirectionality; the other LongitudinalDirectionality
      Returns:
      LongitudinalDirectionality; the intersection of this and other
    • permits

      public final boolean permits​(GTUDirectionality direction)
      Check if a direction is permitted by this LongitudinalDirectionality.
      Parameters:
      direction - GTUDirectionality; the direction of motion in which a GTU moves, or wants to move
      Returns:
      boolean; true if the direction is permitted by this LongitudinalDirectionality; false if it is not permitted
    • invert

      public LongitudinalDirectionality invert()
      Return the inverse if this LongitudinalDirectionality.
      Returns:
      LongitudinalDirectionality; the directional inverse of this LongitudinalDirectionality