Class AbstractPerceptionCategory<G extends GTU,P extends Perception<G>>
java.lang.Object
org.opentrafficsim.base.Type<AbstractPerceptionCategory<G,P>>
org.opentrafficsim.core.gtu.perception.AbstractPerceptionCategory<G,P>
- Type Parameters:
G- GTU typeP- perception type
- All Implemented Interfaces:
Serializable,PerceptionCategory<G,P>
- Direct Known Subclasses:
DirectEgoPerception
public abstract class AbstractPerceptionCategory<G extends GTU,P extends Perception<G>> extends Type<AbstractPerceptionCategory<G,P>> implements Serializable, PerceptionCategory<G,P>
Copyright (c) 2013-2019 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 Jul 14, 2016
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description AbstractPerceptionCategory(P perception)Constructor setting the perception. -
Method Summary
Modifier and Type Method Description GgetGtu()Returns the connected GTU.protected <T> TgetObjectOrNull(TimeStampedObject<T> object)Returns the object inside a time stamped object, ornullif it's null.PgetPerception()Returns the connected perception.TimegetTimestamp()Returns the current time.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.opentrafficsim.core.gtu.perception.PerceptionCategory
updateAll
-
Constructor Details
-
AbstractPerceptionCategory
Constructor setting the perception.- Parameters:
perception- P; perception
-
-
Method Details
-
getPerception
Returns the connected perception.- Returns:
- connected perception
-
getGtu
Returns the connected GTU.- Returns:
- connected GTU
- Throws:
GTUException- if the GTU has not been initialized
-
getTimestamp
Returns the current time.- Returns:
- current time
- Throws:
GTUException- if the GTU has not been initialized
-
getObjectOrNull
Returns the object inside a time stamped object, ornullif it's null.- Type Parameters:
T- type of time stamped object- Parameters:
object- TimeStampedObject<T>; time stamped object- Returns:
- the object inside a time stamped object, or
nullif it's null
-