mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-21 01:39:51 +00:00
handle API change of Leipzig departures
This commit is contained in:
parent
22e052bef4
commit
a12d20ff52
1 changed files with 31 additions and 19 deletions
|
@ -19,9 +19,7 @@ package de.schildbach.pte;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import de.schildbach.pte.dto.Line;
|
||||
import de.schildbach.pte.dto.Location;
|
||||
import de.schildbach.pte.dto.LocationType;
|
||||
import de.schildbach.pte.dto.NearbyStationsResult;
|
||||
|
@ -54,6 +52,37 @@ public class NasaProvider extends AbstractHafasProvider
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected char intToProduct(final int value)
|
||||
{
|
||||
if (value == 1)
|
||||
return 'I';
|
||||
if (value == 2)
|
||||
return 'I';
|
||||
if (value == 4)
|
||||
return 'R';
|
||||
if (value == 8)
|
||||
return 'R';
|
||||
if (value == 16)
|
||||
return 'S';
|
||||
if (value == 32)
|
||||
return 'T';
|
||||
if (value == 64)
|
||||
return 'B';
|
||||
if (value == 128) // Rufbus
|
||||
return 'P';
|
||||
// if (value == 256)
|
||||
// return 0;
|
||||
// if (value == 512)
|
||||
// return 0;
|
||||
// if (value == 1024) // Autoreisezug
|
||||
// return 0;
|
||||
// if (value == 2048)
|
||||
// return 0;
|
||||
|
||||
throw new IllegalArgumentException("cannot handle: " + value);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setProductBits(final StringBuilder productBits, final char product)
|
||||
{
|
||||
|
@ -143,23 +172,6 @@ public class NasaProvider extends AbstractHafasProvider
|
|||
return xmlMLcReq(constraint);
|
||||
}
|
||||
|
||||
private static final Pattern P_LINE_NUMBER = Pattern.compile("\\d{4,}");
|
||||
|
||||
@Override
|
||||
protected Line parseLineWithoutType(final String line)
|
||||
{
|
||||
if (P_LINE_NUMBER.matcher(line).matches())
|
||||
return newLine('?' + line);
|
||||
|
||||
return super.parseLineWithoutType(line);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Line parseLineAndType(final String line)
|
||||
{
|
||||
return parseLineWithoutType(line);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected char normalizeType(String type)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue