Class AbstractPerception<G extends Gtu>
java.lang.Object
org.opentrafficsim.core.gtu.perception.AbstractPerception<G>
- Type Parameters:
G- GTU type
- All Implemented Interfaces:
Perception<G>
Implements
Perception by housing categories.
Copyright (c) 2013-2026 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal <T extends PerceptionCategory<?,?>>
voidaddPerceptionCategory(T perceptionCategory) Adds given perception category to the perception.final <T extends PerceptionCategory<?,?>>
booleanReturns whether the given perception category is present.getGtu()Return the GTU of this perception.final <T extends PerceptionCategory<?,?>>
TgetPerceptionCategory(Class<T> category) Returns the given perception category.final <T extends PerceptionCategory<?,?>>
Optional<T>getPerceptionCategoryOptional(Class<T> category) Returns the given perception category.final voidremovePerceptionCategory(PerceptionCategory<?, ?> perceptionCategory) Remove give perception category.toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.opentrafficsim.core.gtu.perception.Perception
perceive
-
Constructor Details
-
AbstractPerception
Construct perception.- Parameters:
gtu- GTU
-
-
Method Details
-
getGtu
Description copied from interface:PerceptionReturn the GTU of this perception.- Specified by:
getGtuin interfacePerception<G extends Gtu>- Returns:
- GTU of this perception
-
addPerceptionCategory
Description copied from interface:PerceptionAdds given perception category to the perception.- Specified by:
addPerceptionCategoryin interfacePerception<G extends Gtu>- Type Parameters:
T- perception category type- Parameters:
perceptionCategory- perception category
-
contains
Description copied from interface:PerceptionReturns whether the given perception category is present.- Specified by:
containsin interfacePerception<G extends Gtu>- Type Parameters:
T- perception category- Parameters:
category- perception category class- Returns:
- whether the given perception category is present
-
getPerceptionCategory
public final <T extends PerceptionCategory<?,?>> T getPerceptionCategory(Class<T> category) throws OperationalPlanException Description copied from interface:PerceptionReturns the given perception category.- Specified by:
getPerceptionCategoryin interfacePerception<G extends Gtu>- Type Parameters:
T- perception category- Parameters:
category- perception category class- Returns:
- given perception category
- Throws:
OperationalPlanException- if the perception category is not present
-
getPerceptionCategoryOptional
public final <T extends PerceptionCategory<?,?>> Optional<T> getPerceptionCategoryOptional(Class<T> category) Description copied from interface:PerceptionReturns the given perception category.- Specified by:
getPerceptionCategoryOptionalin interfacePerception<G extends Gtu>- Type Parameters:
T- perception category- Parameters:
category- perception category class- Returns:
- given perception category, empty if not present
-
removePerceptionCategory
Description copied from interface:PerceptionRemove give perception category.- Specified by:
removePerceptionCategoryin interfacePerception<G extends Gtu>- Parameters:
perceptionCategory- perception category to remove
-
toString
-