Class Type<T extends Type<T>>

  • Type Parameters:
    T - Class of type.
    Direct Known Subclasses:
    HierarchicalType, ParameterType

    public abstract class Type<T extends Type<T>>
    extends java.lang.Object
    Superclass of all sorts of types, for example GTUType, ParameterType, etc. The only method in this class is isType() which should be used to check whether any type object of unknown type, is a specific type. For example: speedLimitType.isType(SpeedLimitType.CURVATURE).

    Note that it is not safe to use speedLimitType == SpeedLimitType.CURVATURE.

    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.

    Version:
    $Revision$, $LastChangedDate$, by $Author$, initial version May 6, 2016
    Author:
    Alexander Verbraeck, Wouter Schakel
    • Constructor Summary

      Constructors 
      Constructor Description
      Type()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean isType​(T type)
      Returns whether this type is the same type as the given type.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Type

        public Type()
    • Method Detail

      • isType

        public final boolean isType​(T type)
        Returns whether this type is the same type as the given type. Use this method to check for any kind of type (e.g. GTUType , ParameterType, etc.) whether an instance is a specific instance of the type. For example: speedLimitType.isType(SpeedLimitType.CURVATURE).

        Note that it is not safe to use speedLimitType == SpeedLimitType.CURVATURE.
        Parameters:
        type - T; type instance to compare to
        Returns:
        whether this type is the same type as the given type