Package org.opentrafficsim.road.gtu.lane
Class LaneBasedIndividualGTU.LaneBasedIndividualCarBuilder
- java.lang.Object
-
- org.opentrafficsim.road.gtu.lane.LaneBasedIndividualGTU.LaneBasedIndividualCarBuilder
-
- All Implemented Interfaces:
Serializable
- Enclosing class:
- LaneBasedIndividualGTU
public static class LaneBasedIndividualGTU.LaneBasedIndividualCarBuilder extends Object implements Serializable
Build an individual car and use easy setter methods to instantiate the car. Typical use looks like:LaneBasedIndividualCar<String> car = new LaneBasedIndividualCarBuilder<String>().setId("Car:"+nr) .setLength(new Length(4.0, METER))....build(); or LaneBasedIndividualCarBuilder<String> carBuilder = new LaneBasedIndividualCarBuilder<String>(); carBuilder.setId("Car:"+nr); carBuilder.setLength(new Length(4.0, METER)); carBuilder.setWidth(new Length(1.8, METER)); ... LaneBasedIndividualCar<String> car = carBuilder.build();
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.- Version:
- $Revision: 1401 $, $LastChangedDate: 2015-09-14 01:33:02 +0200 (Mon, 14 Sep 2015) $, by $Author: averbraeck $,
initial Feb 3, 2015
- Author:
- Alexander Verbraeck
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description LaneBasedIndividualCarBuilder()
-
Method Summary
-
-
-
Method Detail
-
setId
public final LaneBasedIndividualGTU.LaneBasedIndividualCarBuilder setId(String id)
- Parameters:
id
- String; set id- Returns:
- the class itself for chaining the setters
-
setGtuType
public final LaneBasedIndividualGTU.LaneBasedIndividualCarBuilder setGtuType(GTUType gtuType)
- Parameters:
gtuType
- GTUType; set gtuType- Returns:
- the class itself for chaining the setters
-
setInitialLongitudinalPositions
public final LaneBasedIndividualGTU.LaneBasedIndividualCarBuilder setInitialLongitudinalPositions(Set<DirectedLanePosition> initialLongitudinalPositions)
- Parameters:
initialLongitudinalPositions
- Set<DirectedLanePosition>; set initialLongitudinalPositions- Returns:
- the class itself for chaining the setters
-
setInitialSpeed
public final LaneBasedIndividualGTU.LaneBasedIndividualCarBuilder setInitialSpeed(Speed initialSpeed)
- Parameters:
initialSpeed
- Speed; set initialSpeed- Returns:
- the class itself for chaining the setters
-
setLength
public final LaneBasedIndividualGTU.LaneBasedIndividualCarBuilder setLength(Length length)
- Parameters:
length
- Length; set length- Returns:
- the class itself for chaining the setters
-
setWidth
public final LaneBasedIndividualGTU.LaneBasedIndividualCarBuilder setWidth(Length width)
- Parameters:
width
- Length; set width- Returns:
- the class itself for chaining the setters
-
setMaximumSpeed
public final LaneBasedIndividualGTU.LaneBasedIndividualCarBuilder setMaximumSpeed(Speed maximumSpeed)
- Parameters:
maximumSpeed
- Speed; set maximumSpeed- Returns:
- the class itself for chaining the setters
-
setMaximumAcceleration
public final LaneBasedIndividualGTU.LaneBasedIndividualCarBuilder setMaximumAcceleration(Acceleration maximumAcceleration)
- Parameters:
maximumAcceleration
- Acceleration; maximum acceleration- Returns:
- the class itself for chaining the setters
-
setMaximumDeceleration
public final LaneBasedIndividualGTU.LaneBasedIndividualCarBuilder setMaximumDeceleration(Acceleration maximumDeceleration)
- Parameters:
maximumDeceleration
- Acceleration; maximum deceleration (a negative value)- Returns:
- the class itself for chaining the setters
-
setSimulator
public final LaneBasedIndividualGTU.LaneBasedIndividualCarBuilder setSimulator(OTSSimulatorInterface simulator)
- Parameters:
simulator
- OTSSimulatorInterface; set simulator- Returns:
- the class itself for chaining the setters
-
setFront
public final LaneBasedIndividualGTU.LaneBasedIndividualCarBuilder setFront(Length front)
- Parameters:
front
- Length; distance of the front relative to the reference point- Returns:
- the class itself for chaining the setters
-
setNetwork
public final LaneBasedIndividualGTU.LaneBasedIndividualCarBuilder setNetwork(OTSRoadNetwork network)
- Parameters:
network
- OTSRoadNetwork; set network- Returns:
- the class itself for chaining the setters
-
getId
public final String getId()
- Returns:
- id.
-
getGtuType
public final GTUType getGtuType()
- Returns:
- gtuType.
-
getInitialLongitudinalPositions
public final Set<DirectedLanePosition> getInitialLongitudinalPositions()
- Returns:
- initialLongitudinalPositions.
-
getInitialSpeed
public final Speed getInitialSpeed()
- Returns:
- initialSpeed.
-
getLength
public final Length getLength()
- Returns:
- length.
-
getWidth
public final Length getWidth()
- Returns:
- width.
-
getMaximumSpeed
public final Speed getMaximumSpeed()
- Returns:
- maximumSpeed.
-
getSimulator
public final DEVSSimulatorInterface.TimeDoubleUnit getSimulator()
- Returns:
- simulator.
-
getNetwork
public final OTSRoadNetwork getNetwork()
- Returns:
- network
-
build
public final LaneBasedIndividualGTU build(LaneBasedStrategicalPlannerFactory<? extends LaneBasedStrategicalPlanner> laneBasedStrategicalPlannerFactory, Route route, Node origin, Node destination) throws Exception
Build one LaneBasedIndividualCar.- Parameters:
laneBasedStrategicalPlannerFactory
- LaneBasedStrategicalPlannerFactory<? extends LaneBasedStrategicalPlanner>; LaneBasedStrategicalPlannerFactory<? extends LaneBasedStrategicalPlanner>; LaneBasedStrategicalPlannerFactory<? extends LaneBasedStrategicalPlanner>; LaneBasedStrategicalPlannerFactory<? extends LaneBasedStrategicalPlanner>; LaneBasedStrategicalPlannerFactory<? extends LaneBasedStrategicalPlanner>; factory for the strategical plannerroute
- Route; routeorigin
- Node; origindestination
- Node; destination- Returns:
- the built Car with the set properties
- Throws:
Exception
- when not all required values have been set
-
-