diff --git a/matsim/src/main/java/org/matsim/core/router/MultimodalLinkChooser.java b/matsim/src/main/java/org/matsim/core/router/MultimodalLinkChooser.java index a7239e98198..4d8cf318622 100644 --- a/matsim/src/main/java/org/matsim/core/router/MultimodalLinkChooser.java +++ b/matsim/src/main/java/org/matsim/core/router/MultimodalLinkChooser.java @@ -2,9 +2,8 @@ import org.matsim.api.core.v01.network.Link; import org.matsim.api.core.v01.network.Network; -import org.matsim.facilities.Facility; public interface MultimodalLinkChooser { - - public Link decideOnLink( final Facility facility, final Network network ); + public Link decideAccessLink(RoutingRequest request, Network network); + public Link decideEgressLink(RoutingRequest request, Network network); } diff --git a/matsim/src/main/java/org/matsim/core/router/MultimodalLinkChooserDefaultImpl.java b/matsim/src/main/java/org/matsim/core/router/MultimodalLinkChooserDefaultImpl.java index cd37d0f0098..00b93eb363a 100644 --- a/matsim/src/main/java/org/matsim/core/router/MultimodalLinkChooserDefaultImpl.java +++ b/matsim/src/main/java/org/matsim/core/router/MultimodalLinkChooserDefaultImpl.java @@ -15,7 +15,16 @@ class MultimodalLinkChooserDefaultImpl implements MultimodalLinkChooser { private static final Logger log = LogManager.getLogger( FacilitiesUtils.class ) ; @Override - public Link decideOnLink(Facility facility, Network network) { + public Link decideAccessLink(RoutingRequest request, Network network) { + return decideOnLink(request.getFromFacility(), network); + } + + @Override + public Link decideEgressLink(RoutingRequest request, Network network) { + return decideOnLink(request.getToFacility(), network); + } + + private Link decideOnLink(Facility facility, Network network) { Link accessActLink = null ; Id accessActLinkId = null ; diff --git a/matsim/src/main/java/org/matsim/core/router/NetworkRoutingInclAccessEgressModule.java b/matsim/src/main/java/org/matsim/core/router/NetworkRoutingInclAccessEgressModule.java index 1a24567b1dd..39338b527dd 100644 --- a/matsim/src/main/java/org/matsim/core/router/NetworkRoutingInclAccessEgressModule.java +++ b/matsim/src/main/java/org/matsim/core/router/NetworkRoutingInclAccessEgressModule.java @@ -140,9 +140,8 @@ public synchronized List calcRoute(RoutingRequest request Gbl.assertNotNull(fromFacility); Gbl.assertNotNull(toFacility); - Link accessActLink = multimodalLinkChooser.decideOnLink(fromFacility, filteredNetwork); - - Link egressActLink = multimodalLinkChooser.decideOnLink(toFacility, filteredNetwork); + Link accessActLink = multimodalLinkChooser.decideAccessLink(request, filteredNetwork); + Link egressActLink = multimodalLinkChooser.decideEgressLink(request, filteredNetwork); double now = departureTime; diff --git a/matsim/src/test/java/org/matsim/core/router/MultimodalLinkChooserTest.java b/matsim/src/test/java/org/matsim/core/router/MultimodalLinkChooserDefaultImplTest.java similarity index 92% rename from matsim/src/test/java/org/matsim/core/router/MultimodalLinkChooserTest.java rename to matsim/src/test/java/org/matsim/core/router/MultimodalLinkChooserDefaultImplTest.java index 78a0dba6426..cb93b4aff0b 100644 --- a/matsim/src/test/java/org/matsim/core/router/MultimodalLinkChooserTest.java +++ b/matsim/src/test/java/org/matsim/core/router/MultimodalLinkChooserDefaultImplTest.java @@ -41,7 +41,7 @@ * */ -public class MultimodalLinkChooserTest { +public class MultimodalLinkChooserDefaultImplTest { @Test void testDecideOnLink() { @@ -75,11 +75,13 @@ void testDecideOnLink() { MultimodalLinkChooser linkChooser = new MultimodalLinkChooserDefaultImpl(); - Link linkFromFacLinkId = linkChooser.decideOnLink(facilityLinkIdNotNull, network); + RoutingRequest request = DefaultRoutingRequest.of(facilityLinkIdNotNull, facilityLinkIdNull, 0, null, null); + + Link linkFromFacLinkId = linkChooser.decideAccessLink(request, network); Assertions.assertEquals(networkLink, linkFromFacLinkId); - Link linkFromFacCoord = linkChooser.decideOnLink(facilityLinkIdNull, network); + Link linkFromFacCoord = linkChooser.decideEgressLink(request, network); Assertions.assertEquals(networkLink, linkFromFacCoord);