mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-15 00:50:31 +00:00
strip 'Bus' from Ingolstadt lines
git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@488 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
parent
5fe5f9f4e1
commit
7f2f1a7f46
2 changed files with 32 additions and 4 deletions
|
@ -809,7 +809,7 @@ public abstract class AbstractHafasProvider implements NetworkProvider
|
|||
|
||||
protected static final Pattern P_NORMALIZE_LINE = Pattern.compile("([A-Za-zÄÖÜäöüßáàâéèêíìîóòôúùû/-]+)[\\s-]*(.*)");
|
||||
|
||||
protected final String normalizeLine(final String type, final String line)
|
||||
protected String normalizeLine(final String type, final String line)
|
||||
{
|
||||
final Matcher m = P_NORMALIZE_LINE.matcher(line);
|
||||
final String strippedLine = m.matches() ? m.group(1) + m.group(2) : line;
|
||||
|
|
|
@ -92,12 +92,40 @@ public class InvgProvider extends AbstractHafasProvider
|
|||
return String.format(NEARBY_URI, ParserUtils.urlEncode(stationId));
|
||||
}
|
||||
|
||||
protected static final Pattern P_NORMALIZE_LINE_BUS = Pattern.compile("Bus\\s*(\\d+)");
|
||||
protected static final Pattern P_NORMALIZE_LINE_NACHTBUS = Pattern.compile("Bus\\s*N\\s*(\\d+)");
|
||||
protected static final Pattern P_NORMALIZE_LINE_BUS_S = Pattern.compile("Bus\\s*S\\s*(\\d+)");
|
||||
protected static final Pattern P_NORMALIZE_LINE_BUS_X = Pattern.compile("Bus\\s*X\\s*(\\d+)");
|
||||
|
||||
@Override
|
||||
protected String normalizeLine(final String type, final String line)
|
||||
{
|
||||
if ("1".equals(type))
|
||||
{
|
||||
final Matcher mBus = P_NORMALIZE_LINE_BUS.matcher(line);
|
||||
if (mBus.matches())
|
||||
return "B" + mBus.group(1);
|
||||
|
||||
final Matcher mNachtbus = P_NORMALIZE_LINE_NACHTBUS.matcher(line);
|
||||
if (mNachtbus.matches())
|
||||
return "BN" + mNachtbus.group(1);
|
||||
|
||||
final Matcher mBusS = P_NORMALIZE_LINE_BUS_S.matcher(line);
|
||||
if (mBusS.matches())
|
||||
return "BS" + mBusS.group(1);
|
||||
|
||||
final Matcher mBusX = P_NORMALIZE_LINE_BUS_X.matcher(line);
|
||||
if (mBusX.matches())
|
||||
return "BX" + mBusX.group(1);
|
||||
}
|
||||
|
||||
return super.normalizeLine(type, line);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected char normalizeType(final String type)
|
||||
{
|
||||
final String ucType = type.toUpperCase();
|
||||
|
||||
if ("1".equals(ucType))
|
||||
if ("1".equals(type))
|
||||
return 'B';
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue