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