Package org.opentrafficsim.core.network
Enum LongitudinalDirectionality
- java.lang.Object
-
- java.lang.Enum<LongitudinalDirectionality>
-
- org.opentrafficsim.core.network.LongitudinalDirectionality
-
- All Implemented Interfaces:
Serializable
,Comparable<LongitudinalDirectionality>
public enum LongitudinalDirectionality extends Enum<LongitudinalDirectionality>
Permitted longitudinal driving directions.Copyright (c) 2013-2022 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.$LastChangedDate$, @version $Revision$, by $Author$, initial version Oct 15, 2014
- Author:
- Alexander Verbraeck, Peter Knoppers, Guus Tamminga
-
-
Enum Constant Summary
Enum Constants Enum Constant Description DIR_BOTH
Bidirectional.DIR_MINUS
Direction opposite to the direction of the graph, decreasing fractional position when driving in this direction.DIR_NONE
No traffic possible.DIR_PLUS
Direction the same as the direction of the graph, increasing fractional position when driving in this direction.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(LongitudinalDirectionality directionality)
This method looks if this directionality "contains" the provided other directionality.ImmutableSet<GTUDirectionality>
getDirectionalities()
Retrieve the permitted driving directions.LongitudinalDirectionality
intersect(LongitudinalDirectionality other)
Compute the intersection of this LongitudinalDirectionality with another LongitudinalDirectionality.LongitudinalDirectionality
invert()
Return the inverse if this LongitudinalDirectionality.boolean
isBackward()
Easy access method to test if the directionality is BACKWARD.boolean
isBackwardOrBoth()
Easy access method to test if the directionality is BACKWARD or BOTH.boolean
isBoth()
Easy access method to test if the directionality is BACKWARD or BOTH.boolean
isForward()
Easy access method to test if the directionality is FORWARD.boolean
isForwardOrBoth()
Easy access method to test if the directionality is FORWARD or BOTH.boolean
isNone()
Easy access method to test if the directionality is NONE.boolean
permits(GTUDirectionality direction)
Check if a direction is permitted by this LongitudinalDirectionality.static LongitudinalDirectionality
valueOf(String name)
Returns the enum constant of this type with the specified name.static LongitudinalDirectionality[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
DIR_PLUS
public static final LongitudinalDirectionality DIR_PLUS
Direction the same as the direction of the graph, increasing fractional position when driving in this direction.
-
DIR_MINUS
public static final LongitudinalDirectionality DIR_MINUS
Direction opposite to the direction of the graph, decreasing fractional position when driving in this direction.
-
DIR_BOTH
public static final LongitudinalDirectionality DIR_BOTH
Bidirectional.
-
DIR_NONE
public static final LongitudinalDirectionality DIR_NONE
No traffic possible.
-
-
Method Detail
-
values
public static LongitudinalDirectionality[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (LongitudinalDirectionality c : LongitudinalDirectionality.values()) System.out.println(c);
- 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 nameNullPointerException
- 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
andother
-
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
-
-