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>

public abstract class AbstractPerception<G extends Gtu> extends Object implements 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 Details

    • AbstractPerception

      public AbstractPerception(G gtu)
      Construct perception.
      Parameters:
      gtu - GTU
  • Method Details

    • getGtu

      public G getGtu()
      Description copied from interface: Perception
      Return the GTU of this perception.
      Specified by:
      getGtu in interface Perception<G extends Gtu>
      Returns:
      GTU of this perception
    • addPerceptionCategory

      public final <T extends PerceptionCategory<?, ?>> void addPerceptionCategory(T perceptionCategory)
      Description copied from interface: Perception
      Adds given perception category to the perception.
      Specified by:
      addPerceptionCategory in interface Perception<G extends Gtu>
      Type Parameters:
      T - perception category type
      Parameters:
      perceptionCategory - perception category
    • contains

      public final <T extends PerceptionCategory<?, ?>> boolean contains(Class<T> category)
      Description copied from interface: Perception
      Returns whether the given perception category is present.
      Specified by:
      contains in interface Perception<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: Perception
      Returns the given perception category.
      Specified by:
      getPerceptionCategory in interface Perception<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: Perception
      Returns the given perception category.
      Specified by:
      getPerceptionCategoryOptional in interface Perception<G extends Gtu>
      Type Parameters:
      T - perception category
      Parameters:
      category - perception category class
      Returns:
      given perception category, empty if not present
    • removePerceptionCategory

      public final void removePerceptionCategory(PerceptionCategory<?,?> perceptionCategory)
      Description copied from interface: Perception
      Remove give perception category.
      Specified by:
      removePerceptionCategory in interface Perception<G extends Gtu>
      Parameters:
      perceptionCategory - perception category to remove
    • toString

      public String toString()
      Overrides:
      toString in class Object