mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-19 08:49:58 +00:00
Migrate location IDs from int to String.
This commit is contained in:
parent
069686c746
commit
d8f3dcaf6c
111 changed files with 678 additions and 677 deletions
|
@ -328,13 +328,13 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
|
|||
}
|
||||
|
||||
if ("stop".equals(type))
|
||||
return new Location(LocationType.STATION, stop.getInt("stateless"), lat, lon, place, name);
|
||||
return new Location(LocationType.STATION, stop.getString("stateless"), lat, lon, place, name);
|
||||
else if ("poi".equals(type))
|
||||
return new Location(LocationType.POI, 0, lat, lon, place, name);
|
||||
return new Location(LocationType.POI, null, lat, lon, place, name);
|
||||
else if ("crossing".equals(type))
|
||||
return new Location(LocationType.ADDRESS, 0, lat, lon, place, name);
|
||||
return new Location(LocationType.ADDRESS, null, lat, lon, place, name);
|
||||
else if ("street".equals(type) || "address".equals(type) || "singlehouse".equals(type) || "buildingname".equals(type))
|
||||
return new Location(LocationType.ADDRESS, 0, lat, lon, place, normalizeLocationName(stop.getString("name")));
|
||||
return new Location(LocationType.ADDRESS, null, lat, lon, place, normalizeLocationName(stop.getString("name")));
|
||||
else
|
||||
throw new JSONException("unknown type: " + type);
|
||||
}
|
||||
|
@ -536,7 +536,7 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
|
|||
|
||||
XmlPullUtil.enter(pp, "r");
|
||||
|
||||
final int id = Integer.parseInt(requireValueTag(pp, "id"));
|
||||
final String id = requireValueTag(pp, "id");
|
||||
requireValueTag(pp, "stateless");
|
||||
requireValueTag(pp, "omc");
|
||||
final String place = normalizeLocationName(optValueTag(pp, "pc"));
|
||||
|
@ -550,7 +550,7 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
|
|||
|
||||
XmlPullUtil.exit(pp, "p");
|
||||
|
||||
final Location location = new Location(type, type == LocationType.STATION ? id : 0, coord != null ? coord.lat : 0,
|
||||
final Location location = new Location(type, type == LocationType.STATION ? id : null, coord != null ? coord.lat : 0,
|
||||
coord != null ? coord.lon : 0, place, name);
|
||||
final LocationAndQuality locationAndQuality = new LocationAndQuality(location, quality);
|
||||
locations.add(locationAndQuality);
|
||||
|
@ -634,7 +634,7 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
|
|||
if (!"STOP".equals(pp.getAttributeValue(null, "type")))
|
||||
throw new RuntimeException("unknown type");
|
||||
|
||||
final int id = XmlPullUtil.intAttr(pp, "id");
|
||||
final String id = XmlPullUtil.attr(pp, "id");
|
||||
final String name = normalizeLocationName(XmlPullUtil.optAttr(pp, "name", null));
|
||||
final String place = normalizeLocationName(XmlPullUtil.attr(pp, "locality"));
|
||||
|
||||
|
@ -704,7 +704,7 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
|
|||
if (!"STOP".equals(type))
|
||||
throw new RuntimeException("unknown type");
|
||||
|
||||
final int id = Integer.parseInt(requireValueTag(pp, "id"));
|
||||
final String id = requireValueTag(pp, "id");
|
||||
requireValueTag(pp, "omc");
|
||||
requireValueTag(pp, "pid");
|
||||
final String place = normalizeLocationName(requireValueTag(pp, "locality"));
|
||||
|
@ -738,7 +738,7 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
|
|||
|
||||
public List<Location> autocompleteStations(final CharSequence constraint) throws IOException
|
||||
{
|
||||
return jsonStopfinderRequest(new Location(LocationType.ANY, 0, null, constraint.toString()));
|
||||
return jsonStopfinderRequest(new Location(LocationType.ANY, null, null, constraint.toString()));
|
||||
}
|
||||
|
||||
private String processItdOdvPlace(final XmlPullParser pp) throws XmlPullParserException, IOException
|
||||
|
@ -804,35 +804,35 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
|
|||
}
|
||||
|
||||
final LocationType type;
|
||||
final int id;
|
||||
final String id;
|
||||
final String place;
|
||||
final String name;
|
||||
|
||||
if ("stop".equals(anyType))
|
||||
{
|
||||
type = LocationType.STATION;
|
||||
id = Integer.parseInt(idStr);
|
||||
id = idStr;
|
||||
place = locality;
|
||||
name = objectName;
|
||||
}
|
||||
else if ("poi".equals(anyType) || "poiHierarchy".equals(anyType))
|
||||
{
|
||||
type = LocationType.POI;
|
||||
id = Integer.parseInt(idStr);
|
||||
id = idStr;
|
||||
place = locality;
|
||||
name = objectName;
|
||||
}
|
||||
else if ("loc".equals(anyType))
|
||||
{
|
||||
type = LocationType.ANY;
|
||||
id = 0;
|
||||
id = null;
|
||||
place = locality;
|
||||
name = locality;
|
||||
}
|
||||
else if ("address".equals(anyType))
|
||||
{
|
||||
type = LocationType.ADDRESS;
|
||||
id = 0;
|
||||
id = null;
|
||||
place = locality;
|
||||
name = objectName;
|
||||
}
|
||||
|
@ -840,7 +840,7 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
|
|||
|| "buildingname".equals(anyType))
|
||||
{
|
||||
type = LocationType.ADDRESS;
|
||||
id = 0;
|
||||
id = null;
|
||||
place = locality;
|
||||
name = objectName;
|
||||
}
|
||||
|
@ -849,22 +849,22 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
|
|||
if (stopIdStr != null)
|
||||
{
|
||||
type = LocationType.STATION;
|
||||
id = Integer.parseInt(stopIdStr);
|
||||
id = stopIdStr;
|
||||
}
|
||||
else if (poiIdStr != null)
|
||||
{
|
||||
type = LocationType.POI;
|
||||
id = Integer.parseInt(poiIdStr);
|
||||
id = poiIdStr;
|
||||
}
|
||||
else if (streetIdStr != null)
|
||||
{
|
||||
type = LocationType.ADDRESS;
|
||||
id = Integer.parseInt(streetIdStr);
|
||||
id = streetIdStr;
|
||||
}
|
||||
else if (lat != 0 || lon != 0)
|
||||
{
|
||||
type = LocationType.ADDRESS;
|
||||
id = 0;
|
||||
id = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -884,7 +884,7 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
|
|||
|
||||
private Location processItdOdvAssignedStop(final XmlPullParser pp) throws XmlPullParserException, IOException
|
||||
{
|
||||
final int id = Integer.parseInt(pp.getAttributeValue(null, "stopID"));
|
||||
final String id = pp.getAttributeValue(null, "stopID");
|
||||
|
||||
final String mapName = XmlPullUtil.optAttr(pp, "mapName", null);
|
||||
final float x = XmlPullUtil.optFloatAttr(pp, "x", 0);
|
||||
|
@ -930,7 +930,7 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
|
|||
return nearbyStationsRequest(location.id, maxStations);
|
||||
}
|
||||
|
||||
private NearbyStationsResult nearbyStationsRequest(final int stationId, final int maxStations) throws IOException
|
||||
private NearbyStationsResult nearbyStationsRequest(final String stationId, final int maxStations) throws IOException
|
||||
{
|
||||
final StringBuilder parameters = new StringBuilder();
|
||||
appendCommonRequestParams(parameters, "XML");
|
||||
|
@ -1442,7 +1442,7 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
|
|||
+ "' trainType='" + trainType + "' trainNum='" + trainNum + "' trainName='" + trainName + "'");
|
||||
}
|
||||
|
||||
protected StringBuilder queryDeparturesParameters(final int stationId, final int maxDepartures, final boolean equivs)
|
||||
protected StringBuilder queryDeparturesParameters(final String stationId, final int maxDepartures, final boolean equivs)
|
||||
{
|
||||
final StringBuilder parameters = new StringBuilder();
|
||||
appendCommonRequestParams(parameters, "XML");
|
||||
|
@ -1460,7 +1460,7 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
|
|||
return parameters;
|
||||
}
|
||||
|
||||
public QueryDeparturesResult queryDepartures(final int stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
public QueryDeparturesResult queryDepartures(final String stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
{
|
||||
final StringBuilder parameters = queryDeparturesParameters(stationId, maxDepartures, equivs);
|
||||
|
||||
|
@ -1539,18 +1539,15 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
|
|||
XmlPullUtil.enter(pp, "itdServingLines");
|
||||
while (XmlPullUtil.test(pp, "itdServingLine"))
|
||||
{
|
||||
final String assignedStopIdStr = pp.getAttributeValue(null, "assignedStopID");
|
||||
final int assignedStopId = assignedStopIdStr != null ? Integer.parseInt(assignedStopIdStr) : 0;
|
||||
final String assignedStopId = pp.getAttributeValue(null, "assignedStopID");
|
||||
final String destinationName = normalizeLocationName(pp.getAttributeValue(null, "direction"));
|
||||
final String destinationIdStr = pp.getAttributeValue(null, "destID");
|
||||
final int destinationId = (destinationIdStr != null && destinationIdStr.length() > 0) ? Integer.parseInt(destinationIdStr)
|
||||
: 0;
|
||||
final Location destination = new Location(destinationId > 0 ? LocationType.STATION : LocationType.ANY,
|
||||
destinationId > 0 ? destinationId : 0, null, destinationName);
|
||||
final String destinationId = XmlPullUtil.optAttr(pp, "destID", null);
|
||||
final Location destination = new Location(destinationId != null ? LocationType.STATION : LocationType.ANY, destinationId,
|
||||
null, destinationName);
|
||||
final LineDestination line = new LineDestination(processItdServingLine(pp), destination);
|
||||
|
||||
StationDepartures assignedStationDepartures;
|
||||
if (assignedStopId == 0)
|
||||
if (assignedStopId == null)
|
||||
assignedStationDepartures = result.stationDepartures.get(0);
|
||||
else
|
||||
assignedStationDepartures = findStationDepartures(result.stationDepartures, assignedStopId);
|
||||
|
@ -1575,7 +1572,7 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
|
|||
XmlPullUtil.enter(pp, "itdDepartureList");
|
||||
while (XmlPullUtil.test(pp, "itdDeparture"))
|
||||
{
|
||||
final int assignedStopId = XmlPullUtil.intAttr(pp, "stopID");
|
||||
final String assignedStopId = XmlPullUtil.attr(pp, "stopID");
|
||||
|
||||
StationDepartures assignedStationDepartures = findStationDepartures(result.stationDepartures, assignedStopId);
|
||||
if (assignedStationDepartures == null)
|
||||
|
@ -1625,10 +1622,10 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
|
|||
XmlPullUtil.require(pp, "itdServingLine");
|
||||
final boolean isRealtime = pp.getAttributeValue(null, "realtime").equals("1");
|
||||
final String destinationName = normalizeLocationName(pp.getAttributeValue(null, "direction"));
|
||||
final String destinationIdStr = pp.getAttributeValue(null, "destID");
|
||||
final int destinationId = destinationIdStr != null ? Integer.parseInt(destinationIdStr) : 0;
|
||||
final Location destination = new Location(destinationId > 0 ? LocationType.STATION : LocationType.ANY,
|
||||
destinationId > 0 ? destinationId : 0, null, destinationName);
|
||||
final String destinationIdStr = XmlPullUtil.optAttr(pp, "destID", null);
|
||||
final String destinationId = !"-1".equals(destinationIdStr) ? destinationIdStr : null;
|
||||
final Location destination = new Location(destinationId != null ? LocationType.STATION : LocationType.ANY, destinationId,
|
||||
null, destinationName);
|
||||
final Line line = processItdServingLine(pp);
|
||||
|
||||
if (isRealtime && !predictedDepartureTime.isSet(Calendar.HOUR_OF_DAY))
|
||||
|
@ -1671,7 +1668,7 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
|
|||
}
|
||||
}
|
||||
|
||||
protected QueryDeparturesResult queryDeparturesMobile(final int stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
protected QueryDeparturesResult queryDeparturesMobile(final String stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
{
|
||||
final StringBuilder parameters = queryDeparturesParameters(stationId, maxDepartures, equivs);
|
||||
|
||||
|
@ -1716,7 +1713,7 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
|
|||
final LineDestination lineDestination = parseMobileM(pp, true);
|
||||
|
||||
XmlPullUtil.enter(pp, "r");
|
||||
final int assignedId = Integer.parseInt(requireValueTag(pp, "id"));
|
||||
final String assignedId = requireValueTag(pp, "id");
|
||||
requireValueTag(pp, "a");
|
||||
final Position position = new Position(optValueTag(pp, "pl"));
|
||||
XmlPullUtil.exit(pp, "r");
|
||||
|
@ -1792,7 +1789,7 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
|
|||
final String co = requireValueTag(pp, "co");
|
||||
final String productType = tyOrCo ? ty : co;
|
||||
final String destinationName = normalizeLocationName(requireValueTag(pp, "des"));
|
||||
destination = new Location(LocationType.ANY, 0, null, destinationName);
|
||||
destination = new Location(LocationType.ANY, null, null, destinationName);
|
||||
optValueTag(pp, "dy");
|
||||
final String de = optValueTag(pp, "de");
|
||||
final String productName = n != null ? n : de;
|
||||
|
@ -1857,10 +1854,10 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
|
|||
XmlPullUtil.exit(pp, "st");
|
||||
}
|
||||
|
||||
private StationDepartures findStationDepartures(final List<StationDepartures> stationDepartures, final int id)
|
||||
private StationDepartures findStationDepartures(final List<StationDepartures> stationDepartures, final String id)
|
||||
{
|
||||
for (final StationDepartures stationDeparture : stationDepartures)
|
||||
if (stationDeparture.location.id == id)
|
||||
if (stationDeparture.location.id.equals(id))
|
||||
return stationDeparture;
|
||||
|
||||
return null;
|
||||
|
@ -1868,7 +1865,7 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
|
|||
|
||||
private Location processItdPointAttributes(final XmlPullParser pp)
|
||||
{
|
||||
final int id = Integer.parseInt(pp.getAttributeValue(null, "stopID"));
|
||||
final String id = pp.getAttributeValue(null, "stopID");
|
||||
|
||||
String place = normalizeLocationName(pp.getAttributeValue(null, "locality"));
|
||||
if (place == null)
|
||||
|
@ -2550,11 +2547,9 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
|
|||
else if ("PT".equals(partialRouteType))
|
||||
{
|
||||
final String destinationName = normalizeLocationName(pp.getAttributeValue(null, "destination"));
|
||||
final String destinationIdStr = pp.getAttributeValue(null, "destID");
|
||||
final int destinationId = (destinationIdStr != null && destinationIdStr.length() > 0) ? Integer.parseInt(destinationIdStr)
|
||||
: 0;
|
||||
final Location destination = new Location(destinationId > 0 ? LocationType.STATION : LocationType.ANY,
|
||||
destinationId > 0 ? destinationId : 0, null, destinationName);
|
||||
final String destinationId = XmlPullUtil.optAttr(pp, "destID", null);
|
||||
final Location destination = new Location(destinationId != null ? LocationType.STATION : LocationType.ANY, destinationId,
|
||||
null, destinationName);
|
||||
final String lineLabel;
|
||||
final String motSymbol = pp.getAttributeValue(null, "symbol");
|
||||
if ("AST".equals(motSymbol))
|
||||
|
@ -2696,11 +2691,11 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
|
|||
final int size = intermediateStops.size();
|
||||
if (size >= 2)
|
||||
{
|
||||
if (intermediateStops.get(size - 1).location.id != arrivalLocation.id)
|
||||
if (!intermediateStops.get(size - 1).location.id.equals(arrivalLocation.id))
|
||||
throw new IllegalStateException();
|
||||
intermediateStops.remove(size - 1);
|
||||
|
||||
if (intermediateStops.get(0).location.id != departureLocation.id)
|
||||
if (!intermediateStops.get(0).location.id.equals(departureLocation.id))
|
||||
throw new IllegalStateException();
|
||||
intermediateStops.remove(0);
|
||||
}
|
||||
|
@ -2898,7 +2893,7 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
|
|||
XmlPullUtil.requireSkip(pp, "lis");
|
||||
|
||||
XmlPullUtil.enter(pp, "r");
|
||||
final int id = Integer.parseInt(requireValueTag(pp, "id"));
|
||||
final String id = requireValueTag(pp, "id");
|
||||
optValueTag(pp, "a");
|
||||
final Position position = new Position(optValueTag(pp, "pl"));
|
||||
final String place = normalizeLocationName(optValueTag(pp, "pc"));
|
||||
|
@ -2906,8 +2901,8 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
|
|||
XmlPullUtil.exit(pp, "r");
|
||||
|
||||
final Location location;
|
||||
if (id == 99999997 || id == 99999998)
|
||||
location = new Location(LocationType.ADDRESS, 0, coord.lat, coord.lon, place, name);
|
||||
if (id.equals("99999997") || id.equals("99999998"))
|
||||
location = new Location(LocationType.ADDRESS, null, coord.lat, coord.lon, place, name);
|
||||
else
|
||||
location = new Location(LocationType.STATION, id, coord.lat, coord.lon, place, name);
|
||||
|
||||
|
@ -2963,8 +2958,8 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
|
|||
|
||||
final String s = requireValueTag(pp, "s");
|
||||
final String[] intermediateParts = s.split(";");
|
||||
final int id = Integer.parseInt(intermediateParts[0]);
|
||||
if (id != departure.location.id && id != arrival.location.id)
|
||||
final String id = intermediateParts[0];
|
||||
if (!id.equals(departure.location.id) && !id.equals(arrival.location.id))
|
||||
{
|
||||
final String name = normalizeLocationName(intermediateParts[1]);
|
||||
|
||||
|
@ -3303,7 +3298,7 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
|
|||
protected static final String locationValue(final Location location)
|
||||
{
|
||||
if ((location.type == LocationType.STATION || location.type == LocationType.POI) && location.hasId())
|
||||
return Integer.toString(location.id);
|
||||
return location.id;
|
||||
else
|
||||
return location.name;
|
||||
}
|
||||
|
|
|
@ -251,7 +251,7 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
if ("Station".equals(type))
|
||||
{
|
||||
final String name = pp.getAttributeValue(null, "name").trim();
|
||||
final int id = Integer.parseInt(pp.getAttributeValue(null, "externalStationNr"));
|
||||
final String id = pp.getAttributeValue(null, "externalStationNr");
|
||||
final int x = Integer.parseInt(pp.getAttributeValue(null, "x"));
|
||||
final int y = Integer.parseInt(pp.getAttributeValue(null, "y"));
|
||||
|
||||
|
@ -271,7 +271,7 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
name = null;
|
||||
final int x = Integer.parseInt(pp.getAttributeValue(null, "x"));
|
||||
final int y = Integer.parseInt(pp.getAttributeValue(null, "y"));
|
||||
return new Location(LocationType.POI, 0, y, x, null, name);
|
||||
return new Location(LocationType.POI, null, y, x, null, name);
|
||||
}
|
||||
throw new IllegalStateException("cannot handle: " + type);
|
||||
}
|
||||
|
@ -288,7 +288,7 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
final int y = Integer.parseInt(pp.getAttributeValue(null, "y"));
|
||||
|
||||
final String[] placeAndName = splitPlaceAndName(name);
|
||||
return new Location(LocationType.ADDRESS, 0, y, x, placeAndName[0], placeAndName[1]);
|
||||
return new Location(LocationType.ADDRESS, null, y, x, placeAndName[0], placeAndName[1]);
|
||||
}
|
||||
throw new IllegalStateException("cannot handle: " + type);
|
||||
}
|
||||
|
@ -300,7 +300,7 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
{
|
||||
XmlPullUtil.requireAttr(pp, "type", "ADR");
|
||||
final String name = pp.getAttributeValue(null, "output").trim();
|
||||
return new Location(LocationType.ADDRESS, 0, null, name);
|
||||
return new Location(LocationType.ADDRESS, null, null, name);
|
||||
}
|
||||
throw new IllegalStateException("cannot handle: " + type);
|
||||
}
|
||||
|
@ -357,10 +357,10 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
final String value = suggestion.getString("value");
|
||||
final int lat = suggestion.optInt("ycoord");
|
||||
final int lon = suggestion.optInt("xcoord");
|
||||
int localId = 0;
|
||||
String localId = null;
|
||||
final Matcher m = P_AJAX_GET_STOPS_ID.matcher(suggestion.getString("id"));
|
||||
if (m.matches())
|
||||
localId = Integer.parseInt(m.group(1));
|
||||
localId = m.group(1);
|
||||
|
||||
if (type == 1) // station
|
||||
{
|
||||
|
@ -370,7 +370,7 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
else if (type == 2) // address
|
||||
{
|
||||
final String[] placeAndName = splitPlaceAndName(value);
|
||||
results.add(new Location(LocationType.ADDRESS, 0, lat, lon, placeAndName[0], placeAndName[1]));
|
||||
results.add(new Location(LocationType.ADDRESS, null, lat, lon, placeAndName[0], placeAndName[1]));
|
||||
}
|
||||
else if (type == 4) // poi
|
||||
{
|
||||
|
@ -436,7 +436,7 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
|
||||
if (XmlPullUtil.test(pp, "StopLocation"))
|
||||
{
|
||||
final int id = XmlPullUtil.intAttr(pp, "id");
|
||||
final String id = XmlPullUtil.attr(pp, "id");
|
||||
final String[] placeAndName = splitPlaceAndName(name);
|
||||
results.add(new Location(LocationType.STATION, id, lat, lon, placeAndName[0], placeAndName[1]));
|
||||
}
|
||||
|
@ -444,9 +444,9 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
{
|
||||
final String type = XmlPullUtil.attr(pp, "type");
|
||||
if ("POI".equals(type))
|
||||
results.add(new Location(LocationType.POI, 0, lat, lon, null, name));
|
||||
results.add(new Location(LocationType.POI, null, lat, lon, null, name));
|
||||
else if ("ADR".equals(type))
|
||||
results.add(new Location(LocationType.ADDRESS, 0, lat, lon, null, name));
|
||||
results.add(new Location(LocationType.ADDRESS, null, lat, lon, null, name));
|
||||
else
|
||||
throw new IllegalStateException("unknown type " + type + " on " + uri);
|
||||
}
|
||||
|
@ -514,18 +514,18 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
else
|
||||
throw new IllegalStateException("cannot handle: '" + t + "'");
|
||||
|
||||
final int id;
|
||||
final String id;
|
||||
final String i = pp.getAttributeValue(null, "i");
|
||||
if (i != null)
|
||||
{
|
||||
final Matcher iMatcherId = P_XML_MLC_REQ_ID.matcher(i);
|
||||
if (!iMatcherId.matches())
|
||||
throw new IllegalStateException("cannot parse id: '" + i + "'");
|
||||
id = Integer.parseInt(iMatcherId.group(1));
|
||||
id = iMatcherId.group(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
id = 0;
|
||||
id = null;
|
||||
}
|
||||
|
||||
final String name = XmlPullUtil.attr(pp, "n");
|
||||
|
@ -569,7 +569,7 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
}
|
||||
}
|
||||
|
||||
protected StringBuilder xmlQueryDeparturesParameters(final int stationId)
|
||||
protected StringBuilder xmlQueryDeparturesParameters(final String stationId)
|
||||
{
|
||||
final StringBuilder parameters = new StringBuilder();
|
||||
parameters.append("?productsFilter=").append(allProductsString());
|
||||
|
@ -588,7 +588,7 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
|
||||
private static final Pattern P_XML_QUERY_DEPARTURES_DELAY = Pattern.compile("(?:-|k\\.A\\.?|cancel|\\+?\\s*(\\d+))");
|
||||
|
||||
protected QueryDeparturesResult xmlQueryDepartures(final String uri, final int stationId) throws IOException
|
||||
protected QueryDeparturesResult xmlQueryDepartures(final String uri, final String stationId) throws IOException
|
||||
{
|
||||
StringReplaceReader reader = null;
|
||||
|
||||
|
@ -717,13 +717,13 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
else
|
||||
destinationPlaceAndName = null;
|
||||
|
||||
final int destinationId;
|
||||
final String destinationId;
|
||||
if (dirnr != null)
|
||||
destinationId = Integer.parseInt(dirnr);
|
||||
destinationId = dirnr;
|
||||
else
|
||||
destinationId = 0;
|
||||
destinationId = null;
|
||||
|
||||
final Location destination = new Location(destinationId > 0 ? LocationType.STATION : LocationType.ANY, destinationId,
|
||||
final Location destination = new Location(destinationId != null ? LocationType.STATION : LocationType.ANY, destinationId,
|
||||
destinationPlaceAndName != null ? destinationPlaceAndName[0] : null,
|
||||
destinationPlaceAndName != null ? destinationPlaceAndName[1] : null);
|
||||
|
||||
|
@ -1196,7 +1196,7 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
else if ("DIRECTION".equals(attrName))
|
||||
{
|
||||
final String[] destinationPlaceAndName = splitPlaceAndName(attributeVariants.get("NORMAL"));
|
||||
destination = new Location(LocationType.ANY, 0, destinationPlaceAndName[0], destinationPlaceAndName[1]);
|
||||
destination = new Location(LocationType.ANY, null, destinationPlaceAndName[0], destinationPlaceAndName[1]);
|
||||
}
|
||||
}
|
||||
XmlPullUtil.exit(pp, "JourneyAttributeList");
|
||||
|
@ -1311,7 +1311,7 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
// remove last intermediate
|
||||
final int size = intermediateStops != null ? intermediateStops.size() : 0;
|
||||
if (size >= 1)
|
||||
if (intermediateStops.get(size - 1).location.id == sectionArrivalLocation.id)
|
||||
if (!intermediateStops.get(size - 1).location.id.equals(sectionArrivalLocation.id))
|
||||
intermediateStops.remove(size - 1);
|
||||
|
||||
XmlPullUtil.exit(pp, "ConSection");
|
||||
|
@ -1492,7 +1492,7 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
throw new IllegalArgumentException(location.type.toString());
|
||||
}
|
||||
|
||||
protected boolean isValidStationId(int id)
|
||||
protected boolean isValidStationId(final String id)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -1950,7 +1950,7 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
if (directionStr != null)
|
||||
{
|
||||
final String[] directionPlaceAndName = splitPlaceAndName(directionStr);
|
||||
direction = new Location(LocationType.ANY, 0, directionPlaceAndName[0], directionPlaceAndName[1]);
|
||||
direction = new Location(LocationType.ANY, null, directionPlaceAndName[0], directionPlaceAndName[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2056,7 +2056,7 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
final int lon = is.readIntReverse();
|
||||
final int lat = is.readIntReverse();
|
||||
|
||||
return new Location(locationType, 0, lat, lon, placeAndName[0], placeAndName[1]);
|
||||
return new Location(locationType, null, lat, lon, placeAndName[0], placeAndName[1]);
|
||||
}
|
||||
|
||||
private long date(final LittleEndianDataInputStream is) throws IOException
|
||||
|
@ -2214,7 +2214,7 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
final int lon = stationInputStream.readIntReverse();
|
||||
final int lat = stationInputStream.readIntReverse();
|
||||
|
||||
return new Location(LocationType.STATION, id, lat, lon, placeAndName[0], placeAndName[1]);
|
||||
return new Location(LocationType.STATION, id != 0 ? Integer.toString(id) : null, lat, lon, placeAndName[0], placeAndName[1]);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -2237,7 +2237,7 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
return new Position(m.group(1));
|
||||
}
|
||||
|
||||
protected final StringBuilder xmlNearbyStationsParameters(final int stationId)
|
||||
protected final StringBuilder xmlNearbyStationsParameters(final String stationId)
|
||||
{
|
||||
final StringBuilder parameters = new StringBuilder();
|
||||
parameters.append("?productsFilter=").append(allProductsString());
|
||||
|
@ -2286,7 +2286,7 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
final Matcher mFine = P_XML_NEARBY_STATIONS_FINE.matcher(mCoarse.group(1));
|
||||
if (mFine.matches())
|
||||
{
|
||||
final int parsedId = Integer.parseInt(mFine.group(1));
|
||||
final String parsedId = mFine.group(1);
|
||||
|
||||
final String parsedName = ParserUtils.resolveEntities(mFine.group(2)).trim();
|
||||
|
||||
|
@ -2348,7 +2348,7 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
for (int i = 0; i < nStops; i++)
|
||||
{
|
||||
final JSONObject stop = aStops.optJSONObject(i);
|
||||
final int id = stop.getInt("extId");
|
||||
final String id = stop.getString("extId");
|
||||
final String name = ParserUtils.resolveEntities(stop.getString("name"));
|
||||
final int lat = stop.getInt("y");
|
||||
final int lon = stop.getInt("x");
|
||||
|
@ -2407,7 +2407,7 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
{
|
||||
int parsedLon = 0;
|
||||
int parsedLat = 0;
|
||||
final int parsedId = Integer.parseInt(mFineLocation.group(1));
|
||||
final String parsedId = mFineLocation.group(1);
|
||||
final String parsedName = ParserUtils.resolveEntities(mFineLocation.group(2));
|
||||
|
||||
final Matcher mFineCoords = P_NEARBY_FINE_COORDS.matcher(mCoarse.group(2));
|
||||
|
|
|
@ -317,7 +317,7 @@ public abstract class AbstractTsiProvider extends AbstractNetworkProvider
|
|||
return json.isNull(key) ? null : json.getString(key);
|
||||
}
|
||||
|
||||
private Location jsonStationRequestCoord(final int id) throws IOException
|
||||
private Location jsonStationRequestCoord(final String id) throws IOException
|
||||
{
|
||||
final StringBuilder parameters = buildCommonRequestParams("GetTripPoint", "json");
|
||||
parameters.append("&TripPointId=").append(id);
|
||||
|
@ -417,24 +417,24 @@ public abstract class AbstractTsiProvider extends AbstractNetworkProvider
|
|||
{
|
||||
final String locTypeStr = data.getString("Type");
|
||||
final LocationType locType;
|
||||
final int id;
|
||||
final String id;
|
||||
|
||||
if ("POI".equals(locTypeStr))
|
||||
{
|
||||
locType = LocationType.POI;
|
||||
id = data.getInt("id");
|
||||
id = data.getString("id");
|
||||
}
|
||||
else if ("BOARDING_POSITION".equals(locTypeStr))
|
||||
{
|
||||
locType = LocationType.STATION;
|
||||
if (!data.isNull("LogicalId"))
|
||||
id = data.getInt("LogicalId");
|
||||
id = data.getString("LogicalId");
|
||||
else
|
||||
id = data.getInt("id");
|
||||
id = data.getString("id");
|
||||
}
|
||||
else
|
||||
{
|
||||
id = data.optInt("id", 0);
|
||||
id = data.optString("id");
|
||||
locType = LocationType.ADDRESS;
|
||||
}
|
||||
|
||||
|
@ -465,7 +465,7 @@ public abstract class AbstractTsiProvider extends AbstractNetworkProvider
|
|||
String destinationName = jsonOptString(ptrInfo, "Destination");
|
||||
if (destinationName == null && destObj != null)
|
||||
destinationName = destObj.optString("Name");
|
||||
final Location lineDestination = new Location(LocationType.ANY, 0, null, destinationName);
|
||||
final Location lineDestination = new Location(LocationType.ANY, null, null, destinationName);
|
||||
|
||||
final Stop departureStop, arrivalStop;
|
||||
|
||||
|
@ -561,7 +561,7 @@ public abstract class AbstractTsiProvider extends AbstractNetworkProvider
|
|||
|
||||
private Location parseJsonTransportLocation(final JSONObject data) throws JSONException
|
||||
{
|
||||
final int id = data.getInt("Id");
|
||||
final String id = data.getString("Id");
|
||||
final LocationType locType;
|
||||
|
||||
switch (data.getInt("PointType"))
|
||||
|
@ -592,7 +592,7 @@ public abstract class AbstractTsiProvider extends AbstractNetworkProvider
|
|||
return new Location(locType, id, latInt, lonInt, place, name);
|
||||
}
|
||||
|
||||
public QueryDeparturesResult queryDepartures(final int stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
public QueryDeparturesResult queryDepartures(final String stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
{
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
|
|
@ -53,6 +53,6 @@ public class AtcProvider extends AbstractEfaProvider
|
|||
@Override
|
||||
public List<Location> autocompleteStations(final CharSequence constraint) throws IOException
|
||||
{
|
||||
return xmlStopfinderRequest(new Location(LocationType.STATION, 0, null, constraint.toString()));
|
||||
return xmlStopfinderRequest(new Location(LocationType.STATION, null, null, constraint.toString()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -156,7 +156,7 @@ public final class BahnProvider extends AbstractHafasProvider
|
|||
}
|
||||
}
|
||||
|
||||
public QueryDeparturesResult queryDepartures(final int stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
public QueryDeparturesResult queryDepartures(final String stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
{
|
||||
final StringBuilder uri = new StringBuilder(stationBoardEndpoint);
|
||||
uri.append(xmlQueryDeparturesParameters(stationId));
|
||||
|
|
|
@ -117,7 +117,7 @@ public class BayernProvider extends AbstractEfaProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
public QueryDeparturesResult queryDepartures(final int stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
public QueryDeparturesResult queryDepartures(final String stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
{
|
||||
return queryDeparturesMobile(stationId, maxDepartures, equivs);
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ public class BayernProvider extends AbstractEfaProvider
|
|||
@Override
|
||||
public List<Location> autocompleteStations(final CharSequence constraint) throws IOException
|
||||
{
|
||||
return mobileStopfinderRequest(new Location(LocationType.ANY, 0, null, constraint.toString()));
|
||||
return mobileStopfinderRequest(new Location(LocationType.ANY, null, null, constraint.toString()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -53,6 +53,6 @@ public class BsagProvider extends AbstractEfaProvider
|
|||
@Override
|
||||
public List<Location> autocompleteStations(final CharSequence constraint) throws IOException
|
||||
{
|
||||
return xmlStopfinderRequest(new Location(LocationType.STATION, 0, null, constraint.toString()));
|
||||
return xmlStopfinderRequest(new Location(LocationType.STATION, null, null, constraint.toString()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,6 +53,6 @@ public class BvbProvider extends AbstractEfaProvider
|
|||
@Override
|
||||
public List<Location> autocompleteStations(final CharSequence constraint) throws IOException
|
||||
{
|
||||
return xmlStopfinderRequest(new Location(LocationType.STATION, 0, null, constraint.toString()));
|
||||
return xmlStopfinderRequest(new Location(LocationType.STATION, null, null, constraint.toString()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -210,7 +210,7 @@ public final class BvgProvider extends AbstractHafasProvider
|
|||
final Matcher mOwn = P_NEARBY_OWN.matcher(page);
|
||||
if (mOwn.find())
|
||||
{
|
||||
final int parsedId = Integer.parseInt(mOwn.group(1));
|
||||
final String parsedId = mOwn.group(1);
|
||||
final int parsedLon = (int) (Float.parseFloat(mOwn.group(2)) * 1E6);
|
||||
final int parsedLat = (int) (Float.parseFloat(mOwn.group(3)) * 1E6);
|
||||
final String[] parsedPlaceAndName = splitPlaceAndName(ParserUtils.urlDecode(mOwn.group(4), ISO_8859_1));
|
||||
|
@ -228,7 +228,7 @@ public final class BvgProvider extends AbstractHafasProvider
|
|||
|
||||
if (mFineLocation.find())
|
||||
{
|
||||
final int parsedId = Integer.parseInt(mFineLocation.group(1));
|
||||
final String parsedId = mFineLocation.group(1);
|
||||
final String[] parsedPlaceAndName = splitPlaceAndName(ParserUtils.resolveEntities(mFineLocation.group(2)));
|
||||
final Location station = new Location(LocationType.STATION, parsedId, parsedPlaceAndName[0], parsedPlaceAndName[1]);
|
||||
if (!stations.contains(station))
|
||||
|
@ -258,7 +258,7 @@ public final class BvgProvider extends AbstractHafasProvider
|
|||
|
||||
private static final String DEPARTURE_URL_LIVE = DEPARTURE_URL + "/IstAbfahrtzeiten/index/mobil?";
|
||||
|
||||
private String departuresQueryLiveUri(final int stationId)
|
||||
private String departuresQueryLiveUri(final String stationId)
|
||||
{
|
||||
final StringBuilder uri = new StringBuilder();
|
||||
uri.append(DEPARTURE_URL_LIVE);
|
||||
|
@ -270,7 +270,7 @@ public final class BvgProvider extends AbstractHafasProvider
|
|||
|
||||
private static final String DEPARTURE_URL_PLAN = DEPARTURE_URL + "/Fahrinfo/bin/stboard.bin/dox?boardType=dep&disableEquivs=yes&start=yes";
|
||||
|
||||
private String departuresQueryPlanUri(final int stationId, final int maxDepartures)
|
||||
private String departuresQueryPlanUri(final String stationId, final int maxDepartures)
|
||||
{
|
||||
final StringBuilder uri = new StringBuilder();
|
||||
uri.append(DEPARTURE_URL_PLAN);
|
||||
|
@ -320,12 +320,12 @@ public final class BvgProvider extends AbstractHafasProvider
|
|||
private static final Pattern P_DEPARTURES_LIVE_ERRORS = Pattern.compile(
|
||||
"(Haltestelle:)|(Wartungsgründen|nur eingeschränkt)|(http-equiv=\"refresh\")", Pattern.CASE_INSENSITIVE);
|
||||
|
||||
public QueryDeparturesResult queryDepartures(final int stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
public QueryDeparturesResult queryDepartures(final String stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
{
|
||||
final ResultHeader header = new ResultHeader(SERVER_PRODUCT);
|
||||
final QueryDeparturesResult result = new QueryDeparturesResult(header);
|
||||
|
||||
if (stationId < 1000000) // live
|
||||
if (Integer.parseInt(stationId) < 1000000) // live
|
||||
{
|
||||
// scrape page
|
||||
final String uri = departuresQueryLiveUri(stationId);
|
||||
|
@ -403,7 +403,7 @@ public final class BvgProvider extends AbstractHafasProvider
|
|||
final Position position = null;
|
||||
|
||||
final String[] destinationPlaceAndName = splitPlaceAndName(ParserUtils.resolveEntities(mDepFine.group(4)));
|
||||
final Location destination = new Location(LocationType.ANY, 0, destinationPlaceAndName[0], destinationPlaceAndName[1]);
|
||||
final Location destination = new Location(LocationType.ANY, null, destinationPlaceAndName[0], destinationPlaceAndName[1]);
|
||||
|
||||
final String message = messages.get(line.label);
|
||||
|
||||
|
@ -474,9 +474,9 @@ public final class BvgProvider extends AbstractHafasProvider
|
|||
|
||||
final Position position = new Position(ParserUtils.resolveEntities(mDepFine.group(3)));
|
||||
|
||||
final int destinationId = Integer.parseInt(mDepFine.group(4));
|
||||
final String destinationId = mDepFine.group(4);
|
||||
final String[] destinationPlaceAndName = splitPlaceAndName(ParserUtils.resolveEntities(mDepFine.group(5)));
|
||||
final Location destination = new Location(destinationId > 0 ? LocationType.STATION : LocationType.ANY, destinationId,
|
||||
final Location destination = new Location(destinationId != null ? LocationType.STATION : LocationType.ANY, destinationId,
|
||||
destinationPlaceAndName[0], destinationPlaceAndName[1]);
|
||||
|
||||
final Departure dep = new Departure(plannedTime, null, line, position, destination, null, null);
|
||||
|
@ -521,9 +521,9 @@ public final class BvgProvider extends AbstractHafasProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
protected boolean isValidStationId(int id)
|
||||
protected boolean isValidStationId(final String id)
|
||||
{
|
||||
return id >= 1000000;
|
||||
return Integer.parseInt(id) >= 1000000;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -737,19 +737,21 @@ public final class BvgProvider extends AbstractHafasProvider
|
|||
return Berlin.BOUNDARY;
|
||||
}
|
||||
|
||||
public static int migrateStationIdReverse(final int stationId)
|
||||
public static String migrateStationIdReverse(final String stationIdStr)
|
||||
{
|
||||
final int stationId = Integer.parseInt(stationIdStr);
|
||||
|
||||
if (stationId < 100000000 || stationId >= 1000000000)
|
||||
return stationId;
|
||||
return stationIdStr;
|
||||
|
||||
final int low = stationId % 100000;
|
||||
final int middle = (stationId % 100000000) - low;
|
||||
|
||||
if (middle != 1000000)
|
||||
return stationId;
|
||||
return stationIdStr;
|
||||
|
||||
final int high = stationId - (stationId % 100000000);
|
||||
|
||||
return high / 1000 + low;
|
||||
return Integer.toString(high / 1000 + low);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -135,7 +135,7 @@ public class DsbProvider extends AbstractHafasProvider
|
|||
}
|
||||
}
|
||||
|
||||
public QueryDeparturesResult queryDepartures(final int stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
public QueryDeparturesResult queryDepartures(final String stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
{
|
||||
final StringBuilder uri = new StringBuilder(stationBoardEndpoint);
|
||||
uri.append(xmlQueryDeparturesParameters(stationId));
|
||||
|
|
|
@ -63,6 +63,6 @@ public class DubProvider extends AbstractEfaProvider
|
|||
@Override
|
||||
public List<Location> autocompleteStations(final CharSequence constraint) throws IOException
|
||||
{
|
||||
return xmlStopfinderRequest(new Location(LocationType.STATION, 0, null, constraint.toString()));
|
||||
return xmlStopfinderRequest(new Location(LocationType.STATION, null, null, constraint.toString()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@ public class EireannProvider extends AbstractHafasProvider
|
|||
}
|
||||
}
|
||||
|
||||
public QueryDeparturesResult queryDepartures(final int stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
public QueryDeparturesResult queryDepartures(final String stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
{
|
||||
final StringBuilder uri = new StringBuilder(stationBoardEndpoint);
|
||||
uri.append(xmlQueryDeparturesParameters(stationId));
|
||||
|
|
|
@ -113,7 +113,7 @@ public class InvgProvider extends AbstractHafasProvider
|
|||
}
|
||||
}
|
||||
|
||||
private String departuresQueryUri(final int stationId, final int maxDepartures)
|
||||
private String departuresQueryUri(final String stationId, final int maxDepartures)
|
||||
{
|
||||
final StringBuilder uri = new StringBuilder(stationBoardEndpoint);
|
||||
uri.append("?input=").append(stationId);
|
||||
|
@ -157,7 +157,7 @@ public class InvgProvider extends AbstractHafasProvider
|
|||
+ "(?:<td class=\"center sepline top\">\n(" + ParserUtils.P_PLATFORM + ").*?)?" // position
|
||||
, Pattern.DOTALL);
|
||||
|
||||
public QueryDeparturesResult queryDepartures(final int stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
public QueryDeparturesResult queryDepartures(final String stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
{
|
||||
final ResultHeader header = new ResultHeader(SERVER_PRODUCT);
|
||||
final QueryDeparturesResult result = new QueryDeparturesResult(header);
|
||||
|
@ -182,7 +182,7 @@ public class InvgProvider extends AbstractHafasProvider
|
|||
else if (mHeadCoarse.group(6) != null)
|
||||
return new QueryDeparturesResult(header, Status.SERVICE_DOWN);
|
||||
|
||||
final int locationId = Integer.parseInt(mHeadCoarse.group(2));
|
||||
final String locationId = mHeadCoarse.group(2);
|
||||
|
||||
final Matcher mHeadFine = P_DEPARTURES_HEAD_FINE.matcher(mHeadCoarse.group(1));
|
||||
if (mHeadFine.matches())
|
||||
|
@ -238,10 +238,10 @@ public class InvgProvider extends AbstractHafasProvider
|
|||
|
||||
final Line line = parseLine(lineType, ParserUtils.resolveEntities(mDepFine.group(4)), false);
|
||||
|
||||
final int destinationId = mDepFine.group(5) != null ? Integer.parseInt(mDepFine.group(5)) : 0;
|
||||
final String destinationId = mDepFine.group(5);
|
||||
final String destinationName = ParserUtils.resolveEntities(mDepFine.group(6));
|
||||
final Location destination = new Location(destinationId > 0 ? LocationType.STATION : LocationType.ANY, destinationId, null,
|
||||
destinationName);
|
||||
final Location destination = new Location(destinationId != null ? LocationType.STATION : LocationType.ANY, destinationId,
|
||||
null, destinationName);
|
||||
|
||||
final Position position = mDepFine.group(7) != null ? new Position("Gl. " + ParserUtils.resolveEntities(mDepFine.group(7)))
|
||||
: null;
|
||||
|
|
|
@ -136,7 +136,7 @@ public class JetProvider extends AbstractHafasProvider
|
|||
}
|
||||
}
|
||||
|
||||
public QueryDeparturesResult queryDepartures(final int stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
public QueryDeparturesResult queryDepartures(final String stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
{
|
||||
final StringBuilder uri = new StringBuilder(stationBoardEndpoint);
|
||||
uri.append(xmlQueryDeparturesParameters(stationId));
|
||||
|
|
|
@ -137,7 +137,7 @@ public class LuProvider extends AbstractHafasProvider
|
|||
}
|
||||
}
|
||||
|
||||
public QueryDeparturesResult queryDepartures(final int stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
public QueryDeparturesResult queryDepartures(final String stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
{
|
||||
final StringBuilder uri = new StringBuilder(stationBoardEndpoint);
|
||||
uri.append(xmlQueryDeparturesParameters(stationId));
|
||||
|
|
|
@ -66,6 +66,6 @@ public class NaldoProvider extends AbstractEfaProvider
|
|||
@Override
|
||||
public List<Location> autocompleteStations(final CharSequence constraint) throws IOException
|
||||
{
|
||||
return xmlStopfinderRequest(new Location(LocationType.STATION, 0, null, constraint.toString()));
|
||||
return xmlStopfinderRequest(new Location(LocationType.STATION, null, null, constraint.toString()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -158,7 +158,7 @@ public class NasaProvider extends AbstractHafasProvider
|
|||
}
|
||||
}
|
||||
|
||||
public QueryDeparturesResult queryDepartures(final int stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
public QueryDeparturesResult queryDepartures(final String stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
{
|
||||
final StringBuilder uri = new StringBuilder(stationBoardEndpoint);
|
||||
uri.append(xmlQueryDeparturesParameters(stationId));
|
||||
|
|
|
@ -96,7 +96,7 @@ public interface NetworkProvider
|
|||
* @return result object containing the departures
|
||||
* @throws IOException
|
||||
*/
|
||||
QueryDeparturesResult queryDepartures(int stationId, int maxDepartures, boolean equivs) throws IOException;
|
||||
QueryDeparturesResult queryDepartures(String stationId, int maxDepartures, boolean equivs) throws IOException;
|
||||
|
||||
/**
|
||||
* Meant for auto-completion of station names, like in an {@link android.widget.AutoCompleteTextView}
|
||||
|
|
|
@ -153,7 +153,7 @@ public class NriProvider extends AbstractHafasProvider
|
|||
}
|
||||
}
|
||||
|
||||
public QueryDeparturesResult queryDepartures(final int stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
public QueryDeparturesResult queryDepartures(final String stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
{
|
||||
final StringBuilder uri = new StringBuilder(stationBoardEndpoint);
|
||||
uri.append(xmlQueryDeparturesParameters(stationId));
|
||||
|
|
|
@ -128,7 +128,7 @@ public class NsProvider extends AbstractHafasProvider
|
|||
}
|
||||
}
|
||||
|
||||
public QueryDeparturesResult queryDepartures(final int stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
public QueryDeparturesResult queryDepartures(final String stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
{
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
|
|
@ -179,7 +179,7 @@ public class NvvProvider extends AbstractHafasProvider
|
|||
}
|
||||
}
|
||||
|
||||
public QueryDeparturesResult queryDepartures(final int stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
public QueryDeparturesResult queryDepartures(final String stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
{
|
||||
final StringBuilder uri = new StringBuilder(stationBoardEndpoint);
|
||||
uri.append(xmlQueryDeparturesParameters(stationId));
|
||||
|
|
|
@ -168,7 +168,7 @@ public class OebbProvider extends AbstractHafasProvider
|
|||
}
|
||||
}
|
||||
|
||||
public QueryDeparturesResult queryDepartures(final int stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
public QueryDeparturesResult queryDepartures(final String stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
{
|
||||
final StringBuilder uri = new StringBuilder(stationBoardEndpoint);
|
||||
uri.append(xmlQueryDeparturesParameters(stationId));
|
||||
|
|
|
@ -154,7 +154,7 @@ public class PlProvider extends AbstractHafasProvider
|
|||
}
|
||||
}
|
||||
|
||||
public QueryDeparturesResult queryDepartures(final int stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
public QueryDeparturesResult queryDepartures(final String stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
{
|
||||
final StringBuilder uri = new StringBuilder(stationBoardEndpoint);
|
||||
uri.append(xmlQueryDeparturesParameters(stationId));
|
||||
|
|
|
@ -122,7 +122,7 @@ public class RtProvider extends AbstractHafasProvider
|
|||
}
|
||||
}
|
||||
|
||||
public QueryDeparturesResult queryDepartures(final int stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
public QueryDeparturesResult queryDepartures(final String stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
{
|
||||
final StringBuilder uri = new StringBuilder(stationBoardEndpoint);
|
||||
uri.append(xmlQueryDeparturesParameters(stationId));
|
||||
|
|
|
@ -97,7 +97,7 @@ public class SadProvider extends AbstractNetworkProvider {
|
|||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public QueryDeparturesResult queryDepartures(int stationId, int maxDepartures, boolean equivs) throws IOException {
|
||||
public QueryDeparturesResult queryDepartures(String stationId, int maxDepartures, boolean equivs) throws IOException {
|
||||
// Not supported by SOAP API
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
@ -181,7 +181,7 @@ public class SadProvider extends AbstractNetworkProvider {
|
|||
}
|
||||
|
||||
// Check if from and to locations are equal
|
||||
if (from.id == to.id) {
|
||||
if (from.id.equals(to.id)) {
|
||||
return new QueryTripsResult(RESULT_HEADER, Status.TOO_CLOSE);
|
||||
}
|
||||
|
||||
|
@ -202,8 +202,8 @@ public class SadProvider extends AbstractNetworkProvider {
|
|||
if (split.length != 4) {
|
||||
return null;
|
||||
}
|
||||
final int fromId = Integer.parseInt(split[0]);
|
||||
final int toId = Integer.parseInt(split[1]);
|
||||
final String fromId = split[0];
|
||||
final String toId = split[1];
|
||||
final boolean dep = Boolean.parseBoolean(split[2]);
|
||||
Date date = null;
|
||||
try {
|
||||
|
@ -237,7 +237,7 @@ public class SadProvider extends AbstractNetworkProvider {
|
|||
private Location soapToLocation(SoapObject nodo) {
|
||||
|
||||
// Parse SoapObject's properties and create a Location object
|
||||
int id = Integer.parseInt(nodo.getPropertyAsString("id"));
|
||||
String id = nodo.getPropertyAsString("id");
|
||||
String name;
|
||||
if (LANGUAGE == Language.GERMAN) {
|
||||
name = (String) nodo.getPropertyAsString("nome_de");
|
||||
|
|
|
@ -119,7 +119,7 @@ public class SbbProvider extends AbstractHafasProvider
|
|||
}
|
||||
}
|
||||
|
||||
public QueryDeparturesResult queryDepartures(final int stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
public QueryDeparturesResult queryDepartures(final String stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
{
|
||||
final StringBuilder uri = new StringBuilder(stationBoardEndpoint);
|
||||
uri.append(xmlQueryDeparturesParameters(stationId));
|
||||
|
|
|
@ -176,7 +176,7 @@ public class SeProvider extends AbstractHafasProvider
|
|||
}
|
||||
}
|
||||
|
||||
public QueryDeparturesResult queryDepartures(final int stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
public QueryDeparturesResult queryDepartures(final String stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
{
|
||||
final StringBuilder uri = new StringBuilder(stationBoardEndpoint);
|
||||
uri.append(xmlQueryDeparturesParameters(stationId));
|
||||
|
|
|
@ -136,7 +136,7 @@ public class SeptaProvider extends AbstractHafasProvider
|
|||
}
|
||||
}
|
||||
|
||||
private String departuresQueryUri(final int stationId, final int maxDepartures)
|
||||
private String departuresQueryUri(final String stationId, final int maxDepartures)
|
||||
{
|
||||
final Calendar now = new GregorianCalendar(timeZone());
|
||||
|
||||
|
@ -183,7 +183,7 @@ public class SeptaProvider extends AbstractHafasProvider
|
|||
+ "(?:<td class=\"center sepline top\">\n(" + ParserUtils.P_PLATFORM + ").*?)?" // position
|
||||
, Pattern.DOTALL);
|
||||
|
||||
public QueryDeparturesResult queryDepartures(final int stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
public QueryDeparturesResult queryDepartures(final String stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
{
|
||||
final ResultHeader header = new ResultHeader(SERVER_PRODUCT);
|
||||
final QueryDeparturesResult result = new QueryDeparturesResult(header);
|
||||
|
@ -260,9 +260,9 @@ public class SeptaProvider extends AbstractHafasProvider
|
|||
|
||||
final Line line = parseLine(lineType, ParserUtils.resolveEntities(mDepFine.group(4)), false);
|
||||
|
||||
final int destinationId = mDepFine.group(5) != null ? Integer.parseInt(mDepFine.group(5)) : 0;
|
||||
final String destinationId = mDepFine.group(5);
|
||||
final String destinationName = ParserUtils.resolveEntities(mDepFine.group(6));
|
||||
final Location destination = new Location(destinationId > 0 ? LocationType.STATION : LocationType.ANY, destinationId, null,
|
||||
final Location destination = new Location(destinationId != null ? LocationType.STATION : LocationType.ANY, destinationId, null,
|
||||
destinationName);
|
||||
|
||||
final Position position = mDepFine.group(7) != null ? new Position("Gl. " + ParserUtils.resolveEntities(mDepFine.group(7)))
|
||||
|
|
|
@ -131,7 +131,7 @@ public class ShProvider extends AbstractHafasProvider
|
|||
}
|
||||
}
|
||||
|
||||
private String departuresQueryUri(final int stationId, final int maxDepartures)
|
||||
private String departuresQueryUri(final String stationId, final int maxDepartures)
|
||||
{
|
||||
final StringBuilder uri = new StringBuilder(stationBoardEndpoint);
|
||||
uri.append("?input=").append(stationId);
|
||||
|
@ -166,7 +166,7 @@ public class ShProvider extends AbstractHafasProvider
|
|||
+ "(?:<td class=\"center sepline top\">\n(" + ParserUtils.P_PLATFORM + ").*?)?" // position
|
||||
, Pattern.DOTALL);
|
||||
|
||||
public QueryDeparturesResult queryDepartures(final int stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
public QueryDeparturesResult queryDepartures(final String stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
{
|
||||
final ResultHeader header = new ResultHeader(SERVER_PRODUCT);
|
||||
final QueryDeparturesResult result = new QueryDeparturesResult(header);
|
||||
|
@ -223,9 +223,9 @@ public class ShProvider extends AbstractHafasProvider
|
|||
|
||||
final Line line = parseLine(lineType, ParserUtils.resolveEntities(mDepFine.group(3).trim()), false);
|
||||
|
||||
final int destinationId = mDepFine.group(4) != null ? Integer.parseInt(mDepFine.group(4)) : 0;
|
||||
final String destinationId = mDepFine.group(4);
|
||||
final String destinationName = ParserUtils.resolveEntities(mDepFine.group(5));
|
||||
final Location destination = new Location(destinationId > 0 ? LocationType.STATION : LocationType.ANY, destinationId, null,
|
||||
final Location destination = new Location(destinationId != null ? LocationType.STATION : LocationType.ANY, destinationId, null,
|
||||
destinationName);
|
||||
|
||||
final Position position = mDepFine.group(6) != null ? new Position("Gl. " + ParserUtils.resolveEntities(mDepFine.group(6)))
|
||||
|
|
|
@ -148,7 +148,7 @@ public class SncbProvider extends AbstractHafasProvider
|
|||
}
|
||||
}
|
||||
|
||||
public QueryDeparturesResult queryDepartures(final int stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
public QueryDeparturesResult queryDepartures(final String stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
{
|
||||
final StringBuilder uri = new StringBuilder(stationBoardEndpoint);
|
||||
uri.append(xmlQueryDeparturesParameters(stationId));
|
||||
|
|
|
@ -165,7 +165,7 @@ public class StockholmProvider extends AbstractHafasProvider
|
|||
}
|
||||
}
|
||||
|
||||
public QueryDeparturesResult queryDepartures(final int stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
public QueryDeparturesResult queryDepartures(final String stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
{
|
||||
final StringBuilder uri = new StringBuilder(stationBoardEndpoint);
|
||||
uri.append(xmlQueryDeparturesParameters(stationId));
|
||||
|
|
|
@ -65,7 +65,7 @@ public class TlemProvider extends AbstractEfaProvider
|
|||
@Override
|
||||
public List<Location> autocompleteStations(final CharSequence constraint) throws IOException
|
||||
{
|
||||
return xmlStopfinderRequest(new Location(LocationType.ANY, 0, null, constraint.toString()));
|
||||
return xmlStopfinderRequest(new Location(LocationType.ANY, null, null, constraint.toString()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -64,7 +64,7 @@ public class TlswProvider extends AbstractEfaProvider
|
|||
@Override
|
||||
public List<Location> autocompleteStations(final CharSequence constraint) throws IOException
|
||||
{
|
||||
return xmlStopfinderRequest(new Location(LocationType.ANY, 0, null, constraint.toString()));
|
||||
return xmlStopfinderRequest(new Location(LocationType.ANY, null, null, constraint.toString()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -173,7 +173,7 @@ public class VbbProvider extends AbstractHafasProvider
|
|||
}
|
||||
}
|
||||
|
||||
public QueryDeparturesResult queryDepartures(final int stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
public QueryDeparturesResult queryDepartures(final String stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
{
|
||||
final StringBuilder uri = new StringBuilder(stationBoardEndpoint);
|
||||
uri.append(xmlQueryDeparturesParameters(stationId));
|
||||
|
|
|
@ -141,7 +141,7 @@ public class VbnProvider extends AbstractHafasProvider
|
|||
}
|
||||
}
|
||||
|
||||
public QueryDeparturesResult queryDepartures(final int stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
public QueryDeparturesResult queryDepartures(final String stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
{
|
||||
final StringBuilder uri = new StringBuilder(stationBoardEndpoint);
|
||||
uri.append(xmlQueryDeparturesParameters(stationId));
|
||||
|
|
|
@ -144,7 +144,7 @@ public class VgsProvider extends AbstractHafasProvider
|
|||
}
|
||||
}
|
||||
|
||||
public QueryDeparturesResult queryDepartures(final int stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
public QueryDeparturesResult queryDepartures(final String stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
{
|
||||
final StringBuilder uri = new StringBuilder(stationBoardEndpoint);
|
||||
uri.append(xmlQueryDeparturesParameters(stationId));
|
||||
|
|
|
@ -53,6 +53,6 @@ public class VmsProvider extends AbstractEfaProvider
|
|||
@Override
|
||||
public List<Location> autocompleteStations(final CharSequence constraint) throws IOException
|
||||
{
|
||||
return xmlStopfinderRequest(new Location(LocationType.ANY, 0, null, constraint.toString()));
|
||||
return xmlStopfinderRequest(new Location(LocationType.ANY, null, null, constraint.toString()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ public class VmvProvider extends AbstractEfaProvider
|
|||
@Override
|
||||
public List<Location> autocompleteStations(final CharSequence constraint) throws IOException
|
||||
{
|
||||
return xmlStopfinderRequest(new Location(LocationType.STATION, 0, null, constraint.toString()));
|
||||
return xmlStopfinderRequest(new Location(LocationType.STATION, null, null, constraint.toString()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -53,6 +53,6 @@ public class VrtProvider extends AbstractEfaProvider
|
|||
@Override
|
||||
public List<Location> autocompleteStations(final CharSequence constraint) throws IOException
|
||||
{
|
||||
return xmlStopfinderRequest(new Location(LocationType.ANY, 0, null, constraint.toString()));
|
||||
return xmlStopfinderRequest(new Location(LocationType.ANY, null, null, constraint.toString()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,6 +55,6 @@ public class VvmProvider extends AbstractEfaProvider
|
|||
@Override
|
||||
public List<Location> autocompleteStations(final CharSequence constraint) throws IOException
|
||||
{
|
||||
return xmlStopfinderRequest(new Location(LocationType.ANY, 0, null, constraint.toString()));
|
||||
return xmlStopfinderRequest(new Location(LocationType.ANY, null, null, constraint.toString()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -184,7 +184,7 @@ public class ZvvProvider extends AbstractHafasProvider
|
|||
}
|
||||
}
|
||||
|
||||
public QueryDeparturesResult queryDepartures(final int stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
public QueryDeparturesResult queryDepartures(final String stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
{
|
||||
final StringBuilder uri = new StringBuilder(stationBoardEndpoint);
|
||||
uri.append(xmlQueryDeparturesParameters(stationId));
|
||||
|
|
|
@ -25,15 +25,13 @@ import java.util.Arrays;
|
|||
*/
|
||||
public final class Location implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 2168486169241327168L;
|
||||
|
||||
public final LocationType type;
|
||||
public final int id;
|
||||
public final String id;
|
||||
public final int lat, lon;
|
||||
public final String place;
|
||||
public final String name;
|
||||
|
||||
public Location(final LocationType type, final int id, final int lat, final int lon, final String place, final String name)
|
||||
public Location(final LocationType type, final String id, final int lat, final int lon, final String place, final String name)
|
||||
{
|
||||
assertId(id);
|
||||
|
||||
|
@ -45,7 +43,7 @@ public final class Location implements Serializable
|
|||
this.name = name;
|
||||
}
|
||||
|
||||
public Location(final LocationType type, final int id, final String place, final String name)
|
||||
public Location(final LocationType type, final String id, final String place, final String name)
|
||||
{
|
||||
assertId(id);
|
||||
|
||||
|
@ -57,7 +55,7 @@ public final class Location implements Serializable
|
|||
this.name = name;
|
||||
}
|
||||
|
||||
public Location(final LocationType type, final int id, final int lat, final int lon)
|
||||
public Location(final LocationType type, final String id, final int lat, final int lon)
|
||||
{
|
||||
assertId(id);
|
||||
|
||||
|
@ -69,7 +67,7 @@ public final class Location implements Serializable
|
|||
this.name = null;
|
||||
}
|
||||
|
||||
public Location(final LocationType type, final int id)
|
||||
public Location(final LocationType type, final String id)
|
||||
{
|
||||
assertId(id);
|
||||
|
||||
|
@ -84,7 +82,7 @@ public final class Location implements Serializable
|
|||
public Location(final LocationType type, final int lat, final int lon)
|
||||
{
|
||||
this.type = type;
|
||||
this.id = 0;
|
||||
this.id = null;
|
||||
this.lat = lat;
|
||||
this.lon = lon;
|
||||
this.place = null;
|
||||
|
@ -93,7 +91,7 @@ public final class Location implements Serializable
|
|||
|
||||
public final boolean hasId()
|
||||
{
|
||||
return id != 0;
|
||||
return id != null;
|
||||
}
|
||||
|
||||
public final boolean hasLocation()
|
||||
|
@ -128,7 +126,7 @@ public final class Location implements Serializable
|
|||
else if (name != null)
|
||||
return name;
|
||||
else if (hasId())
|
||||
return Integer.toString(id);
|
||||
return id;
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
@ -154,8 +152,8 @@ public final class Location implements Serializable
|
|||
final Location other = (Location) o;
|
||||
if (this.type != other.type)
|
||||
return false;
|
||||
if (this.id != 0)
|
||||
return this.id == other.id;
|
||||
if (this.id != null)
|
||||
return this.id.equals(other.id);
|
||||
if (this.lat != 0 && this.lon != 0)
|
||||
return this.lat == other.lat && this.lon == other.lon;
|
||||
if (!nullSafeEquals(this.name, other.name)) // only discriminate by name if no ids are given
|
||||
|
@ -169,9 +167,9 @@ public final class Location implements Serializable
|
|||
int hashCode = 0;
|
||||
hashCode += type.hashCode();
|
||||
hashCode *= 29;
|
||||
if (id != 0)
|
||||
if (id != null)
|
||||
{
|
||||
hashCode += id;
|
||||
hashCode += id.hashCode();
|
||||
}
|
||||
else if (lat != 0 || lon != 0)
|
||||
{
|
||||
|
@ -198,9 +196,9 @@ public final class Location implements Serializable
|
|||
return o.hashCode();
|
||||
}
|
||||
|
||||
private static void assertId(final int id)
|
||||
private static void assertId(final String id)
|
||||
{
|
||||
if (id < 0)
|
||||
if (id != null && Integer.parseInt(id) <= 0)
|
||||
throw new IllegalStateException("assert failed: id=" + id);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue