
org.opentripplanner.street.search.request.StreetSearchRequestBuilder 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.street.search.request;
import java.time.Instant;
import java.util.function.Consumer;
import org.opentripplanner.model.GenericLocation;
import org.opentripplanner.routing.api.request.StreetMode;
import org.opentripplanner.routing.api.request.preference.RoutingPreferences;
public class StreetSearchRequestBuilder {
Instant startTime;
StreetMode mode;
RoutingPreferences preferences;
boolean arriveBy;
boolean wheelchair;
GenericLocation from;
GenericLocation to;
StreetSearchRequestBuilder(StreetSearchRequest original) {
this.startTime = original.startTime();
this.mode = original.mode();
this.preferences = original.preferences();
this.arriveBy = original.arriveBy();
this.wheelchair = original.wheelchair();
this.from = original.from();
this.to = original.to();
}
public StreetSearchRequestBuilder withStartTime(Instant startTime) {
this.startTime = startTime;
return this;
}
public StreetSearchRequestBuilder withMode(StreetMode mode) {
this.mode = mode;
return this;
}
public StreetSearchRequestBuilder withPreferences(RoutingPreferences preferences) {
this.preferences = preferences;
return this;
}
public StreetSearchRequestBuilder withPreferences(Consumer body) {
return withPreferences(preferences.copyOf().apply(body).build());
}
public StreetSearchRequestBuilder withArriveBy(boolean arriveBy) {
this.arriveBy = arriveBy;
return this;
}
public StreetSearchRequestBuilder withWheelchair(boolean wheelchair) {
this.wheelchair = wheelchair;
return this;
}
public StreetSearchRequestBuilder withFrom(GenericLocation from) {
this.from = from;
return this;
}
public StreetSearchRequestBuilder withTo(GenericLocation to) {
this.to = to;
return this;
}
public StreetSearchRequest build() {
return new StreetSearchRequest(this);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy