This commit is contained in:
Andreas Schildbach 2015-11-28 16:20:13 +01:00
parent 9d18f36fa9
commit 6c1ee94b91
5 changed files with 26 additions and 6 deletions

View file

@ -1468,6 +1468,11 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
{ {
return new Line(id, network, null, ParserUtils.firstNotEmpty(symbol, name)); return new Line(id, network, null, ParserUtils.firstNotEmpty(symbol, name));
} }
else if ("13".equals(mot))
{
if (("S-Bahn".equals(trainName) || (longName != null && longName.startsWith("S-Bahn"))) && symbol != null)
return new Line(id, network, Product.SUBURBAN_TRAIN, symbol);
}
else if ("17".equals(mot)) else if ("17".equals(mot))
{ {
if (trainNum == null && "Schienenersatzverkeh".equals(trainName)) if (trainNum == null && "Schienenersatzverkeh".equals(trainName))

View file

@ -3410,6 +3410,8 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
return Product.REGIONAL_TRAIN; return Product.REGIONAL_TRAIN;
if ("RE".equals(ucType)) // RegionalExpress if ("RE".equals(ucType)) // RegionalExpress
return Product.REGIONAL_TRAIN; return Product.REGIONAL_TRAIN;
if ("DB".equals(ucType))
return Product.REGIONAL_TRAIN;
if ("IR".equals(ucType)) // Interregio if ("IR".equals(ucType)) // Interregio
return Product.REGIONAL_TRAIN; return Product.REGIONAL_TRAIN;
if ("IRE".equals(ucType)) // Interregio Express if ("IRE".equals(ucType)) // Interregio Express

View file

@ -51,19 +51,32 @@ public class KvvProvider extends AbstractEfaProvider
private static final Pattern P_LINE = Pattern.compile("(.*?)\\s+\\([\\w/]+\\)", Pattern.CASE_INSENSITIVE); private static final Pattern P_LINE = Pattern.compile("(.*?)\\s+\\([\\w/]+\\)", Pattern.CASE_INSENSITIVE);
@Override @Override
protected Line parseLine(final @Nullable String id, final @Nullable String network, final @Nullable String mot, final @Nullable String symbol, protected Line parseLine(final @Nullable String id, final @Nullable String network, final @Nullable String mot, @Nullable String symbol,
final @Nullable String name, final @Nullable String longName, final @Nullable String trainType, final @Nullable String trainNum, @Nullable String name, @Nullable String longName, final @Nullable String trainType, final @Nullable String trainNum,
final @Nullable String trainName) final @Nullable String trainName)
{ {
if (symbol != null)
{
final Matcher m = P_LINE.matcher(symbol);
if (m.matches())
symbol = m.group(1);
}
if (name != null) if (name != null)
{ {
final Matcher m = P_LINE.matcher(name); final Matcher m = P_LINE.matcher(name);
if (m.matches()) if (m.matches())
return super.parseLine(id, network, mot, symbol, m.group(1), longName, trainType, trainNum, trainName); name = m.group(1);
}
if (longName != null)
{
final Matcher m = P_LINE.matcher(longName);
if (m.matches())
longName = m.group(1);
} }
return super.parseLine(id, network, mot, symbol, name, longName, trainType, trainNum, trainName); return super.parseLine(id, network, mot, symbol, name, longName, trainType, trainNum, trainName);
// TODO check for " (Ersatzverkehr)"
} }
private static final Map<String, Style> STYLES = new HashMap<String, Style>(); private static final Map<String, Style> STYLES = new HashMap<String, Style>();

View file

@ -87,8 +87,6 @@ public class PlProvider extends AbstractHafasProvider
return Product.REGIONAL_TRAIN; return Product.REGIONAL_TRAIN;
if ("KS".equals(ucType)) // Koleje Śląskie if ("KS".equals(ucType)) // Koleje Śląskie
return Product.REGIONAL_TRAIN; return Product.REGIONAL_TRAIN;
if ("DB".equals(ucType))
return Product.REGIONAL_TRAIN;
if ("REG".equals(ucType)) if ("REG".equals(ucType))
return Product.REGIONAL_TRAIN; return Product.REGIONAL_TRAIN;

View file

@ -162,6 +162,8 @@ public class SydneyProvider extends AbstractEfaProvider
return new Line(id, network, Product.FERRY, "MFF"); return new Line(id, network, Product.FERRY, "MFF");
if ("LneCv".equals(symbol) || "Lane Cove Ferry".equals(name)) if ("LneCv".equals(symbol) || "Lane Cove Ferry".equals(name))
return new Line(id, network, Product.FERRY, "LneCv"); return new Line(id, network, Product.FERRY, "LneCv");
if ("EmpBa".equals(symbol) || "Woy Woy to Empire Bay Ferry".equals(name))
return new Line(id, network, Product.FERRY, "EmpBa");
throw new IllegalStateException("cannot normalize mot='" + mot + "' symbol='" + symbol + "' name='" + name + "' long='" + longName throw new IllegalStateException("cannot normalize mot='" + mot + "' symbol='" + symbol + "' name='" + name + "' long='" + longName
+ "' trainType='" + trainType + "' trainNum='" + trainNum + "' trainName='" + trainName + "'"); + "' trainType='" + trainType + "' trainNum='" + trainNum + "' trainName='" + trainName + "'");