Interface HierarchicallyTyped<T extends HierarchicalType<T,I>,I extends HierarchicallyTyped<T,I>>

Type Parameters:
T - The HierarchicalType of the typing object
I - The type of the typed object

public interface HierarchicallyTyped<T extends HierarchicalType<T,I>,I extends HierarchicallyTyped<T,I>>
HierarchicallyTyped is the interface of objects that are of a HierarchicalType. Examples are Gtu (of type GtuType), Link (of type LinkType), and Detector (of type DetectorType). By making these objects HierarchicallyTyped, they can return their correct 'type' as well as check whether they belong to a certain hierarchical type.

Copyright (c) 2022-2026 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, Wouter Schakel
  • Method Summary

    Modifier and Type
    Method
    Description
    Return the assigned type of the typed object.
    default boolean
    isOfType(T type)
    Return whether the object if has type 'type', or one of the subtypes of 'type'.
  • Method Details

    • getType

      T getType()
      Return the assigned type of the typed object.
      Returns:
      the assigned type of the typed object
    • isOfType

      default boolean isOfType(T type)
      Return whether the object if has type 'type', or one of the subtypes of 'type'. An example is gtu.isOfType(Types.BUS) or link.isOfType(Types.HIGHWAY).
      Parameters:
      type - the type to check against
      Returns:
      whether the object if has type 'type', or one of the subtypes of 'type'