mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-19 16:59:51 +00:00
extract parseLineAndType()
git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@789 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
parent
ed80d13ff9
commit
59f72323bc
9 changed files with 43 additions and 183 deletions
|
@ -173,24 +173,9 @@ public class VbbProvider extends AbstractHafasProvider
|
|||
return jsonGetStops(uri);
|
||||
}
|
||||
|
||||
private static final Pattern P_NORMALIZE_LINE_AND_TYPE = Pattern.compile("([^#]*)#(.*)");
|
||||
|
||||
@Override
|
||||
protected String normalizeLine(final String line)
|
||||
{
|
||||
final Matcher m = P_NORMALIZE_LINE_AND_TYPE.matcher(line);
|
||||
if (m.matches())
|
||||
{
|
||||
final String number = m.group(1).replaceAll("\\s+", " ");
|
||||
final String type = m.group(2);
|
||||
|
||||
final char normalizedType = normalizeType(type);
|
||||
if (normalizedType != 0)
|
||||
return normalizedType + number;
|
||||
|
||||
throw new IllegalStateException("cannot normalize type " + type + " number " + number + " line " + line);
|
||||
}
|
||||
|
||||
throw new IllegalStateException("cannot normalize line " + line);
|
||||
return parseLineAndType(line);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue