extract parseLineAndType()

git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@789 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
andreas.schildbach@gmail.com 2011-09-25 11:58:35 +00:00
parent ed80d13ff9
commit 59f72323bc
9 changed files with 43 additions and 183 deletions

View file

@ -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);
}
}