Class MetaDataType<T>

java.lang.Object
org.opentrafficsim.kpi.sampling.meta.MetaDataType<T>
Type Parameters:
T - class of meta data
All Implemented Interfaces:
Identifiable
Direct Known Subclasses:
MetaDataCrossSections, MetaDataDestination, MetaDataGtuType, MetaDataOrigin, MetaDataRoute

public abstract class MetaDataType<T>
extends Object
implements Identifiable
Abstract class for defining a type of meta data.

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 Sep 22, 2016
Author:
Alexander Verbraeck, Peter Knoppers, Wouter Schakel
  • Constructor Details

  • Method Details

    • getId

      public final String getId()
      Specified by:
      getId in interface Identifiable
      Returns:
      id.
    • getValue

      public abstract T getValue​(GtuDataInterface gtu)
      Retrieves the value of the meta data of this type from a GTU.
      Parameters:
      gtu - GtuDataInterface; gtu to retrieve the value from
      Returns:
      value of the meta data of this type from a GTU, may be null if not applicable.
    • formatValue

      public abstract String formatValue​(String format, T value)
      Formats the value into a string. If the value is numeric, the default implementation is:
       String.format(format, value.si);
       
      Parameters:
      format - String; format
      value - T; value
      Returns:
      formatted value
    • accept

      public void accept​(TrajectoryAcceptList trajectoryAcceptList, Set<T> querySet)
      Determines for a set of trajectory's from a single GTU, which may be accepted according to this meta data type. As a single GTU may have several trajectories for a single TrajectoryGroup object, the specified TrajectoryGroup's may have duplicates. As the trajectory's are from a single GTU, the meta data is equal for all. Implementations of this method may for instance:
      1. Determine only from the first Trajectorys' meta data that all may be accepted.
      2. Determine for the separate Trajectory's whether they are acceptable.
      3. The same as 2, but refuse all if any is refused.
      4. The same as 2, but accept all if any is accepted.
      5. etc.
      The default implementation is that of 1, checking that the meta data value is in the provided query set.
      Parameters:
      trajectoryAcceptList - TrajectoryAcceptList; containing Trajectory's and TrajectoryGroup's pertaining to a single GTU
      querySet - Set<T>; set of values in the query for this metadata type
    • toString

      public String toString()
      Overrides:
      toString in class Object