Package org.opentrafficsim.core.gtu
Class AbstractLinkBasedGTU
java.lang.Object
nl.tudelft.simulation.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-2019 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, operationalPlan
Fields inherited from interface nl.tudelft.simulation.event.EventProducerInterface
FIRST_POSITION, LAST_POSITION
Fields 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 Link
getLink()
Return the link on which the REFERENCE position of the GTU currently is on.OTSNetwork
getNetwork()
void
setNetwork(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, getSpeed, getSpeed, getStrategicalPlanner, getStrategicalPlanner, hashCode, init, interruptMove, isDestroyed, move, removeGtu, setErrorHandler, setMaximumAcceleration, setMaximumDeceleration, setParameters, setParent
Methods inherited from class nl.tudelft.simulation.event.EventProducer
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, removeAllListeners, removeAllListeners, removeListener
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface nl.tudelft.simulation.event.EventProducerInterface
addListener, addListener, addListener, addListener, removeListener
Methods 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
-