-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(plan query): add further query parameters
add reluctance(car, bike, bikeWalking), banned, optimize, triangle parameters
- Loading branch information
Showing
9 changed files
with
375 additions
and
5 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
51 changes: 51 additions & 0 deletions
51
src/main/java/org/opentripplanner/client/parameters/InputBanned.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,51 @@ | ||
package org.opentripplanner.client.parameters; | ||
|
||
import java.util.Set; | ||
|
||
public class InputBanned { | ||
|
||
public InputBanned( | ||
Set<String> routes, | ||
Set<String> agencies, | ||
Set<String> trips, | ||
Set<String> stops, | ||
Set<String> stopsHard) { | ||
this.routes = routes; | ||
this.agencies = agencies; | ||
this.trips = trips; | ||
this.stops = stops; | ||
this.stopsHard = stopsHard; | ||
} | ||
|
||
Set<String> routes = Set.of(); | ||
|
||
Set<String> agencies = Set.of(); | ||
|
||
Set<String> trips = Set.of(); | ||
|
||
Set<String> stops = Set.of(); | ||
|
||
Set<String> stopsHard = Set.of(); | ||
|
||
public static InputBannedBuilder builder() { | ||
return new InputBannedBuilder(); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
String routesString = | ||
routes.isEmpty() ? "" : String.format("routes: \"%s\"", String.join(",", routes)); | ||
String agenciesString = | ||
agencies.isEmpty() ? "" : String.format("agencies: \"%s\"", String.join(",", agencies)); | ||
String tripsString = | ||
trips.isEmpty() ? "" : String.format("trips: \"%s\"", String.join(",", trips)); | ||
String stopsString = | ||
stops.isEmpty() ? "" : String.format("stops: \"%s\"", String.join(",", stops)); | ||
String stopsHardString = | ||
stopsHard.isEmpty() ? "" : String.format("stopsHard: \"%s\"", String.join(",", stopsHard)); | ||
|
||
return String.format( | ||
"{%s %s %s %s %s}", | ||
routesString, agenciesString, tripsString, stopsString, stopsHardString); | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
src/main/java/org/opentripplanner/client/parameters/InputBannedBuilder.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,50 @@ | ||
package org.opentripplanner.client.parameters; | ||
|
||
import java.util.Set; | ||
|
||
public class InputBannedBuilder { | ||
private Set<String> routes = Set.of(); | ||
private Set<String> agencies = Set.of(); | ||
private Set<String> trips = Set.of(); | ||
private Set<String> stops = Set.of(); | ||
private Set<String> stopsHard = Set.of(); | ||
|
||
public InputBannedBuilder withRoutes(Set<String> routes) { | ||
this.routes = routes; | ||
return this; | ||
} | ||
|
||
public InputBannedBuilder withAgencies(Set<String> agencies) { | ||
this.agencies = agencies; | ||
return this; | ||
} | ||
|
||
public InputBannedBuilder withTrips(Set<String> trips) { | ||
this.trips = trips; | ||
return this; | ||
} | ||
|
||
public InputBannedBuilder withStops(Set<String> stops) { | ||
this.stops = stops; | ||
return this; | ||
} | ||
|
||
public InputBannedBuilder withStopsHard(Set<String> stopsHard) { | ||
this.stopsHard = stopsHard; | ||
return this; | ||
} | ||
|
||
public InputBanned copy() { | ||
return new InputBannedBuilder() | ||
.withRoutes(this.routes) | ||
.withAgencies(this.agencies) | ||
.withTrips(this.trips) | ||
.withStops(this.stops) | ||
.withStopsHard(this.stopsHard) | ||
.build(); | ||
} | ||
|
||
public InputBanned build() { | ||
return new InputBanned(routes, agencies, trips, stops, stopsHard); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/org/opentripplanner/client/parameters/InputTriangle.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,26 @@ | ||
package org.opentripplanner.client.parameters; | ||
|
||
public class InputTriangle { | ||
float safetyFactor; | ||
float slopeFactor; | ||
float timeFactor; | ||
|
||
public InputTriangle(float safetyFactor, float slopeFactor, float timeFactor) { | ||
this.safetyFactor = safetyFactor; | ||
this.slopeFactor = slopeFactor; | ||
this.timeFactor = timeFactor; | ||
} | ||
|
||
public static InputTriangleBuilder builder() { | ||
return new InputTriangleBuilder(); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
String safetyFactorString = String.format("safetyFactor: %f", safetyFactor); | ||
String slopeFactorString = String.format("slopeFactor: %f", slopeFactor); | ||
String timeFactorString = String.format("timeFactor: %f", timeFactor); | ||
|
||
return String.format("{%s %s %s}", safetyFactorString, slopeFactorString, timeFactorString); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
src/main/java/org/opentripplanner/client/parameters/InputTriangleBuilder.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.opentripplanner.client.parameters; | ||
|
||
public class InputTriangleBuilder { | ||
private float safetyFactor; | ||
private float slopeFactor; | ||
private float timeFactor; | ||
|
||
public InputTriangleBuilder withSafetyFactor(float safetyFactor) { | ||
this.safetyFactor = safetyFactor; | ||
return this; | ||
} | ||
|
||
public InputTriangleBuilder withSlopeFactor(float slopeFactor) { | ||
this.slopeFactor = slopeFactor; | ||
return this; | ||
} | ||
|
||
public InputTriangleBuilder withTimeFactor(float timeFactor) { | ||
this.timeFactor = timeFactor; | ||
return this; | ||
} | ||
|
||
public InputTriangleBuilder copy() { | ||
return new InputTriangleBuilder() | ||
.withSafetyFactor(this.safetyFactor) | ||
.withSlopeFactor(this.slopeFactor) | ||
.withTimeFactor(this.timeFactor); | ||
} | ||
|
||
public InputTriangle build() { | ||
return new InputTriangle(safetyFactor, slopeFactor, timeFactor); | ||
} | ||
} |
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
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
Oops, something went wrong.