Class FilterDataType<T>
- java.lang.Object
-
- org.opentrafficsim.kpi.sampling.meta.FilterDataType<T>
-
- Type Parameters:
T- class of meta data
- All Implemented Interfaces:
Identifiable
- Direct Known Subclasses:
FilterDataCrossSections,FilterDataDestination,FilterDataGtuType,FilterDataOrigin,FilterDataRoute
public abstract class FilterDataType<T> extends Object implements Identifiable
Abstract class for defining a type of filter data.Copyright (c) 2013-2022 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 Summary
Constructors Constructor Description FilterDataType(String id)Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaccept(TrajectoryAcceptList trajectoryAcceptList, Set<T> querySet)Determines for a set oftrajectory's from a single GTU, which may be accepted according to this meta data type.abstract StringformatValue(String format, T value)Formats the value into a string.StringgetId()Returns the id.abstract TgetValue(GtuDataInterface gtu)Retrieves the value of the meta data of this type from a GTU.StringtoString()
-
-
-
Constructor Detail
-
FilterDataType
public FilterDataType(String id)
Constructor.- Parameters:
id- String; id
-
-
Method Detail
-
getId
public final String getId()
Returns the id.- Specified by:
getIdin interfaceIdentifiable- 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
nullif 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; formatvalue- T; value- Returns:
- formatted value
-
accept
public void accept(TrajectoryAcceptList trajectoryAcceptList, Set<T> querySet)
Determines for a set oftrajectory'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 singleTrajectoryGroupobject, the specifiedTrajectoryGroup's may have duplicates. As thetrajectory's are from a single GTU, the meta data is equal for all. Implementations of this method may for instance:- Determine only from the first
Trajectorys' meta data that all may be accepted. - Determine for the separate
Trajectory's whether they are acceptable. - The same as 2, but refuse all if any is refused.
- The same as 2, but accept all if any is accepted.
- etc.
- Parameters:
trajectoryAcceptList- TrajectoryAcceptList; containingTrajectory's andTrajectoryGroup's pertaining to a single GTUquerySet- Set<T>; set of values in the query for this metadata type
- Determine only from the first
-
-