1 package org.opentrafficsim.core.perception; 2 3 import org.djunits.value.vdouble.scalar.Time; 4 5 /** 6 * Simple implementation without history that can be used inside a generic context where also implementations with history can 7 * be used. 8 * <p> 9 * Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br> 10 * BSD-style license. See <a href="http://opentrafficsim.org/node/13">OpenTrafficSim License</a>. 11 * <p> 12 * @version $Revision$, $LastChangedDate$, by $Author$, initial version 1 feb. 2018 <br> 13 * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a> 14 * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a> 15 * @author <a href="http://www.transport.citg.tudelft.nl">Wouter Schakel</a> 16 * @param <T> value type 17 */ 18 public class NullHistorical<T> implements Historical<T> 19 { 20 21 /** Value. */ 22 private T val; 23 24 /** 25 * Constructor. 26 * @param value T; value 27 */ 28 public NullHistorical(final T value) 29 { 30 this.val = value; 31 } 32 33 /** {@inheritDoc} */ 34 @Override 35 public void set(final T value) 36 { 37 this.val = value; 38 } 39 40 /** {@inheritDoc} */ 41 @Override 42 public T get() 43 { 44 return this.val; 45 } 46 47 /** {@inheritDoc} */ 48 @Override 49 public T get(final Time time) 50 { 51 return this.val; 52 } 53 54 /** {@inheritDoc} */ 55 @Override 56 public String toString() 57 { 58 return "NullHistorical [val=" + this.val + "]"; 59 } 60 61 }