View Javadoc
1   package org.opentrafficsim.road.gtu.lane.perception;
2   
3   import java.io.Serializable;
4   
5   import org.djunits.value.vdouble.scalar.Time;
6   
7   /**
8    * An object with a time stamp, where the object is of a specific class.
9    * <p>
10   * Copyright (c) 2013-2015 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/docs/license.html">OpenTrafficSim License</a>.
12   * </p>
13   * $LastChangedDate: 2015-07-24 02:58:59 +0200 (Fri, 24 Jul 2015) $, @version $Revision: 1147 $, by $Author: averbraeck $,
14   * initial version Jan 29, 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   * @param <C> the timestamped object class. 
18   */
19  public class TimeStampedObject<C> implements Serializable
20  {
21      /** */
22      private static final long serialVersionUID = 20160129L;
23  
24      /** The object. */
25      final C object;
26      
27      /** The time stamp. */
28      final Time.Abs timestamp;
29      
30      /**
31       * @param object the object.
32       * @param timestamp the time stamp.
33       */
34      public TimeStampedObject(final C object, final Time.Abs timestamp)
35      {
36          this.object = object;
37          this.timestamp = timestamp;
38      }
39  
40      /**
41       * @return object
42       */
43      public final C getObject()
44      {
45          return this.object;
46      }
47  
48      /**
49       * @return time stamp
50       */
51      public final Time.Abs getTimestamp()
52      {
53          return this.timestamp;
54      }
55  
56  }