-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: Transit with abstract access (#214)
* feat: TransitWithAbstractAccessModule * refractoring
- Loading branch information
Showing
29 changed files
with
1,728 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...re/simulation/modes/transit_with_abstract_access/AbstractAccessDepartureEventCreator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package org.eqasim.core.simulation.modes.transit_with_abstract_access; | ||
|
||
import com.google.inject.Inject; | ||
|
||
import org.eqasim.core.simulation.modes.transit_with_abstract_access.events.AbstractAccessDepartureEvent; | ||
import org.eqasim.core.simulation.modes.transit_with_abstract_access.routing.AbstractAccessRoute; | ||
import org.eqasim.core.simulation.modes.transit_with_abstract_access.routing.TransitWithAbstractAccessRoutingModule; | ||
import org.matsim.api.core.v01.Id; | ||
import org.matsim.api.core.v01.network.Link; | ||
import org.matsim.api.core.v01.population.Leg; | ||
import org.matsim.core.api.experimental.events.EventsManager; | ||
import org.matsim.core.mobsim.framework.MobsimAgent; | ||
import org.matsim.core.mobsim.framework.PlanAgent; | ||
import org.matsim.core.mobsim.qsim.interfaces.DepartureHandler; | ||
|
||
public class AbstractAccessDepartureEventCreator implements DepartureHandler { | ||
|
||
private final EventsManager eventsManager; | ||
@Inject | ||
public AbstractAccessDepartureEventCreator(EventsManager eventsManager) { | ||
this.eventsManager = eventsManager; | ||
} | ||
|
||
@Override | ||
public boolean handleDeparture(double now, MobsimAgent agent, Id<Link> linkId) { | ||
if(agent.getMode().equals(TransitWithAbstractAccessRoutingModule.ABSTRACT_ACCESS_LEG_MODE_NAME)) { | ||
Leg leg = (Leg) ((PlanAgent) agent).getCurrentPlanElement(); | ||
AbstractAccessRoute abstractAccessRoute = (AbstractAccessRoute) leg.getRoute(); | ||
this.eventsManager.processEvent(new AbstractAccessDepartureEvent(now, agent.getId(), abstractAccessRoute.getAbstractAccessItemId(), abstractAccessRoute.getStartLinkId(), abstractAccessRoute.getEndLinkId(), abstractAccessRoute.isLeavingAccessCenter(), abstractAccessRoute.isRouted(), abstractAccessRoute.getDistance())); | ||
} | ||
return false; | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
...odes/transit_with_abstract_access/TransitWithAbstractAbstractAccessModuleConfigGroup.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package org.eqasim.core.simulation.modes.transit_with_abstract_access; | ||
|
||
import jakarta.validation.constraints.NotNull; | ||
import org.matsim.core.config.ReflectiveConfigGroup; | ||
|
||
public class TransitWithAbstractAbstractAccessModuleConfigGroup extends ReflectiveConfigGroup { | ||
|
||
public static final String GROUP_NAME = "transitWithAbstractAccess"; | ||
|
||
private static final String ACCESS_ITEMS_FILE_PATH = "accessItemsFilePath"; | ||
|
||
|
||
private static final String MODE_NAME = "modeName"; | ||
|
||
@NotNull | ||
private String accessItemsFilePath; | ||
|
||
@NotNull | ||
private String modeName; | ||
|
||
public TransitWithAbstractAbstractAccessModuleConfigGroup() { | ||
super(GROUP_NAME); | ||
} | ||
|
||
@StringSetter(ACCESS_ITEMS_FILE_PATH) | ||
public void setAccessItemsFilePath(String accessItemsFilePath) { | ||
this.accessItemsFilePath = accessItemsFilePath; | ||
} | ||
|
||
@StringGetter(ACCESS_ITEMS_FILE_PATH) | ||
public String getAccessItemsFilePath() { | ||
return this.accessItemsFilePath; | ||
} | ||
|
||
@StringSetter(MODE_NAME) | ||
public void setModeName(String modeName) { | ||
this.modeName = modeName; | ||
} | ||
|
||
@StringGetter(MODE_NAME) | ||
public String getModeName() { | ||
return this.modeName; | ||
} | ||
} |
Oops, something went wrong.