Work around weirdly formatted positions in San Francisco.

This commit is contained in:
Andreas Schildbach 2015-03-03 11:22:51 +01:00
parent 65870ff563
commit f1aa4c166b

View file

@ -23,6 +23,7 @@ import java.util.Map;
import javax.annotation.Nullable;
import de.schildbach.pte.dto.Line;
import de.schildbach.pte.dto.Position;
import de.schildbach.pte.dto.Product;
import de.schildbach.pte.dto.Style;
@ -53,6 +54,23 @@ public class SfProvider extends AbstractEfaProvider
return super.normalizeLocationName(name).replace("$XINT$", "&");
}
@Override
protected Position parsePosition(final String position)
{
if (position == null)
return null;
final int i = position.lastIndexOf("##");
if (i < 0)
return position.length() < 16 ? super.parsePosition(position) : null;
final String name = position.substring(i + 2).trim();
if (name.isEmpty())
return null;
return new Position(name);
}
@Override
protected Line parseLine(final @Nullable String id, final @Nullable String network, final @Nullable String mot, final @Nullable String symbol,
final @Nullable String name, final @Nullable String longName, final @Nullable String trainType, final @Nullable String trainNum,