Package org.opentrafficsim.base
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 java.lang.ObjectSuperclass of all sorts of types, for example GTUType, ParameterType, etc. The only method in this class isisType()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 usespeedLimitType == 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 booleanisType(T type)Returns whether this type is the same type as the given 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 usespeedLimitType == SpeedLimitType.CURVATURE.- Parameters:
type- T; type instance to compare to- Returns:
- whether this type is the same type as the given type
-
-