mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-08 21:28:48 +00:00
Lines.
This commit is contained in:
parent
9b9b85aa66
commit
ca0030a33c
2 changed files with 15 additions and 3 deletions
|
@ -3152,6 +3152,8 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider {
|
||||||
return Product.HIGH_SPEED_TRAIN;
|
return Product.HIGH_SPEED_TRAIN;
|
||||||
if ("HKX".equals(ucType)) // Hamburg-Koeln-Express
|
if ("HKX".equals(ucType)) // Hamburg-Koeln-Express
|
||||||
return Product.HIGH_SPEED_TRAIN;
|
return Product.HIGH_SPEED_TRAIN;
|
||||||
|
if ("UEX".equals(ucType)) // Slovenia
|
||||||
|
return Product.REGIONAL_TRAIN;
|
||||||
|
|
||||||
// Regional
|
// Regional
|
||||||
if ("ZUG".equals(ucType)) // Generic Train
|
if ("ZUG".equals(ucType)) // Generic Train
|
||||||
|
|
|
@ -20,8 +20,10 @@ package de.schildbach.pte;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import com.google.common.base.Charsets;
|
import com.google.common.base.Charsets;
|
||||||
|
import com.google.common.base.Strings;
|
||||||
|
|
||||||
import de.schildbach.pte.dto.Line;
|
import de.schildbach.pte.dto.Line;
|
||||||
import de.schildbach.pte.dto.Product;
|
import de.schildbach.pte.dto.Product;
|
||||||
|
@ -91,12 +93,14 @@ public class ZvvProvider extends AbstractHafasProvider {
|
||||||
return super.splitStationName(address);
|
return super.splitStationName(address);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final Pattern P_NUMBER = Pattern.compile("\\d{2,5}");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Line parseLineAndType(final String lineAndType) {
|
protected Line parseLineAndType(final String lineAndType) {
|
||||||
final Matcher m = P_NORMALIZE_LINE_AND_TYPE.matcher(lineAndType);
|
final Matcher m = P_NORMALIZE_LINE_AND_TYPE.matcher(lineAndType);
|
||||||
if (m.matches()) {
|
if (m.matches()) {
|
||||||
final String number = m.group(1).replaceAll("\\s+", "");
|
final String number = Strings.emptyToNull(m.group(1).replaceAll("\\s+", ""));
|
||||||
final String type = m.group(2);
|
final String type = Strings.emptyToNull(m.group(2));
|
||||||
|
|
||||||
if ("Bus".equals(type))
|
if ("Bus".equals(type))
|
||||||
return newLine(Product.BUS, stripPrefix(number, "Bus"), null);
|
return newLine(Product.BUS, stripPrefix(number, "Bus"), null);
|
||||||
|
@ -114,7 +118,10 @@ public class ZvvProvider extends AbstractHafasProvider {
|
||||||
if ("S18".equals(number))
|
if ("S18".equals(number))
|
||||||
return newLine(Product.SUBURBAN_TRAIN, "S18", null);
|
return newLine(Product.SUBURBAN_TRAIN, "S18", null);
|
||||||
|
|
||||||
if (type.length() > 0) {
|
if (number != null && P_NUMBER.matcher(number).matches())
|
||||||
|
return newLine(null, number, null);
|
||||||
|
|
||||||
|
if (type != null) {
|
||||||
final Product product = normalizeType(type);
|
final Product product = normalizeType(type);
|
||||||
if (product != null)
|
if (product != null)
|
||||||
return newLine(product, number, null);
|
return newLine(product, number, null);
|
||||||
|
@ -146,6 +153,9 @@ public class ZvvProvider extends AbstractHafasProvider {
|
||||||
if ("KB".equals(ucType)) // Kleinbus?
|
if ("KB".equals(ucType)) // Kleinbus?
|
||||||
return Product.BUS;
|
return Product.BUS;
|
||||||
|
|
||||||
|
if ("TE2".equals(ucType)) // Basel - Strasbourg
|
||||||
|
return Product.REGIONAL_TRAIN;
|
||||||
|
|
||||||
if ("D-SCHIFF".equals(ucType))
|
if ("D-SCHIFF".equals(ucType))
|
||||||
return Product.FERRY;
|
return Product.FERRY;
|
||||||
if ("DAMPFSCH".equals(ucType))
|
if ("DAMPFSCH".equals(ucType))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue