Package org.opentrafficsim.core.gtu
Class AbstractLinkBasedGTU
java.lang.Object
org.djutils.event.EventProducer
org.opentrafficsim.core.gtu.AbstractGTU
org.opentrafficsim.core.gtu.AbstractLinkBasedGTU
- All Implemented Interfaces:
java.io.Serializable,Locatable,EventProducerInterface,Identifiable,Drawable,GTU
public abstract class AbstractLinkBasedGTU extends AbstractGTU
Copyright (c) 2013-2020 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
- See Also:
- Serialized Form
-
Field Summary
Fields inherited from class org.opentrafficsim.core.gtu.AbstractGTU
ALIGN_COUNT, ALIGNED, operationalPlanFields inherited from interface org.djutils.event.EventProducerInterface
FIRST_POSITION, LAST_POSITIONFields inherited from interface org.opentrafficsim.core.gtu.GTU
DESTROY_EVENT, INIT_EVENT, MOVE_EVENT -
Constructor Summary
Constructors Constructor Description AbstractLinkBasedGTU(java.lang.String id, GTUType gtuType, OTSSimulatorInterface simulator, OTSNetwork network) -
Method Summary
Modifier and Type Method Description abstract LinkgetLink()Return the link on which the REFERENCE position of the GTU currently is on.OTSNetworkgetNetwork()voidsetNetwork(OTSNetwork network)Methods inherited from class org.opentrafficsim.core.gtu.AbstractGTU
addGtu, destroy, equals, getAcceleration, getAcceleration, getChildren, getErrorHandler, getGTUType, getId, getLocation, getMaximumAcceleration, getMaximumDeceleration, getNextMoveEvent, getOdometer, getOdometer, getOperationalPlan, getOperationalPlan, getParameters, getParent, getPerceivableContext, getReference, getSimulator, getSourceId, getSpeed, getSpeed, getStrategicalPlanner, getStrategicalPlanner, hashCode, init, interruptMove, isDestroyed, move, removeGtu, setErrorHandler, setMaximumAcceleration, setMaximumDeceleration, setParameters, setParentMethods inherited from class org.djutils.event.EventProducer
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, getEventTypesWithListeners, hasListeners, numberOfListeners, removeAllListeners, removeAllListeners, removeListenerMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.djutils.event.EventProducerInterface
addListener, addListener, addListener, addListener, getEventTypesWithListeners, hasListeners, numberOfListeners, removeListenerMethods inherited from interface org.opentrafficsim.core.gtu.GTU
getCenter, getContourPoints, getFront, getLength, getMaximumSpeed, getRear, getRelativePositions, getTacticalPlanner, getTacticalPlanner, getWidth
-
Constructor Details
-
AbstractLinkBasedGTU
public AbstractLinkBasedGTU(java.lang.String id, GTUType gtuType, OTSSimulatorInterface simulator, OTSNetwork network) throws GTUException- Parameters:
id- String; the id of the GTUgtuType- GTUType; the type of GTU, e.g. TruckType, CarType, BusTypesimulator- OTSSimulatorInterface; the simulator to schedule plan changes onnetwork- OTSNetwork; the network in which this GTU is (initially) registered- Throws:
GTUException- when the construction of the original waiting path fails
-
-
Method Details
-
getNetwork
- Returns:
- the network in which the GTU is registered
-
setNetwork
- Parameters:
network- OTSNetwork; change the network this GTU is registered in
-
getLink
Return the link on which the REFERENCE position of the GTU currently is on. Returns null if the GTU is not on a link with its reference position.- Returns:
- Link; the link on which the REFERENCE position of the GTU currently is on
-