Interface PerceivableContext
-
- All Superinterfaces:
Definitions,Identifiable
- All Known Implementing Classes:
ExpansionNetwork,OTSNetwork
public interface PerceivableContext extends Definitions, Identifiable
The PerceivableContext package guarantees that objects that are used in an OTS study such as GTUs are retrievable. In a spatial model, for instance, objects need to be able to find each other. The model interface guarantees access to a number of important objects in the study.Copyright (c) 2013-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
$LastChangedDate: 2015-07-24 02:58:59 +0200 (Fri, 24 Jul 2015) $, @version $Revision: 1147 $, by $Author: averbraeck $, initial version Dec 10, 2015
BSD-style license. See OpenTrafficSim License.- Author:
- Alexander Verbraeck, Peter Knoppers
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddGtu(Gtu gtu)Add a GTU to this PerceivableContext.booleancontainsGtu(Gtu gtu)Test whether a GTU is registered in this PerceivableContext.booleancontainsGtuId(String gtuId)Test whether a GTU with a specific id is registered in this PerceivableContext.GtugetGtu(String gtuId)Retrieve a GTU with a specific id from this PerceivableContext.Set<Gtu>getGtus()Get an overview of the GTUs in the model.StringgetId()Get a descriptive Id of this PerceivableContext (useful for debugging purposes).voidremoveGtu(Gtu gtu)Remove a GTU from this PerceivableContext.-
Methods inherited from interface org.opentrafficsim.core.definitions.Definitions
addDefaultGtuTypes, addDefaultLinkTypes, addGtuType, addLinkType, getGtuType, getGtuType, getGtuTypes, getLinkType, getLinkType, getLinkTypes
-
-
-
-
Method Detail
-
getId
String getId()
Get a descriptive Id of this PerceivableContext (useful for debugging purposes).- Specified by:
getIdin interfaceIdentifiable- Returns:
- String; the id of this PerceivableContext
-
getGtus
Set<Gtu> getGtus()
Get an overview of the GTUs in the model. The set returned is a defensive copy that may be modified by the caller.- Returns:
- Set<GTU>; a set of GTUs as registered in the current model.
-
getGtu
Gtu getGtu(String gtuId)
Retrieve a GTU with a specific id from this PerceivableContext.- Parameters:
gtuId- String; the id of the GTU- Returns:
- GTU; a GTU as registered in the current model, or null when no GTU with the specified id could be found.
-
addGtu
void addGtu(Gtu gtu)
Add a GTU to this PerceivableContext.- Parameters:
gtu- Gtu; the GTU to add
-
removeGtu
void removeGtu(Gtu gtu)
Remove a GTU from this PerceivableContext. TODO should probably throw an exception if the GTU is not in this PerceivableContext.- Parameters:
gtu- Gtu; the GTU to remove
-
containsGtu
boolean containsGtu(Gtu gtu)
Test whether a GTU is registered in this PerceivableContext.- Parameters:
gtu- Gtu; the GTU to search for- Returns:
- boolean; true if the network contains the GTU; false if this PerceivableContext does not contain the GTU
-
containsGtuId
boolean containsGtuId(String gtuId)
Test whether a GTU with a specific id is registered in this PerceivableContext.- Parameters:
gtuId- String; the GTU id to search for- Returns:
- boolean; true if the network contains a GTU with this id; false if this PerceivableContext does not contain a GTU with the specified id
-
-