mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-07 02:48:47 +00:00
AbstractHafasClientInterfaceProvider: Extract section types as constants.
This commit is contained in:
parent
07a88f442f
commit
4843ef0cf8
1 changed files with 7 additions and 3 deletions
|
@ -104,6 +104,10 @@ public abstract class AbstractHafasClientInterfaceProvider extends AbstractHafas
|
|||
private byte[] requestMicMacSalt;
|
||||
|
||||
private static final String SERVER_PRODUCT = "hci";
|
||||
private static final String SECTION_TYPE_JOURNEY = "JNY";
|
||||
private static final String SECTION_TYPE_WALK = "WALK";
|
||||
private static final String SECTION_TYPE_TRANSFER = "TRSF";
|
||||
private static final String SECTION_TYPE_DEVI = "DEVI";
|
||||
@SuppressWarnings("deprecation")
|
||||
private static final HashFunction MD5 = Hashing.md5();
|
||||
private static final BaseEncoding HEX = BaseEncoding.base16().lowerCase();
|
||||
|
@ -661,7 +665,7 @@ public abstract class AbstractHafasClientInterfaceProvider extends AbstractHafas
|
|||
final Stop arrivalStop = parseJsonStop(secArr, locList, crdSysList, c, baseDate);
|
||||
|
||||
final Trip.Leg leg;
|
||||
if ("JNY".equals(secType)) {
|
||||
if (SECTION_TYPE_JOURNEY.equals(secType)) {
|
||||
final JSONObject jny = sec.getJSONObject("jny");
|
||||
final Line line = lines.get(jny.getInt("prodX"));
|
||||
final String dirTxt = jny.optString("dirTxt", null);
|
||||
|
@ -722,11 +726,11 @@ public abstract class AbstractHafasClientInterfaceProvider extends AbstractHafas
|
|||
|
||||
leg = new Trip.Public(line, destination, departureStop, arrivalStop, intermediateStops, path,
|
||||
message);
|
||||
} else if ("DEVI".equals(secType)) {
|
||||
} else if (SECTION_TYPE_DEVI.equals(secType)) {
|
||||
leg = new Trip.Individual(Trip.Individual.Type.TRANSFER, departureStop.location,
|
||||
departureStop.getDepartureTime(), arrivalStop.location, arrivalStop.getArrivalTime(),
|
||||
null, 0);
|
||||
} else if ("WALK".equals(secType) || "TRSF".equals(secType)) {
|
||||
} else if (SECTION_TYPE_WALK.equals(secType) || SECTION_TYPE_TRANSFER.equals(secType)) {
|
||||
final JSONObject gis = sec.getJSONObject("gis");
|
||||
final int distance = gis.optInt("dist", 0);
|
||||
leg = new Trip.Individual(Trip.Individual.Type.WALK, departureStop.location,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue