Class DataType<T,G extends GtuData>

java.lang.Object
org.opentrafficsim.kpi.sampling.DataType<T,G>
Type Parameters:
T - type of value
G - GTU data type
All Implemented Interfaces:
Identifiable
Direct Known Subclasses:
ExtendedDataType, FilterDataType

public abstract class DataType<T,G extends GtuData> extends Object implements Identifiable
Abstract class for defining a type of extended or filter data.

Copyright (c) 2013-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
  • Constructor Details

    • DataType

      public DataType(String id, String description, Class<T> type)
      Constructor setting the id.
      Parameters:
      id - id
      description - description
      type - type class
  • Method Details

    • getId

      public final String getId()
      Specified by:
      getId in interface Identifiable
    • getDescription

      public String getDescription()
      Returns the description.
      Returns:
      description
    • getType

      public Class<T> getType()
      Returns the value type.
      Returns:
      the value type
    • getValue

      public abstract Optional<T> getValue(G gtu)
      Retrieves the value of the data of this type from a GTU.
      Parameters:
      gtu - gtu to retrieve the value from
      Returns:
      value of the data of this type from a GTU, may be empty if not applicable.
    • hashCode

      public final int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public final boolean equals(Object obj)
      Overrides:
      equals in class Object