21 package org.matsim.core.mobsim.qsim.pt;
23 import org.apache.logging.log4j.LogManager;
24 import org.apache.logging.log4j.Logger;
31 import java.util.Collections;
32 import java.util.List;
34 import java.util.concurrent.ConcurrentHashMap;
35 import java.util.concurrent.CopyOnWriteArrayList;
45 private final Map<Id<TransitStopFacility>, List<PTPassengerAgent>>
agentsAtStops =
new ConcurrentHashMap<>();
53 throw new NullPointerException(
"stop must not be null.");
55 List<PTPassengerAgent> agents = this.agentsAtStops.get(stopId);
57 agents =
new CopyOnWriteArrayList<>();
58 this.agentsAtStops.put(stopId, agents);
60 if ( !agents.add(agent) ) {
61 log.error(
"did NOT add agent " + agent.
getId() +
" since it was already there.");
69 throw new NullPointerException(
"stopId must not be null.");
71 List<PTPassengerAgent> agents = this.agentsAtStops.get(stopId);
73 if (!agents.remove(agent)) {
74 log.error(
"Agent " + agent.
getId() +
" could not be removed from waiting at stop " + stopId);
77 log.error(
"Agent " + agent.
getId() +
" could not be removed from waiting at stop " + stopId +
" since agents list was null.");
83 List<PTPassengerAgent> agents = this.agentsAtStops.get(stopId);
85 return Collections.emptyList();
87 return Collections.unmodifiableList(agents);
final Map< Id< TransitStopFacility >, List< PTPassengerAgent > > agentsAtStops
Id< TransitStopFacility > getDesiredDestinationStopId()
void addAgentToStop(final double now, final PTPassengerAgent agent, final Id< TransitStopFacility > stopId)
TransitStopAgentTracker(final EventsManager events)
void processEvent(final Event event)
void removeAgentFromStop(final PTPassengerAgent agent, final Id< TransitStopFacility > stopId)
final EventsManager events
List< PTPassengerAgent > getAgentsAtFacility(final Id< TransitStopFacility > stopId)
Map< Id< TransitStopFacility >, List< PTPassengerAgent > > getAgentsAtStop()