
org.opentripplanner.astar.strategy.ComposingSkipEdgeStrategy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of otp Show documentation
Show all versions of otp Show documentation
The OpenTripPlanner multimodal journey planning system
The newest version!
package org.opentripplanner.astar.strategy;
import org.opentripplanner.astar.spi.AStarEdge;
import org.opentripplanner.astar.spi.AStarState;
import org.opentripplanner.astar.spi.SkipEdgeStrategy;
/**
* Use several strategies in composition with each other, for example by limiting by time and number
* of stops visited. Only one needs to be skipped in order for {@link
* SkipEdgeStrategy#shouldSkipEdge(State, Edge)} to return null.
*/
public record ComposingSkipEdgeStrategy<
State extends AStarState, Edge extends AStarEdge
>(SkipEdgeStrategy... strategies)
implements SkipEdgeStrategy {
@Override
public boolean shouldSkipEdge(State current, Edge edge) {
for (var strategy : strategies) {
if (strategy.shouldSkipEdge(current, edge)) {
return true;
}
}
return false;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy