The following document contains the results of PMD's CPD 6.4.0.
| File | Line |
|---|---|
| org\opentrafficsim\graphs\FundamentalDiagram.java | 294 |
| org\opentrafficsim\graphs\FundamentalDiagramLane.java | 286 |
sample.addData(gtu.getSpeed());
}
/**
* Set up a JFreeChart axis.
* @param valueAxis ValueAxis; the axis to set up
* @param axis Axis; the Axis that provides the data to setup the ValueAxis
*/
private static void configureAxis(final ValueAxis valueAxis, final Axis axis)
{
valueAxis.setLabel("\u2192 " + axis.getName());
valueAxis.setRange(axis.getMinimumValue().getInUnit(), axis.getMaximumValue().getInUnit());
}
/**
* Redraw this TrajectoryGraph (after the underlying data has been changed, or to change axes).
*/
public final void reGraph()
{
NumberAxis numberAxis = new NumberAxis();
configureAxis(numberAxis, this.xAxis);
this.chartPanel.getXYPlot().setDomainAxis(numberAxis);
this.chartPanel.getPlot().axisChanged(new AxisChangeEvent(numberAxis));
numberAxis = new NumberAxis();
configureAxis(numberAxis, this.yAxis);
this.chartPanel.getXYPlot().setRangeAxis(numberAxis);
this.chartPanel.getPlot().axisChanged(new AxisChangeEvent(numberAxis));
notifyListeners(new DatasetChangeEvent(this, null)); // This guess work actually works!
}
/**
* Notify interested parties of an event affecting this TrajectoryPlot.
* @param event DatasetChangedEvent
*/
private void notifyListeners(final DatasetChangeEvent event)
{
for (DatasetChangeListener dcl : this.listenerList.getListeners(DatasetChangeListener.class))
{
dcl.datasetChanged(event);
}
}
/** {@inheritDoc} */
@Override
public final int getSeriesCount()
{
return 1;
}
/** {@inheritDoc} */
@Override
public final Comparable<Integer> getSeriesKey(final int series)
{
return series;
}
/** {@inheritDoc} */
@SuppressWarnings("rawtypes")
@Override
public final int indexOf(final Comparable seriesKey)
{
if (seriesKey instanceof Integer)
{
return (Integer) seriesKey;
}
return -1;
}
/** {@inheritDoc} */
@Override
public final void addChangeListener(final DatasetChangeListener listener)
{
this.listenerList.add(DatasetChangeListener.class, listener);
}
/** {@inheritDoc} */
@Override
public final void removeChangeListener(final DatasetChangeListener listener)
{
this.listenerList.remove(DatasetChangeListener.class, listener);
}
/** {@inheritDoc} */
@Override
public final DatasetGroup getGroup()
{
return this.datasetGroup;
}
/** {@inheritDoc} */
@Override
public final void setGroup(final DatasetGroup group)
{
this.datasetGroup = group;
}
/** {@inheritDoc} */
@Override
public final DomainOrder getDomainOrder()
{
return DomainOrder.ASCENDING;
}
/** {@inheritDoc} */
@Override
public final int getItemCount(final int series)
{
return this.samples.size();
}
/**
* Retrieve a value from the recorded samples.
* @param item Integer; the rank number of the sample
* @param axis Axis; the axis that determines which quantity to retrieve
* @return Double; the requested value, or Double.NaN if the sample does not (yet) exist
*/
private Double getSample(final int item, final Axis axis)
{
if (item >= this.samples.size())
{
return Double.NaN;
}
double result = this.samples.get(item).getValue(axis);
/*-
System.out.println(String.format("getSample(item=%d, axis=%s) returns %f", item, axis.name,
result));
*/
return result;
}
/** {@inheritDoc} */
@Override
public final Number getX(final int series, final int item)
{
return getXValue(series, item);
}
/** {@inheritDoc} */
@Override
public final double getXValue(final int series, final int item)
{
return getSample(item, this.xAxis);
}
/** {@inheritDoc} */
@Override
public final Number getY(final int series, final int item)
{
return getYValue(series, item);
}
/** {@inheritDoc} */
@Override
public final double getYValue(final int series, final int item)
{
return getSample(item, this.yAxis);
}
/** {@inheritDoc} */
@Override | |
| File | Line |
|---|---|
| org\opentrafficsim\road\gtu\lane\tactical\following\IDMOld.java | 160 |
| org\opentrafficsim\road\gtu\lane\tactical\following\IDMPlusOld.java | 177 |
}
/** {@inheritDoc} */
@Override
public final String getLongName()
{
return String.format("%s (a=%.1fm/s\u00b2, b=%.1fm/s\u00b2, s0=%.1fm, tSafe=%.1fs, delta=%.2f)", getName(),
this.a.getSI(), this.b.getSI(), this.s0.getSI(), this.tSafe.getSI(), this.delta);
}
/** {@inheritDoc} */
@Override
public final void setA(final Acceleration a)
{
this.a = a;
}
/** {@inheritDoc} */
@Override
public final void setT(final Duration t)
{
this.tSafe = t;
}
/** {@inheritDoc} */
@Override
public final void setFspeed(final double fSpeed)
{
this.delta = fSpeed;
}
// The following is inherited from CarFollowingModel
/** {@inheritDoc} */
@Override
public final Speed desiredSpeed(final Parameters parameters, final SpeedLimitInfo speedInfo) throws ParameterException
{
throw new UnsupportedOperationException("Old car-following model does not support desired speed.");
}
/** {@inheritDoc} */
@Override
public final Length desiredHeadway(final Parameters parameters, final Speed speed) throws ParameterException
{
throw new UnsupportedOperationException("Old car-following model does not support desired headway.");
}
/** {@inheritDoc} */
@Override
public final Acceleration followingAcceleration(final Parameters parameters, final Speed speed,
final SpeedLimitInfo speedInfo, final PerceptionIterable<? extends Headway> leaders) throws ParameterException
{
Length headway;
Speed leaderSpeed;
if (leaders.isEmpty())
{
headway = new Length(Double.MAX_VALUE, LengthUnit.SI);
leaderSpeed = speed;
}
else
{
Headway leader = leaders.first();
headway = leader.getDistance();
leaderSpeed = leader.getSpeed();
}
return this.computeAcceleration(speed, speedInfo.getSpeedInfo(SpeedLimitTypes.MAX_VEHICLE_SPEED), leaderSpeed, headway,
speedInfo.getSpeedInfo(SpeedLimitTypes.FIXED_SIGN));
}
/** {@inheritDoc} */
@Override
public final String toString()
{
return "IDMOld [s0=" + this.s0 + ", a=" + this.a + ", b=" + this.b + ", tSafe=" + this.tSafe + ", stepSize=" | |
| File | Line |
|---|---|
| org\opentrafficsim\road\gtu\lane\tactical\util\lmrs\Cooperation.java | 34 |
| org\opentrafficsim\road\gtu\lane\tactical\util\lmrs\Cooperation.java | 70 |
Cooperation PASSIVE = new Cooperation()
{
@Override
public Acceleration cooperate(final LanePerception perception, final Parameters params, final SpeedLimitInfo sli,
final CarFollowingModel cfm, final LateralDirectionality lat, final Desire ownDesire)
throws ParameterException, OperationalPlanException
{
if ((lat.isLeft() && !perception.getLaneStructure().getExtendedCrossSection().contains(RelativeLane.LEFT))
|| (lat.isRight() && !perception.getLaneStructure().getExtendedCrossSection().contains(RelativeLane.RIGHT)))
{
return new Acceleration(Double.MAX_VALUE, AccelerationUnit.SI);
}
Acceleration b = params.getParameter(ParameterTypes.B);
Acceleration a = new Acceleration(Double.MAX_VALUE, AccelerationUnit.SI);
double dCoop = params.getParameter(DCOOP);
Speed ownSpeed = perception.getPerceptionCategory(EgoPerception.class).getSpeed();
RelativeLane relativeLane = new RelativeLane(lat, 1);
for (HeadwayGTU leader : Synchronization.removeAllUpstreamOfConflicts(Synchronization.removeAllUpstreamOfConflicts(
perception.getPerceptionCategory(NeighborsPerception.class).getLeaders(relativeLane), perception,
relativeLane), perception, RelativeLane.CURRENT))
{
Parameters params2 = leader.getParameters();
double desire = lat.equals(LateralDirectionality.LEFT) ? params2.getParameter(DRIGHT)
: lat.equals(LateralDirectionality.RIGHT) ? params2.getParameter(DLEFT) : 0;
if (desire >= dCoop && (leader.getSpeed().gt0() || leader.getDistance().gt0())) | |
| File | Line |
|---|---|
| org\opentrafficsim\graphs\FundamentalDiagram.java | 200 |
| org\opentrafficsim\graphs\FundamentalDiagramLane.java | 187 |
renderer.setDefaultItemLabelsVisible(true);
final ChartPanel cp = new ChartPanel(this.chartPanel);
PointerHandler ph = new PointerHandler()
{
/** {@inheritDoc} */
@Override
void updateHint(final double domainValue, final double rangeValue)
{
if (Double.isNaN(domainValue))
{
setStatusText(" ");
return;
}
String s1 = String.format(getXAxisFormat(), domainValue);
String s2 = String.format(getYAxisFormat(), rangeValue);
setStatusText(s1 + ", " + s2);
}
};
cp.addMouseMotionListener(ph);
cp.addMouseListener(ph);
cp.setMouseWheelEnabled(true);
final JMenu subMenu = new JMenu("Set layout");
final ButtonGroup group = new ButtonGroup();
final JRadioButtonMenuItem defaultItem = addMenuItem(subMenu, group, getDensityAxis(), this.flowAxis, true);
addMenuItem(subMenu, group, this.flowAxis, this.speedAxis, false);
addMenuItem(subMenu, group, this.densityAxis, this.speedAxis, false);
actionPerformed(new ActionEvent(this, 0, defaultItem.getActionCommand()));
final JPopupMenu popupMenu = cp.getPopupMenu();
popupMenu.insert(subMenu, 0);
this.add(cp, BorderLayout.CENTER);
this.statusLabel = new JLabel(" ", SwingConstants.CENTER);
this.add(this.statusLabel, BorderLayout.SOUTH); | |
| File | Line |
|---|---|
| org\opentrafficsim\graphs\FundamentalDiagram.java | 521 |
| org\opentrafficsim\graphs\FundamentalDiagramLane.java | 438 |
}
/** {@inheritDoc} */
@SuppressFBWarnings("ES_COMPARING_STRINGS_WITH_EQ")
@Override
public final void actionPerformed(final ActionEvent actionEvent)
{
final String command = actionEvent.getActionCommand();
// System.out.println("command is \"" + command + "\"");
final String[] fields = command.split("[/]");
if (fields.length == 2)
{
for (String field : fields)
{
if (field.equalsIgnoreCase(this.densityAxis.getShortName()))
{
if (field == fields[0])
{
this.yAxis = this.densityAxis;
}
else
{
this.xAxis = this.densityAxis;
}
}
else if (field.equalsIgnoreCase(this.flowAxis.getShortName()))
{
if (field == fields[0])
{
this.yAxis = this.flowAxis;
}
else
{
this.xAxis = this.flowAxis;
}
}
else if (field.equalsIgnoreCase(this.speedAxis.getShortName()))
{
if (field == fields[0])
{
this.yAxis = this.speedAxis;
}
else
{
this.xAxis = this.speedAxis;
}
}
else
{
throw new Error("Cannot find axis name: " + field);
}
}
reGraph();
}
else
{
throw new Error("Unknown ActionEvent");
}
} | |
| File | Line |
|---|---|
| org\opentrafficsim\road\gtu\lane\tactical\following\IDMOld.java | 80 |
| org\opentrafficsim\road\gtu\lane\tactical\following\IDMPlusOld.java | 86 |
public IDMOld(final Acceleration a, final Acceleration b, final Length s0, final Duration tSafe, final double delta)
{
this.a = a;
this.b = b;
this.s0 = s0;
this.tSafe = tSafe;
this.delta = delta;
}
/**
* Desired speed (taking into account the urge to drive a little faster or slower than the posted speed limit).
* @param speedLimit DoubleScalarAbs<SpeedUnit>; the speed limit
* @param followerMaximumSpeed Speed; the maximum speed that the follower can drive
* @return DoubleScalarRel<SpeedUnit>; the desired speed
*/
private Speed vDes(final Speed speedLimit, final Speed followerMaximumSpeed)
{
return new Speed(Math.min(this.delta * speedLimit.getSI(), followerMaximumSpeed.getSI()), SpeedUnit.SI);
}
/** {@inheritDoc} */
@Override
public final Acceleration computeAcceleration(final Speed followerSpeed, final Speed followerMaximumSpeed,
final Speed leaderSpeed, final Length headway, final Speed speedLimit)
{
return computeAcceleration(followerSpeed, followerMaximumSpeed, leaderSpeed, headway, speedLimit, DEFAULT_STEP_SIZE);
}
/** {@inheritDoc} */
@Override
public final Acceleration computeAcceleration(final Speed followerSpeed, final Speed followerMaximumSpeed,
final Speed leaderSpeed, final Length headway, final Speed speedLimit, final Duration stepSize)
{ | |
| File | Line |
|---|---|
| org\opentrafficsim\road\network\lane\conflict\ConflictBuilder.java | 417 |
| org\opentrafficsim\road\network\lane\conflict\ConflictBuilder.java | 529 |
Length longitudinalPosition2 = lane2.getLength().multiplyBy(f2start);
Length length1 = lane1.getLength().multiplyBy(Math.abs(f1end - f1start));
Length length2 = lane2.getLength().multiplyBy(Math.abs(f2end - f2start));
// Get geometries
OTSLine3D geometry1 = getGeometry(lane1, f1start, f1end, widthGenerator);
OTSLine3D geometry2 = getGeometry(lane2, f2start, f2end, widthGenerator);
// Determine conflict rule
ConflictRule conflictRule;
if (lane1.getParentLink().getPriority().isBusStop() || lane2.getParentLink().getPriority().isBusStop())
{
Throw.when(lane1.getParentLink().getPriority().isBusStop() && lane2.getParentLink().getPriority().isBusStop(),
IllegalArgumentException.class, "Merge conflict between two links with bus stop priority not supported.");
conflictRule = new BusStopConflictRule(simulator);
}
else
{
conflictRule = new DefaultConflictRule();
}
// Make conflict
Conflict.generateConflictPair(ConflictType.MERGE, conflictRule, permitted, lane1, longitudinalPosition1, length1, dir1, | |
| File | Line |
|---|---|
| org\opentrafficsim\road\animation\AnimationToggles.java | 106 |
| org\opentrafficsim\road\animation\AnimationToggles.java | 143 |
aws.addToggleAnimationButtonIcon("Link", OTSLink.class, "/icons/Link24.png", "Show/hide links", true, false);
aws.addToggleAnimationButtonIcon("LinkId", LinkAnimation.Text.class, "/icons/Id24.png", "Show/hide link Ids", false,
true);
aws.addToggleAnimationButtonIcon("Lane", Lane.class, "/icons/Lane24.png", "Show/hide lanes", true, false);
aws.addToggleAnimationButtonIcon("LaneId", LaneAnimation.Text.class, "/icons/Id24.png", "Show/hide lane Ids", false,
true);
aws.addToggleAnimationButtonIcon("Stripe", Stripe.class, "/icons/Stripe24.png", "Show/hide stripes", true, false);
aws.addToggleAnimationButtonIcon("Shoulder", Shoulder.class, "/icons/Shoulder24.png", "Show/hide shoulders", true,
false);
aws.addToggleAnimationButtonIcon("GTU", GTU.class, "/icons/Gtu24.png", "Show/hide GTUs", true, false);
aws.addToggleAnimationButtonIcon("GTUId", DefaultCarAnimation.Text.class, "/icons/Id24.png", "Show/hide GTU Ids", false,
true);
aws.addToggleAnimationButtonIcon("Sensor", Sensor.class, "/icons/Sensor24.png", "Show/hide sensors", true, false); | |
| File | Line |
|---|---|
| org\opentrafficsim\road\network\animation\SensorAnimation.java | 106 |
| org\opentrafficsim\road\network\animation\TrafficLightAnimation.java | 120 |
return "SensorAnimation [getSource()=" + this.getSource() + "]";
}
/**
* Text animation for the Sensor. Separate class to be able to turn it on and off...
* <p>
* Copyright (c) 2013-2018 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
* <br>
* BSD-style license. See <a href="http://opentrafficsim.org/docs/current/license.html">OpenTrafficSim License</a>.
* </p>
* $LastChangedDate: 2015-07-24 02:58:59 +0200 (Fri, 24 Jul 2015) $, @version $Revision: 1147 $, by $Author: averbraeck $,
* initial version Dec 11, 2016 <br>
* @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
* @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
* @author <a href="http://www.transport.citg.tudelft.nl">Wouter Schakel</a>
*/
public class Text extends TextAnimation
{
/** */
private static final long serialVersionUID = 20161211L;
/**
* @param source Locatable; the object for which the text is displayed
* @param text String; the text to display
* @param dx float; the horizontal movement of the text, in meters
* @param dy float; the vertical movement of the text, in meters
* @param textPlacement TextAlignment; where to place the text
* @param color Color; the color of the text
* @param simulator SimulatorInterface.TimeDoubleUnit; the simulator
* @throws NamingException when animation context cannot be created or retrieved
* @throws RemoteException - when remote context cannot be found
*/
public Text(final Locatable source, final String text, final float dx, final float dy,
final TextAlignment textPlacement, final Color color, final SimulatorInterface.TimeDoubleUnit simulator)
throws RemoteException, NamingException
{
super(source, text, dx, dy, textPlacement, color, simulator);
}
/** {@inheritDoc} */
@Override
@SuppressWarnings("checkstyle:designforextension")
public TextAnimation clone(final Locatable newSource, final SimulatorInterface.TimeDoubleUnit newSimulator)
throws RemoteException, NamingException
{
return new Text(newSource, getText(), getDx(), getDy(), getTextAlignment(), getColor(), newSimulator);
}
/** {@inheritDoc} */
@Override
public final String toString()
{
return "Text []";
}
}
} | |
| File | Line |
|---|---|
| org\opentrafficsim\road\network\animation\BusStopAnimation.java | 73 |
| org\opentrafficsim\road\network\animation\SensorAnimation.java | 106 |
| org\opentrafficsim\road\network\animation\TrafficLightAnimation.java | 120 |
return "BusStopAnimation [getSource()=" + getSource() + "]";
}
/**
* Text animation for the BusStop. Separate class to be able to turn it on and off...
* <p>
* Copyright (c) 2013-2018 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
* <br>
* BSD-style license. See <a href="http://opentrafficsim.org/docs/current/license.html">OpenTrafficSim License</a>.
* </p>
* $LastChangedDate: 2015-07-24 02:58:59 +0200 (Fri, 24 Jul 2015) $, @version $Revision: 1147 $, by $Author: averbraeck $,
* initial version Dec 11, 2016 <br>
* @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
* @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
* @author <a href="http://www.transport.citg.tudelft.nl">Wouter Schakel</a>
*/
public class Text extends TextAnimation
{
/** */
private static final long serialVersionUID = 20161211L;
/**
* @param source Locatable; the object for which the text is displayed
* @param text String; the text to display
* @param dx float; the horizontal movement of the text, in meters
* @param dy float; the vertical movement of the text, in meters
* @param textPlacement TextAlignment; where to place the text
* @param color Color; the color of the text
* @param simulator SimulatorInterface.TimeDoubleUnit; the simulator
* @throws NamingException when animation context cannot be created or retrieved
* @throws RemoteException - when remote context cannot be found
*/
public Text(final Locatable source, final String text, final float dx, final float dy,
final TextAlignment textPlacement, final Color color, final SimulatorInterface.TimeDoubleUnit simulator)
throws RemoteException, NamingException
{
super(source, text, dx, dy, textPlacement, color, simulator);
}
/** {@inheritDoc} */
@Override
@SuppressWarnings("checkstyle:designforextension")
public TextAnimation clone(final Locatable newSource, final SimulatorInterface.TimeDoubleUnit newSimulator)
throws RemoteException, NamingException
{
return new Text(newSource, getText(), getDx(), getDy(), getTextAlignment(), getColor(), newSimulator);
}
/** {@inheritDoc} */
@Override
public final String toString()
{
return "Text []";
}
}
} | |
| File | Line |
|---|---|
| org\opentrafficsim\road\gtu\lane\tactical\util\lmrs\Cooperation.java | 47 |
| org\opentrafficsim\road\gtu\lane\tactical\util\lmrs\Cooperation.java | 83 |
| org\opentrafficsim\road\gtu\lane\tactical\util\lmrs\Cooperation.java | 120 |
Acceleration a = new Acceleration(Double.MAX_VALUE, AccelerationUnit.SI);
double dCoop = params.getParameter(DCOOP);
Speed ownSpeed = perception.getPerceptionCategory(EgoPerception.class).getSpeed();
RelativeLane relativeLane = new RelativeLane(lat, 1);
for (HeadwayGTU leader : Synchronization.removeAllUpstreamOfConflicts(Synchronization.removeAllUpstreamOfConflicts(
perception.getPerceptionCategory(NeighborsPerception.class).getLeaders(relativeLane), perception,
relativeLane), perception, RelativeLane.CURRENT))
{
Parameters params2 = leader.getParameters();
double desire = lat.equals(LateralDirectionality.LEFT) ? params2.getParameter(DRIGHT)
: lat.equals(LateralDirectionality.RIGHT) ? params2.getParameter(DLEFT) : 0;
if (desire >= dCoop && (leader.getSpeed().gt0() || leader.getDistance().gt0())) | |
| File | Line |
|---|---|
| org\opentrafficsim\road\gtu\animation\DefaultCarAnimation.java | 294 |
| org\opentrafficsim\road\network\animation\LaneAnimation.java | 168 |
DirectedPoint p = ((LaneBasedIndividualGTU) getSource()).getLocation();
double a = Angle.normalizePi(p.getRotZ());
if (a > Math.PI / 2.0 || a < -0.99 * Math.PI / 2.0)
{
a += Math.PI;
}
return new DirectedPoint(p.x, p.y, Double.MAX_VALUE, 0.0, 0.0, a);
}
/** {@inheritDoc} */
@Override
@SuppressWarnings("checkstyle:designforextension")
public TextAnimation clone(final Locatable newSource, final SimulatorInterface.TimeDoubleUnit newSimulator)
throws RemoteException, NamingException
{
return new Text(newSource, getText(), getDx(), getDy(), getTextAlignment(), getColor(), newSimulator);
}
/** {@inheritDoc} */
@Override
public final String toString()
{
return "Text [isTextDestroyed=" + this.isTextDestroyed + "]"; | |
| File | Line |
|---|---|
| org\opentrafficsim\road\gtu\lane\tactical\following\FixedAccelerationModel.java | 119 |
| org\opentrafficsim\road\gtu\lane\tactical\following\SequentialFixedAccelerationModel.java | 187 |
}
/** {@inheritDoc} */
@Override
public final void setA(final Acceleration a)
{
//
}
/** {@inheritDoc} */
@Override
public final void setT(final Duration t)
{
//
}
/** {@inheritDoc} */
@Override
public final void setFspeed(final double fSpeed)
{
//
}
// The following is inherited from CarFollowingModel
/** {@inheritDoc} */
@Override
public final Speed desiredSpeed(final Parameters parameters, final SpeedLimitInfo speedInfo) throws ParameterException
{
return null;
}
/** {@inheritDoc} */
@Override
public final Length desiredHeadway(final Parameters parameters, final Speed speed) throws ParameterException
{
return null;
}
/** {@inheritDoc} */
@Override
public final Acceleration followingAcceleration(final Parameters parameters, final Speed speed,
final SpeedLimitInfo speedInfo, final PerceptionIterable<? extends Headway> leaders) throws ParameterException
{
return null;
} | |
| File | Line |
|---|---|
| org\opentrafficsim\road\network\factory\LaneFactory.java | 211 |
| org\opentrafficsim\road\network\factory\LaneFactory.java | 291 |
final CrossSectionLink link = makeLink(network, name, from, to, intermediatePoints, simulator);
Lane[] result = new Lane[laneCount];
Length width = new Length(4.0, LengthUnit.METER);
for (int laneIndex = 0; laneIndex < laneCount; laneIndex++)
{
// Be ware! LEFT is lateral positive, RIGHT is lateral negative.
Length latPosAtStart = new Length((-0.5 - laneIndex - laneOffsetAtStart) * width.getSI(), LengthUnit.SI);
Length latPosAtEnd = new Length((-0.5 - laneIndex - laneOffsetAtEnd) * width.getSI(), LengthUnit.SI);
result[laneIndex] =
makeLane(link, "lane." + laneIndex, laneType, latPosAtStart, latPosAtEnd, width, speedLimit, simulator);
} | |
| File | Line |
|---|---|
| org\opentrafficsim\road\gtu\lane\tactical\LaneBasedGTUFollowingDirectedChangeTacticalPlanner.java | 294 |
| org\opentrafficsim\road\gtu\lane\tactical\LaneBasedGTUFollowingDirectedChangeTacticalPlanner.java | 341 |
if (simplePerception.getParallelHeadwaysLeft().isEmpty())
{
Collection<Headway> sameLaneTraffic = new HashSet<>();
// TODO should it be getObjectType().isGtu() or !getObjectType().isDistanceOnly() ?
// XXX Object & GTU
if (simplePerception.getForwardHeadwayGTU() != null
&& simplePerception.getForwardHeadwayGTU().getObjectType().isGtu())
{
sameLaneTraffic.add(simplePerception.getForwardHeadwayGTU());
}
if (simplePerception.getBackwardHeadway() != null
&& simplePerception.getBackwardHeadway().getObjectType().isGtu())
{
sameLaneTraffic.add(simplePerception.getBackwardHeadway());
}
DirectedLaneChangeModel dlcm = new DirectedAltruistic(getPerception());
DirectedLaneMovementStep dlms = dlcm.computeLaneChangeAndAcceleration(laneBasedGTU,
LateralDirectionality.LEFT, sameLaneTraffic, simplePerception.getNeighboringHeadwaysLeft(), | |
| File | Line |
|---|---|
| org\opentrafficsim\road\animation\AnimationToggles.java | 55 |
| org\opentrafficsim\road\animation\AnimationToggles.java | 81 |
aws.addToggleAnimationButtonText("Link", OTSLink.class, "Show/hide links", true);
aws.addToggleAnimationButtonText("LinkId", LinkAnimation.Text.class, "Show/hide link Ids", false);
aws.addToggleAnimationButtonText("Lane", Lane.class, "Show/hide lanes", true);
aws.addToggleAnimationButtonText("LaneId", LaneAnimation.Text.class, "Show/hide lane Ids", false);
aws.addToggleAnimationButtonText("Stripe", Stripe.class, "Show/hide stripes", true);
aws.addToggleAnimationButtonText("Shoulder", Shoulder.class, "Show/hide shoulders", true);
aws.addToggleAnimationButtonText("GTU", GTU.class, "Show/hide GTUs", true);
aws.addToggleAnimationButtonText("GTUId", DefaultCarAnimation.Text.class, "Show/hide GTU Ids", false);
aws.addToggleAnimationButtonText("Sensor", SingleSensor.class, "Show/hide sensors", true); | |
| File | Line |
|---|---|
| org\opentrafficsim\road\animation\AnimationToggles.java | 118 |
| org\opentrafficsim\road\animation\AnimationToggles.java | 155 |
aws.addToggleAnimationButtonIcon("Sensor", Sensor.class, "/icons/Sensor24.png", "Show/hide sensors", true, false);
aws.addToggleAnimationButtonIcon("SensorId", SensorAnimation.Text.class, "/icons/Id24.png", "Show/hide sensors Ids",
false, true);
aws.addToggleAnimationButtonIcon("Light", TrafficLight.class, "/icons/TrafficLight24.png", "Show/hide traffic lights",
true, false);
aws.addToggleAnimationButtonIcon("LightId", TrafficLightAnimation.Text.class, "/icons/Id24.png",
"Show/hide sensors Ids", false, true);
aws.addToggleAnimationButtonIcon("Conflict", Conflict.class, "/icons/Conflict24.png", "Show/hide conflicts", false,
false);
aws.addToggleAnimationButtonIcon("Generator", GTUGenerator.class, "/icons/Generator24.png", "Show/hide generators",
false, false);
aws.addToggleAnimationButtonIcon("Bus", BusStop.class, "/icons/BusStop24.png", "Show/hide bus stops", true, false); | |
| File | Line |
|---|---|
| org\opentrafficsim\road\gtu\lane\tactical\util\lmrs\Cooperation.java | 34 |
| org\opentrafficsim\road\gtu\lane\tactical\util\lmrs\Cooperation.java | 70 |
| org\opentrafficsim\road\gtu\lane\tactical\util\lmrs\Cooperation.java | 107 |
Cooperation PASSIVE = new Cooperation()
{
@Override
public Acceleration cooperate(final LanePerception perception, final Parameters params, final SpeedLimitInfo sli,
final CarFollowingModel cfm, final LateralDirectionality lat, final Desire ownDesire)
throws ParameterException, OperationalPlanException
{
if ((lat.isLeft() && !perception.getLaneStructure().getExtendedCrossSection().contains(RelativeLane.LEFT))
|| (lat.isRight() && !perception.getLaneStructure().getExtendedCrossSection().contains(RelativeLane.RIGHT)))
{
return new Acceleration(Double.MAX_VALUE, AccelerationUnit.SI);
}
Acceleration b = params.getParameter(ParameterTypes.B); | |
| File | Line |
|---|---|
| org\opentrafficsim\road\gtu\generator\AbstractGTUGenerator.java | 342 |
| org\opentrafficsim\road\gtu\generator\AbstractGTUGenerator.java | 402 |
double distanceM = cumDistanceSI + otherGTU.position(theLane, otherGTU.getRear(), when).getSI() - lanePositionSI;
if (distanceM > 0 && distanceM <= maxDistanceSI)
{
return new HeadwayGTUSimple(otherGTU.getId(), otherGTU.getGTUType(), new Length(distanceM, LengthUnit.SI),
otherGTU.getLength(), otherGTU.getWidth(), otherGTU.getSpeed(), otherGTU.getAcceleration(), null);
}
return new HeadwayDistance(Double.MAX_VALUE);
}
// Continue search on successor lanes.
if (cumDistanceSI + theLane.getLength().getSI() - lanePositionSI < maxDistanceSI)
{
// is there a successor link?
if (theLane.nextLanes(this.gtuType).size() > 0) | |
| File | Line |
|---|---|
| org\opentrafficsim\graphs\FlowContourPlot.java | 74 |
| org\opentrafficsim\graphs\SpeedContourPlot.java | 82 |
this.cumulativeLengths.add(new MutablePositionVector(new double[this.getYAxis().getBinCount()],
PositionUnit.METER, StorageType.DENSE));
}
catch (ValueException exception)
{
exception.printStackTrace();
}
}
}
/** {@inheritDoc} */
@Override
public final void incrementBinData(final int timeBin, final int distanceBin, final double duration,
final double distanceCovered, final double acceleration)
{
if (timeBin < 0 || distanceBin < 0 || 0 == duration || distanceBin >= this.getYAxis().getBinCount())
{
return;
} | |