diff --git a/src/main/java/org/opentripplanner/routing/edgetype/RentABikeAbstractEdge.java b/src/main/java/org/opentripplanner/routing/edgetype/RentABikeAbstractEdge.java index 5c17e7a73e0..29d2e2f9e80 100644 --- a/src/main/java/org/opentripplanner/routing/edgetype/RentABikeAbstractEdge.java +++ b/src/main/java/org/opentripplanner/routing/edgetype/RentABikeAbstractEdge.java @@ -52,6 +52,14 @@ protected State traverseRent(State state) { return null; BikeRentalStationVertex dropoff = (BikeRentalStationVertex) tov; + + /* + * Can't rent a bike from a station that is not on + */ + if (!dropoff.isStationOn()) { + return null; + } + if (options.useBikeRentalAvailabilityInformation && dropoff.getBikesAvailable() == 0) return null; @@ -92,6 +100,14 @@ protected State traverseDropoff(State state) { return null; BikeRentalStationVertex pickup = (BikeRentalStationVertex) tov; + + /* + * Can't return a bike to a station that is not on + */ + if (!pickup.isStationOn()) { + return null; + } + if (options.useBikeRentalAvailabilityInformation && pickup.getSpacesAvailable() == 0 && !pickup.getAllowOverloading()) return null; diff --git a/src/main/java/org/opentripplanner/routing/vertextype/BikeRentalStationVertex.java b/src/main/java/org/opentripplanner/routing/vertextype/BikeRentalStationVertex.java index 04d1dd468ca..cacb4fb528a 100644 --- a/src/main/java/org/opentripplanner/routing/vertextype/BikeRentalStationVertex.java +++ b/src/main/java/org/opentripplanner/routing/vertextype/BikeRentalStationVertex.java @@ -27,6 +27,8 @@ public class BikeRentalStationVertex extends Vertex { private boolean allowOverloading; + private boolean stationOn = true; + private String id; /** Some car rental systems and flex transit systems work exactly like bike rental, but with cars. */ @@ -38,7 +40,8 @@ public BikeRentalStationVertex(Graph g, BikeRentalStation station) { this.setId(station.id); this.setBikesAvailable(station.bikesAvailable); this.setSpacesAvailable(station.spacesAvailable); - this.setAllowOverloading(station.allowOverloading); + this.setAllowOverloading(station.allowOverloading); + this.setStationStatus(station.state); this.isCarStation = station.isCarStation; this.station = station; } @@ -55,6 +58,10 @@ public boolean getAllowOverloading() { return allowOverloading; } + public boolean isStationOn() { + return stationOn; + } + public void setBikesAvailable(int bikes) { this.bikesAvailable = bikes; } @@ -67,6 +74,10 @@ public void setAllowOverloading(boolean allowOverloading) { this.allowOverloading = allowOverloading; } + public void setStationStatus(String state) { + this.stationOn = state.equals("Station on"); + } + public String getId() { return id; }