Interface Compatibility<G extends HierarchicalType<G>,​I extends HierarchicalType<I>>

Type Parameters:
G - GTU type
I - infrastructure type
All Known Implementing Classes:
GTUCompatibility, LinkType

public interface Compatibility<G extends HierarchicalType<G>,​I extends HierarchicalType<I>>
Compatibility of infrastructure and traveling units.

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.

Version:
$Revision$, $LastChangedDate$, by $Author$, initial version Aug 25, 2017
Author:
Alexander Verbraeck, Peter Knoppers, Wouter Schakel
  • Method Summary

    Modifier and Type Method Description
    LongitudinalDirectionality getDirectionality​(G gtuType, boolean tryParentsOfGTUType)
    Retrieve the allowed driving directions for a GTUType.
    java.lang.Boolean isCompatible​(G gtuType, GTUDirectionality directionality)
    Test if a GTUType can travel over the infrastructure.
  • Method Details

    • isCompatible

      java.lang.Boolean isCompatible​(G gtuType, GTUDirectionality directionality)
      Test if a GTUType can travel over the infrastructure.
      Parameters:
      gtuType - G; the type of the GTU
      directionality - GTUDirectionality; the direction of the GTU with respect to the design direction of the infrastructure
      Returns:
      boolean; true if the GTU can travel over the infrastructure in the given direction; false if the GTU can not travel over the infrastructure in the given direction; null if the decision should be made by calling isCompatible on a higher level in the infrastructure hierarchy
    • getDirectionality

      LongitudinalDirectionality getDirectionality​(G gtuType, boolean tryParentsOfGTUType)
      Retrieve the allowed driving directions for a GTUType. If there is no match for the specified GTUType in this infrastructure type, this method will recursively check the parent types of the infrastructure element until either a match is found or the root parental type of the infrastructure is reached. When the latter happens without finding a match, what happens next depends on the value of tryParentsOfGTUType.
      If tryParentsOfGTUType is false, the value null is returned. If true; the parent of the GTUType is used and the search is repeated, etc. If none of the parents of the GTUType yields a result, this method returns LongitudinalDirectionality.DIR_NONE.
      Parameters:
      gtuType - G; type of the GTU
      tryParentsOfGTUType - boolean; if true; the parents of the GTUType are tried if no match was found for the given GTUType
      Returns:
      LongitudinalDirectionality; the driving directions for the GTUType, or LongitudinalDirectionality.DIR_NONE if neither the GTUType or any of its parents specifies a directionality