mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-07 17:58:49 +00:00
cleanup of various normalizeType/normalizeLine methods
git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@631 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
parent
76c9ba2edd
commit
f5a7ca06dd
13 changed files with 257 additions and 455 deletions
|
@ -733,12 +733,7 @@ public abstract class AbstractHafasProvider implements NetworkProvider
|
|||
if (category == null)
|
||||
category = shortCategory;
|
||||
|
||||
final char type = normalizeType(category);
|
||||
final String lineStr;
|
||||
if (type != 0)
|
||||
lineStr = type + name;
|
||||
else
|
||||
lineStr = _normalizeLine(category, name); // for compatibility
|
||||
final String lineStr = normalizeLine(category, name);
|
||||
line = new Line(lineStr, lineColors(lineStr));
|
||||
}
|
||||
else if (tag.equals("Walk") || tag.equals("Transfer") || tag.equals("GisRoute"))
|
||||
|
@ -1099,6 +1094,228 @@ public abstract class AbstractHafasProvider implements NetworkProvider
|
|||
return new NearbyStationsResult(stations);
|
||||
}
|
||||
|
||||
private static final Pattern P_LINE_S = Pattern.compile("SN?\\d*");
|
||||
|
||||
protected char normalizeType(final String type)
|
||||
{
|
||||
final String ucType = type.toUpperCase();
|
||||
|
||||
// Intercity
|
||||
if ("EC".equals(ucType)) // EuroCity
|
||||
return 'I';
|
||||
if ("EN".equals(ucType)) // EuroNight
|
||||
return 'I';
|
||||
if ("D".equals(ucType)) // EuroNight, Sitzwagenabteil
|
||||
return 'I';
|
||||
if ("EIC".equals(ucType)) // Ekspres InterCity, Polen
|
||||
return 'I';
|
||||
if ("ICE".equals(ucType)) // InterCityExpress
|
||||
return 'I';
|
||||
if ("IC".equals(ucType)) // InterCity
|
||||
return 'I';
|
||||
if ("ICT".equals(ucType)) // InterCity
|
||||
return 'I';
|
||||
if ("ICN".equals(ucType)) // Intercity-Neigezug, Schweiz
|
||||
return 'I';
|
||||
if ("CNL".equals(ucType)) // CityNightLine
|
||||
return 'I';
|
||||
if ("OEC".equals(ucType)) // ÖBB-EuroCity
|
||||
return 'I';
|
||||
if ("OIC".equals(ucType)) // ÖBB-InterCity
|
||||
return 'I';
|
||||
if ("RJ".equals(ucType)) // RailJet, Österreichische Bundesbahnen
|
||||
return 'I';
|
||||
if ("THA".equals(ucType)) // Thalys
|
||||
return 'I';
|
||||
if ("TGV".equals(ucType)) // Train à Grande Vitesse
|
||||
return 'I';
|
||||
if ("DNZ".equals(ucType)) // Nachtzug Basel-Moskau
|
||||
return 'I';
|
||||
if ("AIR".equals(ucType)) // Generic Flight
|
||||
return 'I';
|
||||
if ("ECB".equals(ucType)) // EC, Verona-München
|
||||
return 'I';
|
||||
if ("NZ".equals(ucType)) // Schweden, Nacht
|
||||
return 'I';
|
||||
if ("INZ".equals(ucType)) // Nacht
|
||||
return 'I';
|
||||
if ("RHI".equals(ucType)) // ICE
|
||||
return 'I';
|
||||
if ("RHT".equals(ucType)) // TGV
|
||||
return 'I';
|
||||
if ("TGD".equals(ucType)) // TGV
|
||||
return 'I';
|
||||
if ("IRX".equals(ucType)) // IC
|
||||
return 'I';
|
||||
if ("ES".equals(ucType)) // Eurostar Italia
|
||||
return 'I';
|
||||
if ("EST".equals(ucType)) // Eurostar Frankreich
|
||||
return 'I';
|
||||
if ("EM".equals(ucType)) // Euromed, Barcelona-Alicante, Spanien
|
||||
return 'I';
|
||||
if ("AVE".equals(ucType)) // Alta Velocidad Española, Spanien
|
||||
return 'I';
|
||||
if ("ARC".equals(ucType)) // Arco (Renfe), Spanien
|
||||
return 'I';
|
||||
if ("ALS".equals(ucType)) // Alaris (Renfe), Spanien
|
||||
return 'I';
|
||||
if ("ATR".equals(ucType)) // Altaria (Renfe), Spanien
|
||||
return 'R';
|
||||
if ("TAL".equals(ucType)) // Talgo, Spanien
|
||||
return 'I';
|
||||
if ("X2".equals(ucType)) // X2000 Neigezug, Schweden
|
||||
return 'I';
|
||||
if ("FYR".equals(ucType)) // Fyra, Amsterdam-Schiphol-Rotterdam
|
||||
return 'I';
|
||||
if ("FLUG".equals(ucType))
|
||||
return 'I';
|
||||
|
||||
// Regional
|
||||
if ("ZUG".equals(ucType)) // Generic Train
|
||||
return 'R';
|
||||
if ("R".equals(ucType)) // Generic Regional Train
|
||||
return 'R';
|
||||
if ("DPN".equals(ucType)) // Dritter Personen Nahverkehr
|
||||
return 'R';
|
||||
if ("RB".equals(ucType)) // RegionalBahn
|
||||
return 'R';
|
||||
if ("RE".equals(ucType)) // RegionalExpress
|
||||
return 'R';
|
||||
if ("IR".equals(ucType)) // Interregio
|
||||
return 'R';
|
||||
if ("IRE".equals(ucType)) // Interregio Express
|
||||
return 'R';
|
||||
if ("HEX".equals(ucType)) // Harz-Berlin-Express, Veolia
|
||||
return 'R';
|
||||
if ("WFB".equals(ucType)) // Westfalenbahn
|
||||
return 'R';
|
||||
if ("RT".equals(ucType)) // RegioTram
|
||||
return 'R';
|
||||
if ("REX".equals(ucType)) // RegionalExpress, Österreich
|
||||
return 'R';
|
||||
if ("OS".equals(ucType)) // Osobný vlak, Slovakia oder Osobní vlak, Czech Republic
|
||||
return 'R';
|
||||
if ("SP".equals(ucType)) // Spěšný vlak, Czech Republic
|
||||
return 'R';
|
||||
if ("EZ".equals(ucType)) // ÖBB ErlebnisBahn
|
||||
return 'R';
|
||||
if ("ARZ".equals(ucType)) // Auto-Reisezug Brig - Iselle di Trasquera
|
||||
return 'R';
|
||||
if ("OE".equals(ucType)) // Ostdeutsche Eisenbahn
|
||||
return 'R';
|
||||
if ("MR".equals(ucType)) // Märkische Regionalbahn
|
||||
return 'R';
|
||||
if ("PE".equals(ucType)) // Prignitzer Eisenbahn GmbH
|
||||
return 'R';
|
||||
if ("NE".equals(ucType)) // NEB Betriebsgesellschaft mbH
|
||||
return 'R';
|
||||
if ("MRB".equals(ucType)) // Mitteldeutsche Regiobahn
|
||||
return 'R';
|
||||
if ("ATZ".equals(ucType)) // Autotunnelzug
|
||||
return 'R';
|
||||
if ("CAT".equals(ucType)) // City Airport Train
|
||||
return 'R';
|
||||
if ("EXT".equals(ucType)) // Extrazug
|
||||
return 'R';
|
||||
if ("KD".equals(ucType)) // Koleje Dolnośląskie (Niederschlesische Eisenbahn)
|
||||
return 'R';
|
||||
// if ("E".equals(normalizedType)) // Eilzug, stimmt wahrscheinlich nicht
|
||||
// return "R" + normalizedName;
|
||||
|
||||
// Suburban Trains
|
||||
if (P_LINE_S.matcher(ucType).matches()) // Generic (Night) S-Bahn
|
||||
return 'S';
|
||||
// if ("SPR".equals(normalizedType)) // Sprinter, Niederlande
|
||||
// return "S" + normalizedName;
|
||||
|
||||
// Subway
|
||||
if ("U".equals(ucType)) // Generic U-Bahn
|
||||
return 'U';
|
||||
if ("MET".equals(ucType))
|
||||
return 'U';
|
||||
// if ("M".equals(normalizedType)) // Metro
|
||||
// return "U" + normalizedName;
|
||||
// if ("Métro".equals(normalizedType))
|
||||
// return "U" + normalizedName;
|
||||
|
||||
// Tram
|
||||
if ("STR".equals(ucType)) // Generic Tram
|
||||
return 'T';
|
||||
if ("TRAM".equals(ucType))
|
||||
return 'T';
|
||||
if ("TRA".equals(ucType))
|
||||
return 'T';
|
||||
// if ("T".equals(normalizedType)) // Tram
|
||||
// return "T" + normalizedName;
|
||||
// if ("Tramway".equals(normalizedType))
|
||||
// return "T" + normalizedName;
|
||||
|
||||
// Bus
|
||||
if ("BUS".equals(ucType)) // Generic Bus
|
||||
return 'B';
|
||||
if ("NFB".equals(ucType)) // Niederflur-Bus
|
||||
return 'B';
|
||||
if ("SEV".equals(ucType)) // Schienen-Ersatz-Verkehr
|
||||
return 'B';
|
||||
if ("BUSSEV".equals(ucType)) // Schienen-Ersatz-Verkehr
|
||||
return 'B';
|
||||
if ("BSV".equals(ucType)) // Bus SEV
|
||||
return 'B';
|
||||
if ("FB".equals(ucType)) // Fernbus? Luxemburg-Saarbrücken
|
||||
return 'B';
|
||||
if ("TRO".equals(ucType)) // Trolleybus
|
||||
return 'B';
|
||||
if ("AST".equals(ucType)) // Anruf-Sammel-Taxi
|
||||
return 'B';
|
||||
if ("RUF".equals(ucType)) // Rufbus
|
||||
return 'B';
|
||||
if ("RFT".equals(ucType)) // Ruftaxi
|
||||
return 'B';
|
||||
// if ("N".equals(normalizedType)) // Nachtbus
|
||||
// return "B" + normalizedName;
|
||||
// if ("Taxi".equals(normalizedType)) // Taxi
|
||||
// return "B" + normalizedName;
|
||||
// if ("TX".equals(normalizedType)) // Taxi
|
||||
// return "B" + normalizedName;
|
||||
|
||||
// Ferry
|
||||
if ("SCHIFF".equals(ucType))
|
||||
return 'F';
|
||||
if ("FÄHRE".equals(ucType))
|
||||
return 'F';
|
||||
if ("SCH".equals(ucType)) // Schiff
|
||||
return 'F';
|
||||
if ("AS".equals(ucType)) // SyltShuttle, eigentlich Autoreisezug
|
||||
return 'F';
|
||||
if ("KAT".equals(ucType)) // Katamaran, e.g. Friedrichshafen - Konstanz
|
||||
return 'F';
|
||||
if ("BAT".equals(ucType)) // Boots Anlege Terminal?
|
||||
return 'F';
|
||||
|
||||
// Cable Car
|
||||
if ("SB".equals(ucType)) // Seilbahn
|
||||
return 'C';
|
||||
if ("ZAHNR".equals(ucType)) // Zahnradbahn, u.a. Zugspitzbahn
|
||||
return 'C';
|
||||
if ("GB".equals(ucType)) // Gondelbahn
|
||||
return 'C';
|
||||
if ("LB".equals(ucType)) // Luftseilbahn
|
||||
return 'C';
|
||||
if ("FUN".equals(ucType)) // Funiculaire (Standseilbahn)
|
||||
return 'C';
|
||||
|
||||
// if ("L".equals(normalizedType))
|
||||
// return "?" + normalizedName;
|
||||
// if ("P".equals(normalizedType))
|
||||
// return "?" + normalizedName;
|
||||
// if ("CR".equals(normalizedType))
|
||||
// return "?" + normalizedName;
|
||||
// if ("TRN".equals(normalizedType))
|
||||
// return "?" + normalizedName;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected static final Pattern P_NORMALIZE_LINE = Pattern.compile("([A-Za-zßÄÅäáàâåéèêíìîÖöóòôÜüúùûØ/-]+)[\\s-]*(.*)");
|
||||
|
||||
protected String normalizeLine(final String type, final String line)
|
||||
|
@ -1123,151 +1340,6 @@ public abstract class AbstractHafasProvider implements NetworkProvider
|
|||
throw new IllegalStateException("cannot normalize type '" + type + "' line '" + line + "'");
|
||||
}
|
||||
|
||||
protected abstract char normalizeType(String type);
|
||||
|
||||
protected final char normalizeCommonTypes(final String ucType)
|
||||
{
|
||||
// Intercity
|
||||
if (ucType.equals("EC")) // EuroCity
|
||||
return 'I';
|
||||
if (ucType.equals("EN")) // EuroNight
|
||||
return 'I';
|
||||
if (ucType.equals("EIC")) // Ekspres InterCity, Polen
|
||||
return 'I';
|
||||
if (ucType.equals("ICE")) // InterCityExpress
|
||||
return 'I';
|
||||
if (ucType.equals("IC")) // InterCity
|
||||
return 'I';
|
||||
if (ucType.equals("ICT")) // InterCity
|
||||
return 'I';
|
||||
if ("ICN".equals(ucType)) // Intercity-Neigezug, Schweiz
|
||||
return 'I';
|
||||
if (ucType.equals("CNL")) // CityNightLine
|
||||
return 'I';
|
||||
if (ucType.equals("OEC")) // ÖBB-EuroCity
|
||||
return 'I';
|
||||
if (ucType.equals("OIC")) // ÖBB-InterCity
|
||||
return 'I';
|
||||
if (ucType.equals("RJ")) // RailJet, Österreichische Bundesbahnen
|
||||
return 'I';
|
||||
if (ucType.equals("THA")) // Thalys
|
||||
return 'I';
|
||||
if (ucType.equals("TGV")) // Train à Grande Vitesse
|
||||
return 'I';
|
||||
if (ucType.equals("DNZ")) // Nachtzug Basel-Moskau
|
||||
return 'I';
|
||||
if (ucType.equals("AIR")) // Generic Flight
|
||||
return 'I';
|
||||
if (ucType.equals("ECB")) // EC, Verona-München
|
||||
return 'I';
|
||||
if (ucType.equals("INZ")) // Nacht
|
||||
return 'I';
|
||||
if (ucType.equals("RHI")) // ICE
|
||||
return 'I';
|
||||
if (ucType.equals("RHT")) // TGV
|
||||
return 'I';
|
||||
if (ucType.equals("TGD")) // TGV
|
||||
return 'I';
|
||||
if (ucType.equals("IRX")) // IC
|
||||
return 'I';
|
||||
if ("FLUG".equals(ucType))
|
||||
return 'I';
|
||||
|
||||
// Regional
|
||||
if (ucType.equals("ZUG")) // Generic Train
|
||||
return 'R';
|
||||
if (ucType.equals("R")) // Generic Regional Train
|
||||
return 'R';
|
||||
if (ucType.equals("DPN")) // Dritter Personen Nahverkehr
|
||||
return 'R';
|
||||
if (ucType.equals("RB")) // RegionalBahn
|
||||
return 'R';
|
||||
if (ucType.equals("RE")) // RegionalExpress
|
||||
return 'R';
|
||||
if (ucType.equals("IR")) // Interregio
|
||||
return 'R';
|
||||
if (ucType.equals("IRE")) // Interregio Express
|
||||
return 'R';
|
||||
if (ucType.equals("HEX")) // Harz-Berlin-Express, Veolia
|
||||
return 'R';
|
||||
if (ucType.equals("WFB")) // Westfalenbahn
|
||||
return 'R';
|
||||
if (ucType.equals("RT")) // RegioTram
|
||||
return 'R';
|
||||
if (ucType.equals("REX")) // RegionalExpress, Österreich
|
||||
return 'R';
|
||||
if (ucType.equals("OS")) // Osobný vlak, Slovakia oder Osobní vlak, Czech Republic
|
||||
return 'R';
|
||||
if (ucType.equals("SP")) // Spěšný vlak, Czech Republic
|
||||
return 'R';
|
||||
if ("EZ".equals(ucType)) // ÖBB ErlebnisBahn
|
||||
return 'R';
|
||||
if ("ARZ".equals(ucType)) // Auto-Reisezug Brig - Iselle di Trasquera
|
||||
return 'R';
|
||||
if ("OE".equals(ucType)) // Ostdeutsche Eisenbahn
|
||||
return 'R';
|
||||
if ("MR".equals(ucType)) // Märkische Regionalbahn
|
||||
return 'R';
|
||||
if ("PE".equals(ucType)) // Prignitzer Eisenbahn GmbH
|
||||
return 'R';
|
||||
if ("NE".equals(ucType)) // NEB Betriebsgesellschaft mbH
|
||||
return 'R';
|
||||
|
||||
// Suburban Trains
|
||||
if (ucType.equals("S")) // Generic S-Bahn
|
||||
return 'S';
|
||||
|
||||
// Subway
|
||||
if (ucType.equals("U")) // Generic U-Bahn
|
||||
return 'U';
|
||||
|
||||
// Tram
|
||||
if (ucType.equals("STR")) // Generic Tram
|
||||
return 'T';
|
||||
if ("TRAM".equals(ucType))
|
||||
return 'T';
|
||||
if ("TRA".equals(ucType))
|
||||
return 'T';
|
||||
|
||||
// Bus
|
||||
if (ucType.equals("BUS")) // Generic Bus
|
||||
return 'B';
|
||||
if (ucType.equals("AST")) // Anruf-Sammel-Taxi
|
||||
return 'B';
|
||||
if (ucType.equals("RUF")) // Rufbus
|
||||
return 'B';
|
||||
if ("RFT".equals(ucType)) // Ruftaxi
|
||||
return 'B';
|
||||
if (ucType.equals("SEV")) // Schienen-Ersatz-Verkehr
|
||||
return 'B';
|
||||
if (ucType.equals("BUSSEV")) // Schienen-Ersatz-Verkehr
|
||||
return 'B';
|
||||
if (ucType.equals("BSV")) // Bus SEV
|
||||
return 'B';
|
||||
if (ucType.equals("FB")) // Luxemburg-Saarbrücken
|
||||
return 'B';
|
||||
|
||||
// Ferry
|
||||
if ("SCHIFF".equals(ucType))
|
||||
return 'F';
|
||||
if ("FÄHRE".equals(ucType))
|
||||
return 'F';
|
||||
if (ucType.equals("SCH")) // Schiff
|
||||
return 'F';
|
||||
if (ucType.equals("AS")) // SyltShuttle, eigentlich Autoreisezug
|
||||
return 'F';
|
||||
if ("KAT".equals(ucType)) // Katamaran
|
||||
return 'F';
|
||||
|
||||
// Cable Car
|
||||
if ("SB".equals(ucType)) // Seilbahn
|
||||
return 'C';
|
||||
if ("ZAHNR".equals(ucType)) // Zahnradbahn, u.a. Zugspitzbahn
|
||||
return 'C';
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected String normalizeLine(final String line)
|
||||
{
|
||||
if (line == null || line.length() == 0)
|
||||
|
@ -1289,140 +1361,6 @@ public abstract class AbstractHafasProvider implements NetworkProvider
|
|||
throw new IllegalStateException("cannot normalize line " + line);
|
||||
}
|
||||
|
||||
private static final Pattern P_LINE_S = Pattern.compile("S\\d+");
|
||||
private static final Pattern P_LINE_SN = Pattern.compile("SN\\d*");
|
||||
|
||||
private final String _normalizeLine(final String type, final String name)
|
||||
{
|
||||
final String normalizedType = type.split(" ", 2)[0];
|
||||
final String normalizedName = normalizeWhitespace(name);
|
||||
|
||||
if ("EN".equals(normalizedType)) // EuroNight
|
||||
return "I" + normalizedName;
|
||||
if ("EC".equals(normalizedType)) // EuroCity
|
||||
return "I" + normalizedName;
|
||||
if ("ICE".equals(normalizedType)) // InterCityExpress
|
||||
return "I" + normalizedName;
|
||||
if ("IC".equals(normalizedType)) // InterCity
|
||||
return "I" + normalizedName;
|
||||
if ("ICN".equals(normalizedType)) // IC-Neigezug
|
||||
return "I" + normalizedName;
|
||||
if ("CNL".equals(normalizedType)) // CityNightLine
|
||||
return "I" + normalizedName;
|
||||
if ("OEC".equals(normalizedType)) // ÖBB EuroCity
|
||||
return "I" + normalizedName;
|
||||
if ("OIC".equals(normalizedType)) // ÖBB InterCity
|
||||
return "I" + normalizedName;
|
||||
if ("TGV".equals(normalizedType)) // Train à grande vit.
|
||||
return "I" + normalizedName;
|
||||
if ("THA".equals(normalizedType)) // Thalys
|
||||
return "I" + normalizedName;
|
||||
if ("THALYS".equals(normalizedType)) // THALYS
|
||||
return "I" + normalizedName;
|
||||
if ("ES".equals(normalizedType)) // Eurostar Italia
|
||||
return "I" + normalizedName;
|
||||
if ("EST".equals(normalizedType)) // Eurostar
|
||||
return "I" + normalizedName;
|
||||
if ("X2".equals(normalizedType)) // X2000 Neigezug, Schweden
|
||||
return "I" + normalizedName;
|
||||
if ("RJ".equals(normalizedType)) // Railjet
|
||||
return "I" + normalizedName;
|
||||
if ("AVE".equals(normalizedType)) // Alta Velocidad ES
|
||||
return "I" + normalizedName;
|
||||
if ("ARC".equals(normalizedType)) // Arco, Spanien
|
||||
return "I" + normalizedName;
|
||||
if ("ALS".equals(normalizedType)) // Alaris, Spanien
|
||||
return "I" + normalizedName;
|
||||
if ("TAL".equals(normalizedType)) // Talgo, Spanien
|
||||
return "I" + normalizedName;
|
||||
if ("NZ".equals(normalizedType)) // Nacht-Zug
|
||||
return "I" + normalizedName;
|
||||
if ("FYR".equals(normalizedType)) // Fyra, Amsterdam-Schiphol-Rotterdam
|
||||
return "I" + normalizedName;
|
||||
|
||||
if ("R".equals(normalizedType)) // Regio
|
||||
return "R" + normalizedName;
|
||||
if ("D".equals(normalizedType)) // Schnellzug
|
||||
return "R" + normalizedName;
|
||||
if ("E".equals(normalizedType)) // Eilzug
|
||||
return "R" + normalizedName;
|
||||
if ("RE".equals(normalizedType)) // RegioExpress
|
||||
return "R" + normalizedName;
|
||||
if ("IR".equals(normalizedType)) // InterRegio
|
||||
return "R" + normalizedName;
|
||||
if ("IRE".equals(normalizedType)) // InterRegioExpress
|
||||
return "R" + normalizedName;
|
||||
if ("ATZ".equals(normalizedType)) // Autotunnelzug
|
||||
return "R" + normalizedName;
|
||||
if ("EXT".equals(normalizedType)) // Extrazug
|
||||
return "R" + normalizedName;
|
||||
if ("CAT".equals(normalizedType)) // City Airport Train
|
||||
return "R" + normalizedName;
|
||||
|
||||
if ("S".equals(normalizedType)) // S-Bahn
|
||||
return "S" + normalizedName;
|
||||
if (P_LINE_S.matcher(normalizedType).matches()) // diverse S-Bahnen
|
||||
return "S" + normalizedType;
|
||||
if (P_LINE_SN.matcher(normalizedType).matches()) // Nacht-S-Bahn
|
||||
return "S" + normalizedType;
|
||||
if ("SPR".equals(normalizedType)) // Sprinter, Niederlande
|
||||
return "S" + normalizedName;
|
||||
|
||||
if ("Met".equals(normalizedType)) // Metro
|
||||
return "U" + normalizedName;
|
||||
if ("M".equals(normalizedType)) // Metro
|
||||
return "U" + normalizedName;
|
||||
if ("Métro".equals(normalizedType))
|
||||
return "U" + normalizedName;
|
||||
|
||||
if ("Tram".equals(normalizedType)) // Tram
|
||||
return "T" + normalizedName;
|
||||
if ("TRAM".equals(normalizedType)) // Tram
|
||||
return "T" + normalizedName;
|
||||
if ("T".equals(normalizedType)) // Tram
|
||||
return "T" + normalizedName;
|
||||
if ("Tramway".equals(normalizedType))
|
||||
return "T" + normalizedName;
|
||||
|
||||
if ("BUS".equals(normalizedType)) // Bus
|
||||
return "B" + normalizedName;
|
||||
if ("Bus".equals(normalizedType)) // Niederflurbus
|
||||
return "B" + normalizedName;
|
||||
if ("NFB".equals(normalizedType)) // Niederflur-Bus
|
||||
return "B" + normalizedName;
|
||||
if ("N".equals(normalizedType)) // Nachtbus
|
||||
return "B" + normalizedName;
|
||||
if ("Tro".equals(normalizedType)) // Trolleybus
|
||||
return "B" + normalizedName;
|
||||
if ("Taxi".equals(normalizedType)) // Taxi
|
||||
return "B" + normalizedName;
|
||||
if ("TX".equals(normalizedType)) // Taxi
|
||||
return "B" + normalizedName;
|
||||
|
||||
if ("BAT".equals(normalizedType)) // Schiff
|
||||
return "F" + normalizedName;
|
||||
|
||||
if ("GB".equals(normalizedType)) // Gondelbahn
|
||||
return "C" + normalizedName;
|
||||
if ("LB".equals(normalizedType)) // Luftseilbahn
|
||||
return "C" + normalizedName;
|
||||
if ("FUN".equals(normalizedType)) // Standseilbahn
|
||||
return "C" + normalizedName;
|
||||
if ("Fun".equals(normalizedType)) // Funiculaire
|
||||
return "C" + normalizedName;
|
||||
|
||||
if ("L".equals(normalizedType))
|
||||
return "?" + normalizedName;
|
||||
if ("P".equals(normalizedType))
|
||||
return "?" + normalizedName;
|
||||
if ("CR".equals(normalizedType))
|
||||
return "?" + normalizedName;
|
||||
if ("TRN".equals(normalizedType))
|
||||
return "?" + normalizedName;
|
||||
|
||||
throw new IllegalStateException("cannot normalize type '" + normalizedType + "' (" + type + ") name '" + normalizedName + "'");
|
||||
}
|
||||
|
||||
private static final Pattern P_CONNECTION_ID = Pattern.compile("co=(C\\d+-\\d+)&");
|
||||
|
||||
protected static String extractConnectionId(final String link)
|
||||
|
|
|
@ -140,9 +140,6 @@ public class DsbProvider extends AbstractHafasProvider
|
|||
if ("S-TOG".equals(ucType))
|
||||
return 'S';
|
||||
|
||||
if ("MET".equals(ucType))
|
||||
return 'U';
|
||||
|
||||
if ("BYBUS".equals(ucType))
|
||||
return 'B';
|
||||
if ("X-BUS".equals(ucType))
|
||||
|
@ -160,7 +157,7 @@ public class DsbProvider extends AbstractHafasProvider
|
|||
if ("FÆRGE".equals(ucType))
|
||||
return 'F';
|
||||
|
||||
final char t = normalizeCommonTypes(ucType);
|
||||
final char t = super.normalizeType(type);
|
||||
if (t != 0)
|
||||
return t;
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ public class LuProvider extends AbstractHafasProvider
|
|||
if ("CRE".equals(ucType))
|
||||
return 'R';
|
||||
|
||||
final char t = normalizeCommonTypes(ucType);
|
||||
final char t = super.normalizeType(type);
|
||||
if (t != 0)
|
||||
return t;
|
||||
|
||||
|
|
|
@ -247,12 +247,6 @@ public class NasaProvider extends AbstractHafasProvider
|
|||
{
|
||||
final String ucType = type.toUpperCase();
|
||||
|
||||
final char t = normalizeCommonTypes(ucType);
|
||||
if (t != 0)
|
||||
return t;
|
||||
|
||||
if (ucType.equals("D")) // Rußland Schlafwagenzug
|
||||
return 'I';
|
||||
if (ucType.equals("ECW"))
|
||||
return 'I';
|
||||
|
||||
|
@ -278,6 +272,10 @@ public class NasaProvider extends AbstractHafasProvider
|
|||
if (ucType.equals("RBS")) // Rufbus
|
||||
return 'B';
|
||||
|
||||
final char t = super.normalizeType(type);
|
||||
if (t != 0)
|
||||
return t;
|
||||
|
||||
if (ucType.equals("EB")) // Europa-Park, vermutlich "Erlebnisbahn"
|
||||
return '?';
|
||||
|
||||
|
|
|
@ -199,12 +199,6 @@ public class NsProvider extends AbstractHafasProvider
|
|||
{
|
||||
final String ucType = type.toUpperCase();
|
||||
|
||||
final char t = normalizeCommonTypes(ucType);
|
||||
if (t != 0)
|
||||
return t;
|
||||
|
||||
if (ucType.equals("EST")) // Eurostar Frankreich
|
||||
return 'I';
|
||||
if (ucType.equals("INT")) // Zürich-Brüssel
|
||||
return 'I';
|
||||
|
||||
|
@ -222,6 +216,10 @@ public class NsProvider extends AbstractHafasProvider
|
|||
if (ucType.equals("MÉT"))
|
||||
return 'U';
|
||||
|
||||
final char t = super.normalizeType(type);
|
||||
if (t != 0)
|
||||
return t;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -606,16 +606,10 @@ public class OebbProvider extends AbstractHafasProvider
|
|||
{
|
||||
final String ucType = type.toUpperCase();
|
||||
|
||||
final char t = normalizeCommonTypes(ucType);
|
||||
if (t != 0)
|
||||
return t;
|
||||
|
||||
// if (ucType.equals("X")) // Interconnex, Connections only?
|
||||
// return 'I';
|
||||
if (ucType.equals("INT")) // Rußland, Connections only?
|
||||
return 'I';
|
||||
if (ucType.equals("D")) // Rußland
|
||||
return 'I';
|
||||
if (ucType.equals("RR")) // Finnland, Connections only?
|
||||
return 'I';
|
||||
if (ucType.equals("TLK")) // Tanie Linie Kolejowe, Polen
|
||||
|
@ -624,30 +618,16 @@ public class OebbProvider extends AbstractHafasProvider
|
|||
return 'I';
|
||||
if (ucType.equals("SC")) // SuperCity, Tschechien
|
||||
return 'I';
|
||||
if (ucType.equals("EST")) // Eurostar Frankreich
|
||||
return 'I';
|
||||
if (ucType.equals("ALS")) // Spanien
|
||||
return 'I';
|
||||
if (ucType.equals("ARC")) // Spanien
|
||||
return 'I';
|
||||
if (ucType.equals("TLG")) // Spanien, Madrid
|
||||
return 'I';
|
||||
if (ucType.equals("HOT")) // Spanien, Nacht
|
||||
return 'I';
|
||||
if (ucType.equals("AVE")) // Alta Velocidad Española, Spanien
|
||||
return 'I';
|
||||
if (ucType.equals("NZ")) // Schweden, Nacht, via JSON API
|
||||
return 'I';
|
||||
if (ucType.equals("OZ")) // Schweden, Oeresundzug, Connections only?
|
||||
return 'I';
|
||||
if (ucType.equals("X2")) // Schweden, Connections only?
|
||||
return 'I';
|
||||
if (ucType.equals("X")) // Schweden, via JSON API
|
||||
return 'I';
|
||||
if (ucType.equals("LYN")) // Dänemark
|
||||
return 'I';
|
||||
if (ucType.equals("ES")) // Eurostar Italia
|
||||
return 'I';
|
||||
if (ucType.equals("UUU")) // Italien, Nacht, Connections only?
|
||||
return 'I';
|
||||
|
||||
|
@ -683,8 +663,6 @@ public class OebbProvider extends AbstractHafasProvider
|
|||
return 'R';
|
||||
if (ucType.equals("ZR")) // Bratislava, Slovakai
|
||||
return 'R';
|
||||
if (ucType.equals("CAT")) // Stockholm-Arlanda, Arlanda Express
|
||||
return 'R';
|
||||
if (ucType.equals("N")) // Frankreich, Tours
|
||||
return 'R';
|
||||
if (ucType.equals("DPF")) // VX=Vogtland Express, Connections only?
|
||||
|
@ -725,8 +703,6 @@ public class OebbProvider extends AbstractHafasProvider
|
|||
return 'R';
|
||||
if (ucType.equals("NOB")) // Nord-Ostsee-Bahn, via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("MRB")) // Mitteldeutsche Regiobahn, via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("ARR")) // Ostfriesland, via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("SHB")) // Schleswig-Holstein-Bahn, via JSON API
|
||||
|
@ -847,6 +823,10 @@ public class OebbProvider extends AbstractHafasProvider
|
|||
if (ucType.equals("HBB")) // Innsbruck Hungerburgbahn, via JSON API
|
||||
return 'C';
|
||||
|
||||
final char t = super.normalizeType(type);
|
||||
if (t != 0)
|
||||
return t;
|
||||
|
||||
if (ucType.equals("U70")) // U.K., Connections only?
|
||||
return '?';
|
||||
if (ucType.equals("R84")) // U.K., Connections only?
|
||||
|
|
|
@ -103,6 +103,10 @@ public class PlProvider extends AbstractHafasProvider
|
|||
@Override
|
||||
protected String normalizeLine(String line)
|
||||
{
|
||||
// replace badly encoded character (stations 8530643 and 8530644)
|
||||
if (line.equals("F\u0084hre"))
|
||||
line = "Fähre";
|
||||
|
||||
final Matcher mRussia = P_NORMALIZE_LINE_RUSSIA.matcher(line);
|
||||
if (mRussia.matches())
|
||||
return 'R' + mRussia.group(1);
|
||||
|
@ -122,45 +126,23 @@ public class PlProvider extends AbstractHafasProvider
|
|||
return 'I';
|
||||
if ("X".equals(ucType)) // Schweden
|
||||
return 'I';
|
||||
if ("NZ".equals(ucType)) // Schweden, Nacht
|
||||
return 'I';
|
||||
if ("LYN".equals(ucType)) // Dänemark
|
||||
return 'I';
|
||||
if ("HOT".equals(ucType)) // Spanien, Nacht
|
||||
return 'I';
|
||||
if ("AVE".equals(ucType)) // Alta Velocidad Española, Spanien
|
||||
return 'I';
|
||||
if ("TLG".equals(ucType)) // Spanien, Madrid
|
||||
return 'I';
|
||||
if ("ALS".equals(ucType)) // Spanien
|
||||
return 'I';
|
||||
if ("ARC".equals(ucType)) // Spanien
|
||||
return 'I';
|
||||
if ("EM".equals(ucType)) // EuroMed, Barcelona-Alicante, Spanien
|
||||
return 'I';
|
||||
if ("ES".equals(ucType)) // Eurostar Italia
|
||||
return 'I';
|
||||
if ("SC".equals(ucType)) // SuperCity, Tschechien
|
||||
return 'I';
|
||||
if ("EST".equals(ucType)) // Eurostar Frankreich
|
||||
return 'I';
|
||||
if ("FYR".equals(ucType)) // Fyra, Amsterdam-Schiphol-Rotterdam
|
||||
return 'I';
|
||||
|
||||
if ("D".equals(ucType))
|
||||
return 'R';
|
||||
if ("KM".equals(ucType)) // Koleje Mazowieckie
|
||||
return 'R';
|
||||
if ("KD".equals(ucType)) // Koleje Dolnoslaskie
|
||||
return 'R';
|
||||
if ("AR".equals(ucType)) // Arriva Polaczen
|
||||
return 'R';
|
||||
if ("NEB".equals(ucType)) // Niederbarnimer Eisenbahn
|
||||
return 'R';
|
||||
if ("NWB".equals(ucType)) // NordWestBahn
|
||||
return 'R';
|
||||
if ("MRB".equals(ucType)) // Mitteldeutsche Regiobahn
|
||||
return 'R';
|
||||
if ("HZL".equals(ucType)) // Hohenzollerische Landesbahn
|
||||
return 'R';
|
||||
if ("PEG".equals(ucType)) // Prignitzer Eisenbahn
|
||||
|
@ -265,14 +247,10 @@ public class PlProvider extends AbstractHafasProvider
|
|||
return 'R';
|
||||
if ("BE".equals(ucType)) // Grensland-Express
|
||||
return 'R';
|
||||
if ("CAT".equals(ucType)) // City Airport Train
|
||||
return 'R';
|
||||
if ("LEO".equals(ucType)) // Chiemgauer Lokalbahn
|
||||
return 'R';
|
||||
if ("MSB".equals(ucType)) // Mainschleifenbahn
|
||||
return 'R';
|
||||
if ("ATR".equals(ucType)) // Spanien
|
||||
return 'R';
|
||||
if ("N".equals(ucType)) // St. Pierre des Corps - Tours
|
||||
return 'R';
|
||||
// if ("INT".equals(ucType)) // Rußland
|
||||
|
@ -297,7 +275,7 @@ public class PlProvider extends AbstractHafasProvider
|
|||
if ("BUSMKK".equals(ucType)) // Main-Kinz-Kreis
|
||||
return 'B';
|
||||
|
||||
final char t = normalizeCommonTypes(ucType);
|
||||
final char t = super.normalizeType(type);
|
||||
if (t != 0)
|
||||
return t;
|
||||
|
||||
|
|
|
@ -230,7 +230,6 @@ public class SbbProvider extends AbstractHafasProvider
|
|||
}
|
||||
}
|
||||
|
||||
private static final Pattern P_NORMALIZE_TYPE_SBAHN = Pattern.compile("SN?\\d*");
|
||||
private static final Pattern P_NORMALIZE_TYPE_BUS = Pattern.compile("BUS\\w*");
|
||||
|
||||
@Override
|
||||
|
@ -238,55 +237,15 @@ public class SbbProvider extends AbstractHafasProvider
|
|||
{
|
||||
final String ucType = type.toUpperCase();
|
||||
|
||||
final char t = normalizeCommonTypes(ucType);
|
||||
if (t != 0)
|
||||
return t;
|
||||
|
||||
if (ucType.equals("X")) // InterConnex
|
||||
return 'I';
|
||||
if (ucType.equals("ES")) // Eurostar Italia
|
||||
return 'I';
|
||||
if (ucType.equals("EST")) // Eurostar Frankreich
|
||||
return 'I';
|
||||
if (ucType.equals("NZ")) // Nachtzug?
|
||||
return 'I';
|
||||
if (ucType.equals("IN")) // Oslo
|
||||
return 'I';
|
||||
if (ucType.equals("AVE")) // Alta Velocidad Española, Spanien
|
||||
return 'I';
|
||||
if (ucType.equals("TAL")) // Talgo, Spanien
|
||||
return 'I';
|
||||
if (ucType.equals("EM")) // EuroMed, Barcelona-Alicante, Spanien
|
||||
return 'I';
|
||||
if (ucType.equals("FYR")) // Fyra, Amsterdam-Schiphol-Rotterdam
|
||||
return 'I';
|
||||
|
||||
if (ucType.equals("D"))
|
||||
return 'R';
|
||||
if (ucType.equals("E"))
|
||||
return 'R';
|
||||
if (ucType.equals("EXT"))
|
||||
return 'R';
|
||||
if (ucType.equals("ATZ"))
|
||||
return 'R';
|
||||
if (ucType.equals("RSB"))
|
||||
return 'R';
|
||||
if (ucType.equals("SN"))
|
||||
return 'R';
|
||||
if (ucType.equals("CAT")) // City Airport Train Wien
|
||||
return 'R';
|
||||
if (ucType.equals("ALS")) // Spanien
|
||||
return 'R';
|
||||
if (ucType.equals("ARC")) // Spanien
|
||||
return 'R';
|
||||
if (ucType.equals("ATR")) // Spanien
|
||||
return 'R';
|
||||
|
||||
if (P_NORMALIZE_TYPE_SBAHN.matcher(ucType).matches())
|
||||
return 'S';
|
||||
|
||||
if (ucType.equals("MET")) // Lausanne
|
||||
return 'U';
|
||||
|
||||
if (ucType.equals("M")) // Lausanne
|
||||
return 'T';
|
||||
|
@ -295,12 +254,8 @@ public class SbbProvider extends AbstractHafasProvider
|
|||
if (ucType.equals("NTR"))
|
||||
return 'T';
|
||||
|
||||
if (ucType.equals("TRO"))
|
||||
return 'B';
|
||||
if (ucType.equals("NTO")) // Niederflurtrolleybus zwischen Bern, Bahnhofsplatz und Bern, Wankdorf Bahnhof
|
||||
return 'B';
|
||||
if (ucType.equals("NFB"))
|
||||
return 'B';
|
||||
if (ucType.equals("NBU"))
|
||||
return 'B';
|
||||
if (ucType.equals("MIN"))
|
||||
|
@ -318,27 +273,21 @@ public class SbbProvider extends AbstractHafasProvider
|
|||
if (P_NORMALIZE_TYPE_BUS.matcher(ucType).matches())
|
||||
return 'B';
|
||||
|
||||
if (ucType.equals("BAT"))
|
||||
return 'F';
|
||||
if (ucType.equals("BAV"))
|
||||
return 'F';
|
||||
if (ucType.equals("FAE"))
|
||||
return 'F';
|
||||
if (ucType.equals("KAT")) // z.B. Friedrichshafen <-> Konstanz
|
||||
return 'F';
|
||||
|
||||
if (ucType.equals("GB")) // Gondelbahn
|
||||
return 'C';
|
||||
if (ucType.equals("SL")) // Sessel-Lift
|
||||
return 'C';
|
||||
if (ucType.equals("LB"))
|
||||
return 'C';
|
||||
if (ucType.equals("FUN")) // Standseilbahn
|
||||
return 'C';
|
||||
|
||||
if (ucType.equals("P"))
|
||||
return '?';
|
||||
|
||||
final char t = super.normalizeType(type);
|
||||
if (t != 0)
|
||||
return t;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ public class ShProvider extends AbstractHafasProvider
|
|||
if ("NBE".equals(ucType)) // Nordbahn Eisenbahngesellschaft
|
||||
return 'R';
|
||||
|
||||
final char t = normalizeCommonTypes(ucType);
|
||||
final char t = super.normalizeType(type);
|
||||
if (t != 0)
|
||||
return t;
|
||||
|
||||
|
|
|
@ -206,12 +206,6 @@ public class SncbProvider extends AbstractHafasProvider
|
|||
{
|
||||
final String ucType = type.toUpperCase();
|
||||
|
||||
final char t = normalizeCommonTypes(ucType);
|
||||
if (t != 0)
|
||||
return t;
|
||||
|
||||
if (ucType.equals("EST")) // Eurostar Frankreich
|
||||
return 'I';
|
||||
if (ucType.equals("INT")) // Zürich-Brüssel
|
||||
return 'I';
|
||||
|
||||
|
@ -229,6 +223,10 @@ public class SncbProvider extends AbstractHafasProvider
|
|||
if (ucType.equals("MÉT"))
|
||||
return 'U';
|
||||
|
||||
final char t = super.normalizeType(type);
|
||||
if (t != 0)
|
||||
return t;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -139,21 +139,6 @@ public class VbbProvider extends AbstractHafasProvider
|
|||
throw new IllegalStateException("cannot normalize line " + line);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected char normalizeType(final String type)
|
||||
{
|
||||
final String ucType = type.toUpperCase();
|
||||
|
||||
if ("D".equals(ucType)) // DB Regio AG, e.g. Berlin - Prag
|
||||
return 'I';
|
||||
|
||||
final char t = normalizeCommonTypes(ucType);
|
||||
if (t != 0)
|
||||
return t;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public QueryDeparturesResult queryDepartures(final int stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
{
|
||||
final StringBuilder uri = new StringBuilder();
|
||||
|
|
|
@ -260,14 +260,10 @@ public class VgsProvider extends AbstractHafasProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
protected char normalizeType(String type)
|
||||
protected char normalizeType(final String type)
|
||||
{
|
||||
final String ucType = type.toUpperCase();
|
||||
|
||||
final char t = normalizeCommonTypes(ucType);
|
||||
if (t != 0)
|
||||
return t;
|
||||
|
||||
if (ucType.equals("INT")) // Zürich-Brüssel
|
||||
return 'I';
|
||||
|
||||
|
@ -284,6 +280,10 @@ public class VgsProvider extends AbstractHafasProvider
|
|||
if (ucType.equals("T84")) // U.K.
|
||||
return '?';
|
||||
|
||||
final char t = super.normalizeType(type);
|
||||
if (t != 0)
|
||||
return t;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -127,8 +127,6 @@ public class ZvvProvider extends AbstractHafasProvider
|
|||
throw new IllegalStateException("cannot normalize line " + line);
|
||||
}
|
||||
|
||||
private static final Pattern P_NORMALIZE_LINE_S = Pattern.compile("SN?\\d+");
|
||||
|
||||
@Override
|
||||
protected char normalizeType(final String type)
|
||||
{
|
||||
|
@ -137,17 +135,8 @@ public class ZvvProvider extends AbstractHafasProvider
|
|||
// E-Bus: Bus, Tram oder Zug?
|
||||
// TX: Ruftaxi?
|
||||
|
||||
if ("D".equals(ucType))
|
||||
return 'R';
|
||||
if ("EXT".equals(ucType))
|
||||
return 'R';
|
||||
if ("ATZ".equals(ucType)) // Autotunnelzug
|
||||
return 'R';
|
||||
|
||||
if ("S-BAHN".equals(ucType))
|
||||
return 'S';
|
||||
if (P_NORMALIZE_LINE_S.matcher(type).matches())
|
||||
return 'S';
|
||||
|
||||
if ("T".equals(ucType))
|
||||
return 'T';
|
||||
|
@ -158,8 +147,6 @@ public class ZvvProvider extends AbstractHafasProvider
|
|||
|
||||
if ("BUS-NF".equals(ucType)) // Niederflur
|
||||
return 'B';
|
||||
if ("TRO".equals(ucType))
|
||||
return 'B';
|
||||
|
||||
if ("D-SCHIFF".equals(ucType))
|
||||
return 'F';
|
||||
|
@ -170,19 +157,13 @@ public class ZvvProvider extends AbstractHafasProvider
|
|||
return 'C';
|
||||
if ("SEILBAHN".equals(ucType))
|
||||
return 'C';
|
||||
if ("FUN".equals(ucType)) // Standseilbahn
|
||||
return 'C';
|
||||
if ("GB".equals(ucType)) // Gondelbahn
|
||||
return 'C';
|
||||
if ("LB".equals(ucType)) // Luftseilbahn
|
||||
return 'C';
|
||||
if ("SL".equals(ucType)) // Sessel-Lift
|
||||
return 'C';
|
||||
|
||||
if ("UNB".equals(ucType))
|
||||
return '?';
|
||||
|
||||
final char t = normalizeCommonTypes(ucType);
|
||||
final char t = super.normalizeType(type);
|
||||
if (t != 0)
|
||||
return t;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue