Class Type<T extends Type<T>>

java.lang.Object
org.opentrafficsim.base.Type<T>
Type Parameters:
T - Class of type.
Direct Known Subclasses:
HierarchicalType, ParameterType

public abstract class Type<T extends Type<T>>
extends 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-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 May 6, 2016
Author:
Alexander Verbraeck, Wouter Schakel
  • Constructor Details

    • Type

      public Type()
  • Method Details

    • 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