mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-21 01:39:51 +00:00
Migrate from using char as a product type to Product enum. Line labels are really just the label and can be null.
This commit is contained in:
parent
7cb4e8fb06
commit
883015177e
52 changed files with 1216 additions and 1238 deletions
|
@ -42,26 +42,26 @@ public class LuProvider extends AbstractHafasProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
protected char intToProduct(final int value)
|
||||
protected Product intToProduct(final int value)
|
||||
{
|
||||
if (value == 1)
|
||||
return 'I';
|
||||
return Product.HIGH_SPEED_TRAIN;
|
||||
if (value == 2)
|
||||
return 'I';
|
||||
return Product.HIGH_SPEED_TRAIN;
|
||||
if (value == 4)
|
||||
return 'I';
|
||||
return Product.HIGH_SPEED_TRAIN;
|
||||
if (value == 8)
|
||||
return 'R';
|
||||
return Product.REGIONAL_TRAIN;
|
||||
if (value == 16)
|
||||
return 'S';
|
||||
return Product.SUBURBAN_TRAIN;
|
||||
if (value == 32)
|
||||
return 'B';
|
||||
return Product.BUS;
|
||||
if (value == 64)
|
||||
return 'B';
|
||||
return Product.BUS;
|
||||
if (value == 128)
|
||||
return 'B';
|
||||
return Product.BUS;
|
||||
if (value == 256)
|
||||
return 'B';
|
||||
return Product.BUS;
|
||||
|
||||
throw new IllegalArgumentException("cannot handle: " + value);
|
||||
}
|
||||
|
@ -132,26 +132,22 @@ public class LuProvider extends AbstractHafasProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
protected char normalizeType(final String type)
|
||||
protected Product normalizeType(final String type)
|
||||
{
|
||||
final String ucType = type.toUpperCase();
|
||||
|
||||
if ("CRE".equals(ucType))
|
||||
return 'R';
|
||||
return Product.REGIONAL_TRAIN;
|
||||
|
||||
if ("CITYBUS".equals(ucType))
|
||||
return 'B';
|
||||
return Product.BUS;
|
||||
if ("NIGHTBUS".equals(ucType))
|
||||
return 'B';
|
||||
return Product.BUS;
|
||||
if ("DIFFBUS".equals(ucType))
|
||||
return 'B';
|
||||
return Product.BUS;
|
||||
if ("NAVETTE".equals(ucType))
|
||||
return 'B';
|
||||
return Product.BUS;
|
||||
|
||||
final char t = super.normalizeType(type);
|
||||
if (t != 0)
|
||||
return t;
|
||||
|
||||
return 0;
|
||||
return super.normalizeType(type);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue