more lines

git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@698 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
andreas.schildbach@gmail.com 2011-06-13 08:36:07 +00:00
parent 3f61979eb1
commit b215c793ac
4 changed files with 40 additions and 9 deletions

View file

@ -1463,6 +1463,12 @@ public abstract class AbstractHafasProvider implements NetworkProvider
return 'R';
if ("VEB".equals(ucType)) // Vulkan-Eifel-Bahn Betriebsgesellschaft
return 'R';
if ("LEO".equals(ucType)) // Chiemgauer Lokalbahn
return 'R';
if ("VX".equals(ucType)) // Vogtland Express
return 'R';
if ("MSB".equals(ucType)) // Mainschleifenbahn
return 'R';
if ("P".equals(ucType)) // Kasbachtalbahn
return 'R';
if ("ATZ".equals(ucType)) // Autotunnelzug

View file

@ -556,8 +556,6 @@ public class OebbProvider extends AbstractHafasProvider
return 'R';
// if (ucType.equals("SBE")) // Zittau-Seifhennersdorf, via JSON API
// return 'R';
// if (ucType.equals("VX")) // Vogtland Express, via JSON API
// return 'R';
// if (ucType.equals("RNV")) // Rhein-Neckar-Verkehr GmbH, via JSON API
// return 'R';
if ("UAU".equals(ucType)) // Rußland

View file

@ -147,10 +147,6 @@ public class PlProvider extends AbstractHafasProvider
return 'R';
if ("KTB".equals(ucType)) // Kandertalbahn
return 'R';
if ("LEO".equals(ucType)) // Chiemgauer Lokalbahn
return 'R';
if ("MSB".equals(ucType)) // Mainschleifenbahn
return 'R';
if ("N".equals(ucType)) // St. Pierre des Corps - Tours
return 'R';
// if ("INT".equals(ucType)) // Rußland

View file

@ -113,14 +113,13 @@ public class RtProvider extends AbstractHafasProvider
return jsonGetStops(uri);
}
private static final Pattern P_NORMALIZE_LINE_RUSSIA = Pattern.compile("(\\d{3}(BJ|FJ|IJ|MJ|NJ|OJ|TJ|SZ))");
private static final Pattern P_NORMALIZE_LINE_NUMBER = Pattern.compile("\\d{2,5}");
private static final Pattern P_NORMALIZE_LINE_AND_TYPE = Pattern.compile("([^#]*)#(.*)");
@Override
protected String normalizeLine(final String line)
{
if (line.equals("#"))
return "?";
final Matcher m = P_NORMALIZE_LINE_AND_TYPE.matcher(line);
if (m.matches())
{
@ -131,9 +130,41 @@ public class RtProvider extends AbstractHafasProvider
if (normalizedType != 0)
return normalizedType + number;
if (type.length() == 0)
{
if (P_NORMALIZE_LINE_RUSSIA.matcher(number).matches())
return 'R' + number;
if (P_NORMALIZE_LINE_NUMBER.matcher(number).matches())
return '?' + number;
if (number.length() == 0)
return "?";
}
throw new IllegalStateException("cannot normalize type " + type + " number " + number + " line " + line);
}
throw new IllegalStateException("cannot normalize line " + line);
}
@Override
protected char normalizeType(final String type)
{
final String ucType = type.toUpperCase();
if ("A".equals(ucType)) // Spain, Highspeed
return 'I';
if ("E".equals(ucType)) // Romania, Croatia
return 'R';
if ("N".equals(ucType)) // Frankreich, Tours
return 'R';
final char t = super.normalizeType(type);
if (t != 0)
return t;
return 0;
}
}