mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-09 10:48:47 +00:00
NetworkProvider: Rename Option to TripFlag.
This commit is contained in:
parent
0831d0f8e6
commit
2e5f16d3ef
6 changed files with 18 additions and 18 deletions
|
@ -2057,7 +2057,7 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider {
|
||||||
url.addEncodedQueryParameter("trITMOTvalue100", "10"); // maximum time to walk to first or from last
|
url.addEncodedQueryParameter("trITMOTvalue100", "10"); // maximum time to walk to first or from last
|
||||||
// stop
|
// stop
|
||||||
|
|
||||||
if (options.options != null && options.options.contains(Option.BIKE))
|
if (options.flags != null && options.flags.contains(TripFlag.BIKE))
|
||||||
url.addEncodedQueryParameter("bikeTakeAlong", "1");
|
url.addEncodedQueryParameter("bikeTakeAlong", "1");
|
||||||
|
|
||||||
url.addEncodedQueryParameter("locationServerActive", "1");
|
url.addEncodedQueryParameter("locationServerActive", "1");
|
||||||
|
|
|
@ -738,7 +738,7 @@ public abstract class AbstractHafasLegacyProvider extends AbstractHafasProvider
|
||||||
else
|
else
|
||||||
productsStr = allProductsString();
|
productsStr = allProductsString();
|
||||||
|
|
||||||
final char bikeChar = (options.options != null && options.options.contains(Option.BIKE)) ? '1' : '0';
|
final char bikeChar = (options.flags != null && options.flags.contains(TripFlag.BIKE)) ? '1' : '0';
|
||||||
|
|
||||||
final StringBuilder conReq = new StringBuilder("<ConReq deliverPolyline=\"1\">");
|
final StringBuilder conReq = new StringBuilder("<ConReq deliverPolyline=\"1\">");
|
||||||
conReq.append("<Start>").append(locationXml(from));
|
conReq.append("<Start>").append(locationXml(from));
|
||||||
|
@ -1298,7 +1298,7 @@ public abstract class AbstractHafasLegacyProvider extends AbstractHafasProvider
|
||||||
protected void appendQueryTripsBinaryParameters(final HttpUrl.Builder url, final Location from,
|
protected void appendQueryTripsBinaryParameters(final HttpUrl.Builder url, final Location from,
|
||||||
final @Nullable Location via, final Location to, final Date date, final boolean dep,
|
final @Nullable Location via, final Location to, final Date date, final boolean dep,
|
||||||
final @Nullable Set<Product> products, final @Nullable Accessibility accessibility,
|
final @Nullable Set<Product> products, final @Nullable Accessibility accessibility,
|
||||||
final @Nullable Set<Option> options) {
|
final @Nullable Set<TripFlag> flags) {
|
||||||
url.addQueryParameter("start", "Suchen");
|
url.addQueryParameter("start", "Suchen");
|
||||||
url.addEncodedQueryParameter("REQ0JourneyStopsS0ID",
|
url.addEncodedQueryParameter("REQ0JourneyStopsS0ID",
|
||||||
ParserUtils.urlEncode(locationId(from), requestUrlEncoding));
|
ParserUtils.urlEncode(locationId(from), requestUrlEncoding));
|
||||||
|
@ -1340,7 +1340,7 @@ public abstract class AbstractHafasLegacyProvider extends AbstractHafasProvider
|
||||||
url.addQueryParameter("REQ0AddParamBaimprofile", "0");
|
url.addQueryParameter("REQ0AddParamBaimprofile", "0");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options != null && options.contains(Option.BIKE))
|
if (flags != null && flags.contains(TripFlag.BIKE))
|
||||||
url.addQueryParameter("REQ0JourneyProduct_opt3", "1");
|
url.addQueryParameter("REQ0JourneyProduct_opt3", "1");
|
||||||
|
|
||||||
appendCommonQueryTripsBinaryParameters(url);
|
appendCommonQueryTripsBinaryParameters(url);
|
||||||
|
@ -1390,7 +1390,7 @@ public abstract class AbstractHafasLegacyProvider extends AbstractHafasProvider
|
||||||
|
|
||||||
final HttpUrl.Builder url = queryEndpoint.newBuilder().addPathSegment(apiLanguage);
|
final HttpUrl.Builder url = queryEndpoint.newBuilder().addPathSegment(apiLanguage);
|
||||||
appendQueryTripsBinaryParameters(url, from, via, to, date, dep, options.products, options.accessibility,
|
appendQueryTripsBinaryParameters(url, from, via, to, date, dep, options.products, options.accessibility,
|
||||||
options.options);
|
options.flags);
|
||||||
return queryTripsBinary(url.build(), from, via, to, QUERY_TRIPS_BINARY_BUFFER_SIZE);
|
return queryTripsBinary(url.build(), from, via, to, QUERY_TRIPS_BINARY_BUFFER_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -920,7 +920,7 @@ public abstract class AbstractNavitiaProvider extends AbstractNetworkProvider {
|
||||||
url.addQueryParameter("walking_speed", Double.toString(walkingSpeed));
|
url.addQueryParameter("walking_speed", Double.toString(walkingSpeed));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.options != null && options.options.contains(Option.BIKE)) {
|
if (options.flags != null && options.flags.contains(TripFlag.BIKE)) {
|
||||||
url.addQueryParameter("first_section_mode", "bike");
|
url.addQueryParameter("first_section_mode", "bike");
|
||||||
url.addQueryParameter("last_section_mode", "bike");
|
url.addQueryParameter("last_section_mode", "bike");
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,9 +81,9 @@ public abstract class AbstractNetworkProvider implements NetworkProvider {
|
||||||
@Override
|
@Override
|
||||||
public QueryTripsResult queryTrips(Location from, @Nullable Location via, Location to, Date date, boolean dep,
|
public QueryTripsResult queryTrips(Location from, @Nullable Location via, Location to, Date date, boolean dep,
|
||||||
@Nullable Set<Product> products, @Nullable Optimize optimize, @Nullable WalkSpeed walkSpeed,
|
@Nullable Set<Product> products, @Nullable Optimize optimize, @Nullable WalkSpeed walkSpeed,
|
||||||
@Nullable Accessibility accessibility, @Nullable Set<Option> options) throws IOException {
|
@Nullable Accessibility accessibility, @Nullable Set<TripFlag> flags) throws IOException {
|
||||||
return queryTrips(from, via, to, date, dep,
|
return queryTrips(from, via, to, date, dep,
|
||||||
new TripOptions(products, optimize, walkSpeed, accessibility, options));
|
new TripOptions(products, optimize, walkSpeed, accessibility, flags));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -65,7 +65,7 @@ public interface NetworkProvider {
|
||||||
NEUTRAL, LIMITED, BARRIER_FREE
|
NEUTRAL, LIMITED, BARRIER_FREE
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Option {
|
public enum TripFlag {
|
||||||
BIKE
|
BIKE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ public interface NetworkProvider {
|
||||||
@Deprecated
|
@Deprecated
|
||||||
QueryTripsResult queryTrips(Location from, @Nullable Location via, Location to, Date date, boolean dep,
|
QueryTripsResult queryTrips(Location from, @Nullable Location via, Location to, Date date, boolean dep,
|
||||||
@Nullable Set<Product> products, @Nullable Optimize optimize, @Nullable WalkSpeed walkSpeed,
|
@Nullable Set<Product> products, @Nullable Optimize optimize, @Nullable WalkSpeed walkSpeed,
|
||||||
@Nullable Accessibility accessibility, @Nullable Set<Option> options) throws IOException;
|
@Nullable Accessibility accessibility, @Nullable Set<TripFlag> flags) throws IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Query more trips (e.g. earlier or later)
|
* Query more trips (e.g. earlier or later)
|
||||||
|
|
|
@ -27,7 +27,7 @@ import com.google.common.base.MoreObjects.ToStringHelper;
|
||||||
import de.schildbach.pte.NetworkProvider;
|
import de.schildbach.pte.NetworkProvider;
|
||||||
import de.schildbach.pte.NetworkProvider.Accessibility;
|
import de.schildbach.pte.NetworkProvider.Accessibility;
|
||||||
import de.schildbach.pte.NetworkProvider.Optimize;
|
import de.schildbach.pte.NetworkProvider.Optimize;
|
||||||
import de.schildbach.pte.NetworkProvider.Option;
|
import de.schildbach.pte.NetworkProvider.TripFlag;
|
||||||
import de.schildbach.pte.NetworkProvider.WalkSpeed;
|
import de.schildbach.pte.NetworkProvider.WalkSpeed;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -40,7 +40,7 @@ public class TripOptions {
|
||||||
public final @Nullable Optimize optimize;
|
public final @Nullable Optimize optimize;
|
||||||
public final @Nullable WalkSpeed walkSpeed;
|
public final @Nullable WalkSpeed walkSpeed;
|
||||||
public final @Nullable Accessibility accessibility;
|
public final @Nullable Accessibility accessibility;
|
||||||
public final @Nullable Set<Option> options;
|
public final @Nullable Set<TripFlag> flags;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param products
|
* @param products
|
||||||
|
@ -51,16 +51,16 @@ public class TripOptions {
|
||||||
* walking ability, or {@code null} for the provider default
|
* walking ability, or {@code null} for the provider default
|
||||||
* @param accessibility
|
* @param accessibility
|
||||||
* route accessibility, or {@code null} for the provider default
|
* route accessibility, or {@code null} for the provider default
|
||||||
* @param options
|
* @param flags
|
||||||
* additional options, or {@code null} for the provider default
|
* additional flags, or {@code null} for the provider default
|
||||||
*/
|
*/
|
||||||
public TripOptions(@Nullable Set<Product> products, @Nullable Optimize optimize, @Nullable WalkSpeed walkSpeed,
|
public TripOptions(@Nullable Set<Product> products, @Nullable Optimize optimize, @Nullable WalkSpeed walkSpeed,
|
||||||
@Nullable Accessibility accessibility, @Nullable Set<Option> options) {
|
@Nullable Accessibility accessibility, @Nullable Set<TripFlag> flags) {
|
||||||
this.products = products;
|
this.products = products;
|
||||||
this.optimize = optimize;
|
this.optimize = optimize;
|
||||||
this.walkSpeed = walkSpeed;
|
this.walkSpeed = walkSpeed;
|
||||||
this.accessibility = accessibility;
|
this.accessibility = accessibility;
|
||||||
this.options = options;
|
this.flags = flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TripOptions() {
|
public TripOptions() {
|
||||||
|
@ -68,7 +68,7 @@ public class TripOptions {
|
||||||
this.optimize = null;
|
this.optimize = null;
|
||||||
this.walkSpeed = null;
|
this.walkSpeed = null;
|
||||||
this.accessibility = null;
|
this.accessibility = null;
|
||||||
this.options = null;
|
this.flags = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -78,7 +78,7 @@ public class TripOptions {
|
||||||
helper.addValue(optimize);
|
helper.addValue(optimize);
|
||||||
helper.addValue(walkSpeed);
|
helper.addValue(walkSpeed);
|
||||||
helper.addValue(accessibility);
|
helper.addValue(accessibility);
|
||||||
helper.add("options", options);
|
helper.add("flags", flags);
|
||||||
return helper.toString();
|
return helper.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue