mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-16 01:19:49 +00:00
separate parsing lines with type from lines without
git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@903 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
parent
a70b7a6fe5
commit
e599481525
16 changed files with 18 additions and 80 deletions
|
@ -1835,9 +1835,9 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
|
||||
private static final Pattern P_LINE_BUS_SPECIAL = Pattern.compile("Bus([A-Z]/[\\dA-Z]+)");
|
||||
|
||||
protected Line normalizeLine(final String line)
|
||||
protected Line parseLineWithoutType(final String line)
|
||||
{
|
||||
if (line == null || line.length() == 0 || line.equals("#"))
|
||||
if (line == null || line.length() == 0)
|
||||
return null;
|
||||
|
||||
final Matcher mBusSpecial = P_LINE_BUS_SPECIAL.matcher(line);
|
||||
|
|
|
@ -432,7 +432,7 @@ public final class BahnProvider extends AbstractHafasProvider
|
|||
|
||||
if (mDetFine.group(2) != null)
|
||||
{
|
||||
final Line line = normalizeLine(ParserUtils.resolveEntities(mDetFine.group(2)));
|
||||
final Line line = parseLineWithoutType(ParserUtils.resolveEntities(mDetFine.group(2)));
|
||||
|
||||
final Calendar departureTime = new GregorianCalendar(timeZone());
|
||||
departureTime.clear();
|
||||
|
@ -538,7 +538,7 @@ public final class BahnProvider extends AbstractHafasProvider
|
|||
private static final Pattern P_LINE_NUMBER = Pattern.compile("\\d{2,5}");
|
||||
|
||||
@Override
|
||||
protected final Line normalizeLine(final String line)
|
||||
protected final Line parseLineWithoutType(final String line)
|
||||
{
|
||||
if ("Schw-B".equals(line)) // Schwebebahn, gilt als "Straßenbahn besonderer Bauart"
|
||||
return newLine('T' + line);
|
||||
|
@ -552,6 +552,6 @@ public final class BahnProvider extends AbstractHafasProvider
|
|||
if ("---".equals(line))
|
||||
return newLine('?' + line);
|
||||
|
||||
return super.normalizeLine(line);
|
||||
return super.parseLineWithoutType(line);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -294,7 +294,7 @@ public final class BvgProvider extends AbstractHafasProvider
|
|||
final Matcher mMsgsFine = P_DEPARTURES_LIVE_MSGS_FINE.matcher(mMsgsCoarse.group(1));
|
||||
if (mMsgsFine.matches())
|
||||
{
|
||||
final Line line = normalizeLine(ParserUtils.resolveEntities(mMsgsFine.group(1)));
|
||||
final Line line = parseLineWithoutType(ParserUtils.resolveEntities(mMsgsFine.group(1)));
|
||||
final String message = ParserUtils.resolveEntities(mMsgsFine.group(3)).replace('\n', ' ');
|
||||
messages.put(line.label, message);
|
||||
}
|
||||
|
@ -328,7 +328,7 @@ public final class BvgProvider extends AbstractHafasProvider
|
|||
else
|
||||
plannedTime = parsedTime.getTime();
|
||||
|
||||
final Line line = normalizeLine(ParserUtils.resolveEntities(mDepFine.group(3)));
|
||||
final Line line = parseLineWithoutType(ParserUtils.resolveEntities(mDepFine.group(3)));
|
||||
|
||||
final String position = null;
|
||||
|
||||
|
@ -398,7 +398,7 @@ public final class BvgProvider extends AbstractHafasProvider
|
|||
|
||||
final Date plannedTime = parsedTime.getTime();
|
||||
|
||||
final Line line = normalizeLine(ParserUtils.resolveEntities(mDepFine.group(2)));
|
||||
final Line line = parseLineWithoutType(ParserUtils.resolveEntities(mDepFine.group(2)));
|
||||
|
||||
final String position = ParserUtils.resolveEntities(mDepFine.group(3));
|
||||
|
||||
|
@ -831,7 +831,7 @@ public final class BvgProvider extends AbstractHafasProvider
|
|||
final String arrivalPosition = !mDetails.group(4).equals(" ") ? ParserUtils.resolveEntities(mDetails.group(4))
|
||||
: null;
|
||||
|
||||
final Line line = normalizeLine(ParserUtils.resolveEntities(tDep[3]));
|
||||
final Line line = parseLineWithoutType(ParserUtils.resolveEntities(tDep[3]));
|
||||
|
||||
final Location destination;
|
||||
if (mDetails.group(3) != null)
|
||||
|
@ -891,7 +891,7 @@ public final class BvgProvider extends AbstractHafasProvider
|
|||
private static final Pattern P_LINE_NUMBER = Pattern.compile("\\d{4,}");
|
||||
|
||||
@Override
|
||||
protected Line normalizeLine(final String line)
|
||||
protected Line parseLineWithoutType(final String line)
|
||||
{
|
||||
if ("S41".equals(line))
|
||||
return newLine("SS41", Attr.CIRCLE_CLOCKWISE);
|
||||
|
@ -928,7 +928,7 @@ public final class BvgProvider extends AbstractHafasProvider
|
|||
if (P_LINE_NUMBER.matcher(line).matches())
|
||||
return newLine('R' + line);
|
||||
|
||||
return super.normalizeLine(line);
|
||||
return super.parseLineWithoutType(line);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -20,7 +20,6 @@ package de.schildbach.pte;
|
|||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import de.schildbach.pte.dto.Line;
|
||||
import de.schildbach.pte.dto.Location;
|
||||
import de.schildbach.pte.dto.LocationType;
|
||||
import de.schildbach.pte.dto.NearbyStationsResult;
|
||||
|
@ -164,12 +163,6 @@ public class DsbProvider extends AbstractHafasProvider
|
|||
return xmlLocationList(uri);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Line normalizeLine(final String line)
|
||||
{
|
||||
return parseLineAndType(line);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected char normalizeType(final String type)
|
||||
{
|
||||
|
|
|
@ -20,7 +20,6 @@ package de.schildbach.pte;
|
|||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import de.schildbach.pte.dto.Line;
|
||||
import de.schildbach.pte.dto.Location;
|
||||
import de.schildbach.pte.dto.LocationType;
|
||||
import de.schildbach.pte.dto.NearbyStationsResult;
|
||||
|
@ -138,12 +137,6 @@ public class LuProvider extends AbstractHafasProvider
|
|||
return xmlMLcReq(constraint);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Line normalizeLine(final String line)
|
||||
{
|
||||
return parseLineAndType(line);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected char normalizeType(final String type)
|
||||
{
|
||||
|
|
|
@ -147,12 +147,12 @@ public class NasaProvider extends AbstractHafasProvider
|
|||
private static final Pattern P_LINE_NUMBER = Pattern.compile("\\d{4,}");
|
||||
|
||||
@Override
|
||||
protected Line normalizeLine(final String line)
|
||||
protected Line parseLineWithoutType(final String line)
|
||||
{
|
||||
if (P_LINE_NUMBER.matcher(line).matches())
|
||||
return newLine('?' + line);
|
||||
|
||||
return super.normalizeLine(line);
|
||||
return super.parseLineWithoutType(line);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -160,7 +160,7 @@ public class NsProvider extends AbstractHafasProvider
|
|||
final Matcher mDepFine = P_DEPARTURES_FINE.matcher(mDepCoarse.group(1));
|
||||
if (mDepFine.matches())
|
||||
{
|
||||
final Line line = normalizeLine(ParserUtils.resolveEntities(mDepFine.group(1)));
|
||||
final Line line = parseLineWithoutType(ParserUtils.resolveEntities(mDepFine.group(1)));
|
||||
|
||||
final String destination = ParserUtils.resolveEntities(mDepFine.group(2));
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import de.schildbach.pte.dto.Line;
|
||||
import de.schildbach.pte.dto.Location;
|
||||
import de.schildbach.pte.dto.LocationType;
|
||||
import de.schildbach.pte.dto.NearbyStationsResult;
|
||||
|
@ -201,12 +200,6 @@ public class OebbProvider extends AbstractHafasProvider
|
|||
WALKSPEED_MAP.put(WalkSpeed.FAST, "85");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Line normalizeLine(final String line)
|
||||
{
|
||||
return parseLineAndType(line);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected char normalizeType(final String type)
|
||||
{
|
||||
|
|
|
@ -151,7 +151,7 @@ public class PlProvider extends AbstractHafasProvider
|
|||
private static final Pattern P_NORMALIZE_LINE_NUMBER = Pattern.compile("\\d{2,5}");
|
||||
|
||||
@Override
|
||||
protected Line normalizeLine(String line)
|
||||
protected Line parseLineWithoutType(String line)
|
||||
{
|
||||
// replace badly encoded character (stations 8530643 and 8530644)
|
||||
if (line.equals("F\u0084hre"))
|
||||
|
@ -164,7 +164,7 @@ public class PlProvider extends AbstractHafasProvider
|
|||
if (P_NORMALIZE_LINE_NUMBER.matcher(line).matches())
|
||||
return newLine('R' + line);
|
||||
|
||||
return super.normalizeLine(line);
|
||||
return super.parseLineWithoutType(line);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -241,7 +241,7 @@ public class RmvProvider extends AbstractHafasProvider
|
|||
final Matcher mDepFine = P_DEPARTURES_FINE.matcher(mDepCoarse.group(1));
|
||||
if (mDepFine.matches())
|
||||
{
|
||||
final Line line = normalizeLine(ParserUtils.resolveEntities(mDepFine.group(1)));
|
||||
final Line line = parseLineWithoutType(ParserUtils.resolveEntities(mDepFine.group(1)));
|
||||
|
||||
final String destination = ParserUtils.resolveEntities(mDepFine.group(2));
|
||||
|
||||
|
@ -308,7 +308,7 @@ public class RmvProvider extends AbstractHafasProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Line normalizeLine(final String line)
|
||||
protected Line parseLineWithoutType(final String line)
|
||||
{
|
||||
if (line == null || line.length() == 0)
|
||||
return null;
|
||||
|
|
|
@ -20,7 +20,6 @@ package de.schildbach.pte;
|
|||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import de.schildbach.pte.dto.Line;
|
||||
import de.schildbach.pte.dto.Location;
|
||||
import de.schildbach.pte.dto.LocationType;
|
||||
import de.schildbach.pte.dto.NearbyStationsResult;
|
||||
|
@ -158,12 +157,6 @@ public class RtProvider extends AbstractHafasProvider
|
|||
return jsonGetStops(uri);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Line normalizeLine(final String line)
|
||||
{
|
||||
return parseLineAndType(line);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected char normalizeType(final String type)
|
||||
{
|
||||
|
|
|
@ -20,7 +20,6 @@ package de.schildbach.pte;
|
|||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import de.schildbach.pte.dto.Line;
|
||||
import de.schildbach.pte.dto.Location;
|
||||
import de.schildbach.pte.dto.LocationType;
|
||||
import de.schildbach.pte.dto.NearbyStationsResult;
|
||||
|
@ -154,12 +153,6 @@ public class SbbProvider extends AbstractHafasProvider
|
|||
return jsonGetStops(uri);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Line normalizeLine(final String line)
|
||||
{
|
||||
return parseLineAndType(line);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected char normalizeType(final String type)
|
||||
{
|
||||
|
|
|
@ -20,7 +20,6 @@ package de.schildbach.pte;
|
|||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import de.schildbach.pte.dto.Line;
|
||||
import de.schildbach.pte.dto.Location;
|
||||
import de.schildbach.pte.dto.LocationType;
|
||||
import de.schildbach.pte.dto.NearbyStationsResult;
|
||||
|
@ -145,12 +144,6 @@ public class SncbProvider extends AbstractHafasProvider
|
|||
return jsonGetStops(uri);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Line normalizeLine(final String line)
|
||||
{
|
||||
return parseLineAndType(line);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected char normalizeType(final String type)
|
||||
{
|
||||
|
|
|
@ -22,7 +22,6 @@ import java.util.List;
|
|||
import java.util.regex.Matcher;
|
||||
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;
|
||||
|
@ -173,10 +172,4 @@ public class VbbProvider extends AbstractHafasProvider
|
|||
|
||||
return jsonGetStops(uri);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Line normalizeLine(final String line)
|
||||
{
|
||||
return parseLineAndType(line);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@ package de.schildbach.pte;
|
|||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import de.schildbach.pte.dto.Line;
|
||||
import de.schildbach.pte.dto.Location;
|
||||
import de.schildbach.pte.dto.LocationType;
|
||||
import de.schildbach.pte.dto.NearbyStationsResult;
|
||||
|
@ -159,12 +158,6 @@ public class VbnProvider extends AbstractHafasProvider
|
|||
return jsonGetStops(uri);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Line normalizeLine(final String line)
|
||||
{
|
||||
return parseLineAndType(line);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected char normalizeType(final String type)
|
||||
{
|
||||
|
|
|
@ -190,12 +190,6 @@ public class ZvvProvider extends AbstractHafasProvider
|
|||
return xmlMLcReq(constraint);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Line normalizeLine(final String line)
|
||||
{
|
||||
return parseLineAndType(line);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Line parseLineAndType(final String lineAndType)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue