G
- GTU typepublic abstract class AbstractPerception<G extends GTU> extends Object implements Perception<G>
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.
Constructor and Description |
---|
AbstractPerception(G gtu)
Construct perception.
|
Modifier and Type | Method and Description |
---|---|
<T extends PerceptionCategory<?,?>> |
addPerceptionCategory(T perceptionCategory)
Adds given perception category to the perception.
|
<T extends PerceptionCategory<?,?>> |
contains(Class<T> category)
Returns whether the given perception category is present.
|
G |
getGtu()
Return the GTU of this perception.
|
<T extends PerceptionCategory<?,?>> |
getPerceptionCategory(Class<T> category)
Returns the given perception category.
|
<T extends PerceptionCategory<?,?>> |
getPerceptionCategoryOrNull(Class<T> category)
Returns the given perception category, or
null if not present. |
void |
perceive()
Invoked by the GTU prior to determining the operational plan.
|
void |
removePerceptionCategory(PerceptionCategory<?,?> perceptionCategory)
Remove give perception category.
|
String |
toString() |
public AbstractPerception(G gtu)
gtu
- G; GTUpublic G getGtu()
getGtu
in interface Perception<G extends GTU>
public final <T extends PerceptionCategory<?,?>> void addPerceptionCategory(T perceptionCategory)
addPerceptionCategory
in interface Perception<G extends GTU>
T
- perception category typeperceptionCategory
- T; perception categorypublic final <T extends PerceptionCategory<?,?>> boolean contains(Class<T> category)
contains
in interface Perception<G extends GTU>
T
- perception categorycategory
- Class<T>; perception category classpublic final <T extends PerceptionCategory<?,?>> T getPerceptionCategory(Class<T> category) throws OperationalPlanException
getPerceptionCategory
in interface Perception<G extends GTU>
T
- perception categorycategory
- Class<T>; perception category classOperationalPlanException
- if the perception category is not presentpublic final <T extends PerceptionCategory<?,?>> T getPerceptionCategoryOrNull(Class<T> category)
null
if not present.getPerceptionCategoryOrNull
in interface Perception<G extends GTU>
T
- perception categorycategory
- Class<T>; perception category classpublic final void removePerceptionCategory(PerceptionCategory<?,?> perceptionCategory)
removePerceptionCategory
in interface Perception<G extends GTU>
perceptionCategory
- PerceptionCategory<?,?>; perception category to removepublic void perceive() throws GTUException, NetworkException, ParameterException
perceive
in interface Perception<G extends GTU>
GTUException
- when GTU has not been properly initialized.NetworkException
- in case of inconsistencies in the network during perception calculations.ParameterException
- in case of a parameter error.Copyright © 2014–2019 Delft University of Technology. All rights reserved.