Commit 3bc99890 authored by Jakob Schöttl's avatar Jakob Schöttl
Browse files

Bugfix in log event processor

parent 77900831
......@@ -131,6 +131,11 @@ public class LogEventProcessor extends DataProcessor<IdDataKey, LogEventEntry> {
@Override
public void reachedTarget(Target target, Agent agent) {
final Seat seat = trainModel.getSeatForTarget(target);
// This check is necessary because a second person could reach the
// target (and find that the seat is already taken).
// Order of listener invocations is not predictable, therefore both options are checked.
if (seat.isAvailable() || seat.getSittingPerson() == agent)
writeSitDownEvent((Pedestrian) agent, seatNumber);
}
}
......
......@@ -15,7 +15,10 @@ public class Target implements ScenarioElement, Comparable<Target> {
private final AttributesTarget attributes;
private final Map<Integer, Double> enteringTimes;
/** Collection of listeners - order does not play a role. */
/**
* Collection of listeners - unordered because it's order is not predictable
* (at least not for clients).
*/
private final Collection<TargetListener> targetListeners = new LinkedList<>();
public Target(AttributesTarget attributes) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment