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-2022 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description G
getGtu()
Returns the connected GTU.protected <T> T
getObjectOrNull(TimeStampedObject<T> object)
Returns the object inside a time stamped object, ornull
if it's null.P
getPerception()
Returns the connected perception.Time
getTimestamp()
Returns the current time.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.opentrafficsim.core.gtu.perception.PerceptionCategory
updateAll
-
-
-
-
Constructor Detail
-
AbstractPerceptionCategory
public AbstractPerceptionCategory(P perception)
Constructor setting the perception.- Parameters:
perception
- P; perception
-
-
Method Detail
-
getPerception
public P getPerception()
Returns the connected perception.- Returns:
- connected perception
-
getGtu
public G getGtu() throws GTUException
Returns the connected GTU.- Returns:
- connected GTU
- Throws:
GTUException
- if the GTU has not been initialized
-
getTimestamp
public final Time getTimestamp() throws GTUException
Returns the current time.- Returns:
- current time
- Throws:
GTUException
- if the GTU has not been initialized
-
getObjectOrNull
protected final <T> T getObjectOrNull(TimeStampedObject<T> object)
Returns the object inside a time stamped object, ornull
if 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
null
if it's null
-
-