mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-13 00:08:49 +00:00
AbstractHafasLegacyProvider: Parse malformed subway line.
This commit is contained in:
parent
ca4c81ac4a
commit
db0b26719e
1 changed files with 6 additions and 4 deletions
|
@ -2987,9 +2987,9 @@ public abstract class AbstractHafasLegacyProvider extends AbstractHafasProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static final Pattern P_NORMALIZE_LINE_AND_TYPE = Pattern.compile("([^#]*)#(.*)");
|
protected static final Pattern P_NORMALIZE_LINE_AND_TYPE = Pattern.compile("([^#]*)#(.*)");
|
||||||
private static final Pattern P_NORMALIZE_LINE_NUMBER = Pattern.compile("\\d{2,5}");
|
private static final Pattern P_LINE_NUMBER = Pattern.compile("\\d{2,5}");
|
||||||
|
private static final Pattern P_LINE_SUBWAY = Pattern.compile("U\\d{1,2}");
|
||||||
protected static final Pattern P_LINE_RUSSIA = Pattern.compile(
|
private static final Pattern P_LINE_RUSSIA = Pattern.compile(
|
||||||
"\\d{3}(?:AJ|BJ|CJ|DJ|EJ|FJ|GJ|IJ|KJ|LJ|NJ|MJ|OJ|RJ|SJ|TJ|UJ|VJ|ZJ|CH|KH|ZH|EI|JA|JI|MZ|SH|SZ|PC|Y)");
|
"\\d{3}(?:AJ|BJ|CJ|DJ|EJ|FJ|GJ|IJ|KJ|LJ|NJ|MJ|OJ|RJ|SJ|TJ|UJ|VJ|ZJ|CH|KH|ZH|EI|JA|JI|MZ|SH|SZ|PC|Y)");
|
||||||
|
|
||||||
protected Line parseLineAndType(final String lineAndType) {
|
protected Line parseLineAndType(final String lineAndType) {
|
||||||
|
@ -3001,8 +3001,10 @@ public abstract class AbstractHafasLegacyProvider extends AbstractHafasProvider
|
||||||
if (type.length() == 0) {
|
if (type.length() == 0) {
|
||||||
if (number.length() == 0)
|
if (number.length() == 0)
|
||||||
return newLine(null, null, null);
|
return newLine(null, null, null);
|
||||||
if (P_NORMALIZE_LINE_NUMBER.matcher(number).matches())
|
if (P_LINE_NUMBER.matcher(number).matches())
|
||||||
return newLine(null, number, null);
|
return newLine(null, number, null);
|
||||||
|
if (P_LINE_SUBWAY.matcher(number).matches())
|
||||||
|
return newLine(Product.SUBWAY, number, null);
|
||||||
if (P_LINE_RUSSIA.matcher(number).matches())
|
if (P_LINE_RUSSIA.matcher(number).matches())
|
||||||
return newLine(Product.REGIONAL_TRAIN, number, null);
|
return newLine(Product.REGIONAL_TRAIN, number, null);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue