View Javadoc
1   package org.opentrafficsim.kpi.sampling.meta;
2   
3   import org.opentrafficsim.kpi.interfaces.GtuDataInterface;
4   import org.opentrafficsim.kpi.interfaces.RouteDataInterface;
5   
6   import nl.tudelft.simulation.language.Throw;
7   
8   /**
9    * Accepts trajectories with a Route included in a set in a query.
10   * <p>
11   * Copyright (c) 2013-2016 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
12   * BSD-style license. See <a href="http://opentrafficsim.org/node/13">OpenTrafficSim License</a>.
13   * <p>
14   * @version $Revision$, $LastChangedDate$, by $Author$, initial version Sep 22, 2016 <br>
15   * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
16   * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
17   * @author <a href="http://www.transport.citg.tudelft.nl">Wouter Schakel</a>
18   */
19  public class MetaDataRoute extends MetaDataType<RouteDataInterface>
20  {
21  
22      /**
23       * 
24       */
25      public MetaDataRoute()
26      {
27          super("route");
28      }
29  
30      /** {@inheritDoc} */
31      @Override
32      public final RouteDataInterface getValue(final GtuDataInterface gtu)
33      {
34          Throw.whenNull(gtu, "GTU may not be null.");
35          return gtu.getRouteData();
36      }
37      
38      /** {@inheritDoc} */
39      @Override
40      public String formatValue(String format, RouteDataInterface value)
41      {
42          return value.getId();
43      }
44      
45      /** {@inheritDoc} */
46      @Override
47      @SuppressWarnings("checkstyle:designforextension")
48      public String toString()
49      {
50          return "MetaDataRoute: [id=" + getId() + "]";
51      }
52  
53  }