mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-12 22:18:48 +00:00
renamed method
git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@682 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
parent
ee172bc0a5
commit
caaf389634
9 changed files with 40 additions and 40 deletions
|
@ -112,7 +112,7 @@ public abstract class AbstractHafasProvider implements NetworkProvider
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String[] splitNameAndPlace(final String name)
|
protected String[] splitPlaceAndName(final String name)
|
||||||
{
|
{
|
||||||
return new String[] { null, name };
|
return new String[] { null, name };
|
||||||
}
|
}
|
||||||
|
@ -135,8 +135,8 @@ public abstract class AbstractHafasProvider implements NetworkProvider
|
||||||
final int x = Integer.parseInt(pp.getAttributeValue(null, "x"));
|
final int x = Integer.parseInt(pp.getAttributeValue(null, "x"));
|
||||||
final int y = Integer.parseInt(pp.getAttributeValue(null, "y"));
|
final int y = Integer.parseInt(pp.getAttributeValue(null, "y"));
|
||||||
|
|
||||||
final String[] nameAndPlace = splitNameAndPlace(name);
|
final String[] placeAndName = splitPlaceAndName(name);
|
||||||
return new Location(LocationType.STATION, id, y, x, nameAndPlace[0], nameAndPlace[1]);
|
return new Location(LocationType.STATION, id, y, x, placeAndName[0], placeAndName[1]);
|
||||||
}
|
}
|
||||||
throw new IllegalStateException("cannot handle: " + type);
|
throw new IllegalStateException("cannot handle: " + type);
|
||||||
}
|
}
|
||||||
|
@ -286,8 +286,8 @@ public abstract class AbstractHafasProvider implements NetworkProvider
|
||||||
|
|
||||||
if (type == 1) // station
|
if (type == 1) // station
|
||||||
{
|
{
|
||||||
final String[] nameAndPlace = splitNameAndPlace(value);
|
final String[] placeAndName = splitPlaceAndName(value);
|
||||||
results.add(new Location(LocationType.STATION, localId, lat, lon, nameAndPlace[0], nameAndPlace[1]));
|
results.add(new Location(LocationType.STATION, localId, lat, lon, placeAndName[0], placeAndName[1]));
|
||||||
}
|
}
|
||||||
else if (type == 2) // address
|
else if (type == 2) // address
|
||||||
{
|
{
|
||||||
|
@ -391,8 +391,8 @@ public abstract class AbstractHafasProvider implements NetworkProvider
|
||||||
final int lon = Integer.parseInt(iMatcherLonLat.group(1));
|
final int lon = Integer.parseInt(iMatcherLonLat.group(1));
|
||||||
final int lat = Integer.parseInt(iMatcherLonLat.group(2));
|
final int lat = Integer.parseInt(iMatcherLonLat.group(2));
|
||||||
|
|
||||||
final String[] nameAndPlace = splitNameAndPlace(name);
|
final String[] placeAndName = splitPlaceAndName(name);
|
||||||
results.add(new Location(type, id, lat, lon, nameAndPlace[0], nameAndPlace[1]));
|
results.add(new Location(type, id, lat, lon, placeAndName[0], placeAndName[1]));
|
||||||
|
|
||||||
XmlPullUtil.next(pp);
|
XmlPullUtil.next(pp);
|
||||||
}
|
}
|
||||||
|
@ -1114,8 +1114,8 @@ public abstract class AbstractHafasProvider implements NetworkProvider
|
||||||
parsedLat = 0;
|
parsedLat = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
final String[] nameAndPlace = splitNameAndPlace(parsedName);
|
final String[] placeAndName = splitPlaceAndName(parsedName);
|
||||||
stations.add(new Location(LocationType.STATION, parsedId, parsedLat, parsedLon, nameAndPlace[0], nameAndPlace[1]));
|
stations.add(new Location(LocationType.STATION, parsedId, parsedLat, parsedLon, placeAndName[0], placeAndName[1]));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1148,8 +1148,8 @@ public abstract class AbstractHafasProvider implements NetworkProvider
|
||||||
|
|
||||||
if (stopWeight != 0)
|
if (stopWeight != 0)
|
||||||
{
|
{
|
||||||
final String[] nameAndPlace = splitNameAndPlace(name);
|
final String[] placeAndName = splitPlaceAndName(name);
|
||||||
stations.add(new Location(LocationType.STATION, id, lat, lon, nameAndPlace[0], nameAndPlace[1]));
|
stations.add(new Location(LocationType.STATION, id, lat, lon, placeAndName[0], placeAndName[1]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1201,8 +1201,8 @@ public abstract class AbstractHafasProvider implements NetworkProvider
|
||||||
parsedLat = Integer.parseInt(mFineCoords.group(2));
|
parsedLat = Integer.parseInt(mFineCoords.group(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
final String[] nameAndPlace = splitNameAndPlace(parsedName);
|
final String[] placeAndName = splitPlaceAndName(parsedName);
|
||||||
stations.add(new Location(LocationType.STATION, parsedId, parsedLat, parsedLon, nameAndPlace[0], nameAndPlace[1]));
|
stations.add(new Location(LocationType.STATION, parsedId, parsedLat, parsedLon, placeAndName[0], placeAndName[1]));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -84,7 +84,7 @@ public final class BvgProvider extends AbstractHafasProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String[] splitNameAndPlace(final String name)
|
protected String[] splitPlaceAndName(final String name)
|
||||||
{
|
{
|
||||||
if (name.endsWith(" (Berlin)"))
|
if (name.endsWith(" (Berlin)"))
|
||||||
return new String[] { "Berlin", name.substring(0, name.length() - 9) };
|
return new String[] { "Berlin", name.substring(0, name.length() - 9) };
|
||||||
|
@ -97,7 +97,7 @@ public final class BvgProvider extends AbstractHafasProvider
|
||||||
else if (name.startsWith("Frankfurt (Oder), "))
|
else if (name.startsWith("Frankfurt (Oder), "))
|
||||||
return new String[] { "Frankfurt (Oder)", name.substring(18) };
|
return new String[] { "Frankfurt (Oder)", name.substring(18) };
|
||||||
|
|
||||||
return super.splitNameAndPlace(name);
|
return super.splitPlaceAndName(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final static Pattern P_NEARBY_OWN = Pattern
|
private final static Pattern P_NEARBY_OWN = Pattern
|
||||||
|
@ -134,7 +134,7 @@ public final class BvgProvider extends AbstractHafasProvider
|
||||||
final int parsedId = Integer.parseInt(mOwn.group(1));
|
final int parsedId = Integer.parseInt(mOwn.group(1));
|
||||||
final int parsedLon = (int) (Float.parseFloat(mOwn.group(2)) * 1E6);
|
final int parsedLon = (int) (Float.parseFloat(mOwn.group(2)) * 1E6);
|
||||||
final int parsedLat = (int) (Float.parseFloat(mOwn.group(3)) * 1E6);
|
final int parsedLat = (int) (Float.parseFloat(mOwn.group(3)) * 1E6);
|
||||||
final String[] parsedPlaceAndName = splitNameAndPlace(ParserUtils.urlDecode(mOwn.group(4), "ISO-8859-1"));
|
final String[] parsedPlaceAndName = splitPlaceAndName(ParserUtils.urlDecode(mOwn.group(4), "ISO-8859-1"));
|
||||||
stations.add(new Location(LocationType.STATION, parsedId, parsedLat, parsedLon, parsedPlaceAndName[0], parsedPlaceAndName[1]));
|
stations.add(new Location(LocationType.STATION, parsedId, parsedLat, parsedLon, parsedPlaceAndName[0], parsedPlaceAndName[1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ public final class BvgProvider extends AbstractHafasProvider
|
||||||
if (mFineLocation.find())
|
if (mFineLocation.find())
|
||||||
{
|
{
|
||||||
final int parsedId = Integer.parseInt(mFineLocation.group(1));
|
final int parsedId = Integer.parseInt(mFineLocation.group(1));
|
||||||
final String[] parsedPlaceAndName = splitNameAndPlace(ParserUtils.resolveEntities(mFineLocation.group(2)));
|
final String[] parsedPlaceAndName = splitPlaceAndName(ParserUtils.resolveEntities(mFineLocation.group(2)));
|
||||||
final Location station = new Location(LocationType.STATION, parsedId, parsedPlaceAndName[0], parsedPlaceAndName[1]);
|
final Location station = new Location(LocationType.STATION, parsedId, parsedPlaceAndName[0], parsedPlaceAndName[1]);
|
||||||
if (!stations.contains(station))
|
if (!stations.contains(station))
|
||||||
stations.add(station);
|
stations.add(station);
|
||||||
|
@ -266,7 +266,7 @@ public final class BvgProvider extends AbstractHafasProvider
|
||||||
final Matcher mHead = P_DEPARTURES_LIVE_HEAD.matcher(page);
|
final Matcher mHead = P_DEPARTURES_LIVE_HEAD.matcher(page);
|
||||||
if (mHead.matches())
|
if (mHead.matches())
|
||||||
{
|
{
|
||||||
final String[] placeAndName = splitNameAndPlace(ParserUtils.resolveEntities(mHead.group(1)));
|
final String[] placeAndName = splitPlaceAndName(ParserUtils.resolveEntities(mHead.group(1)));
|
||||||
final Calendar currentTime = new GregorianCalendar(timeZone());
|
final Calendar currentTime = new GregorianCalendar(timeZone());
|
||||||
currentTime.clear();
|
currentTime.clear();
|
||||||
parseDateTime(currentTime, mHead.group(2));
|
parseDateTime(currentTime, mHead.group(2));
|
||||||
|
@ -362,7 +362,7 @@ public final class BvgProvider extends AbstractHafasProvider
|
||||||
final Matcher mHead = P_DEPARTURES_PLAN_HEAD.matcher(page);
|
final Matcher mHead = P_DEPARTURES_PLAN_HEAD.matcher(page);
|
||||||
if (mHead.matches())
|
if (mHead.matches())
|
||||||
{
|
{
|
||||||
final String[] placeAndName = splitNameAndPlace(ParserUtils.resolveEntities(mHead.group(1)));
|
final String[] placeAndName = splitPlaceAndName(ParserUtils.resolveEntities(mHead.group(1)));
|
||||||
final Calendar currentTime = new GregorianCalendar(timeZone());
|
final Calendar currentTime = new GregorianCalendar(timeZone());
|
||||||
currentTime.clear();
|
currentTime.clear();
|
||||||
ParserUtils.parseGermanDate(currentTime, mHead.group(2));
|
ParserUtils.parseGermanDate(currentTime, mHead.group(2));
|
||||||
|
@ -608,7 +608,7 @@ public final class BvgProvider extends AbstractHafasProvider
|
||||||
final int id = idStr != null ? Integer.parseInt(idStr) : 0;
|
final int id = idStr != null ? Integer.parseInt(idStr) : 0;
|
||||||
final int lat = latStr != null ? (int) (Float.parseFloat(latStr) * 1E6) : 0;
|
final int lat = latStr != null ? (int) (Float.parseFloat(latStr) * 1E6) : 0;
|
||||||
final int lon = lonStr != null ? (int) (Float.parseFloat(lonStr) * 1E6) : 0;
|
final int lon = lonStr != null ? (int) (Float.parseFloat(lonStr) * 1E6) : 0;
|
||||||
final String[] placeAndName = splitNameAndPlace(nameStr);
|
final String[] placeAndName = splitPlaceAndName(nameStr);
|
||||||
|
|
||||||
final LocationType type;
|
final LocationType type;
|
||||||
if (typeStr == null)
|
if (typeStr == null)
|
||||||
|
@ -630,7 +630,7 @@ public final class BvgProvider extends AbstractHafasProvider
|
||||||
final int id = track[4].length() > 0 ? Integer.parseInt(track[4]) : 0;
|
final int id = track[4].length() > 0 ? Integer.parseInt(track[4]) : 0;
|
||||||
final int lat = Integer.parseInt(track[6]);
|
final int lat = Integer.parseInt(track[6]);
|
||||||
final int lon = Integer.parseInt(track[5]);
|
final int lon = Integer.parseInt(track[5]);
|
||||||
final String[] placeAndName = splitNameAndPlace(ParserUtils.resolveEntities(track[9]));
|
final String[] placeAndName = splitPlaceAndName(ParserUtils.resolveEntities(track[9]));
|
||||||
final String typeStr = track[1];
|
final String typeStr = track[1];
|
||||||
|
|
||||||
final LocationType type;
|
final LocationType type;
|
||||||
|
@ -836,7 +836,7 @@ public final class BvgProvider extends AbstractHafasProvider
|
||||||
final Location destination;
|
final Location destination;
|
||||||
if (mDetails.group(3) != null)
|
if (mDetails.group(3) != null)
|
||||||
{
|
{
|
||||||
final String[] destinationPlaceAndName = splitNameAndPlace(ParserUtils.resolveEntities(mDetails.group(3)));
|
final String[] destinationPlaceAndName = splitPlaceAndName(ParserUtils.resolveEntities(mDetails.group(3)));
|
||||||
destination = new Location(LocationType.ANY, 0, destinationPlaceAndName[0], destinationPlaceAndName[1]);
|
destination = new Location(LocationType.ANY, 0, destinationPlaceAndName[0], destinationPlaceAndName[1]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -71,7 +71,7 @@ public class InvgProvider extends AbstractHafasProvider
|
||||||
private static final String[] PLACES = { "Ingolstadt", "München" };
|
private static final String[] PLACES = { "Ingolstadt", "München" };
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String[] splitNameAndPlace(final String name)
|
protected String[] splitPlaceAndName(final String name)
|
||||||
{
|
{
|
||||||
for (final String place : PLACES)
|
for (final String place : PLACES)
|
||||||
{
|
{
|
||||||
|
@ -81,7 +81,7 @@ public class InvgProvider extends AbstractHafasProvider
|
||||||
return new String[] { place, name.substring(place.length() + 2) };
|
return new String[] { place, name.substring(place.length() + 2) };
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.splitNameAndPlace(name);
|
return super.splitPlaceAndName(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public NearbyStationsResult queryNearbyStations(final Location location, final int maxDistance, final int maxStations) throws IOException
|
public NearbyStationsResult queryNearbyStations(final Location location, final int maxDistance, final int maxStations) throws IOException
|
||||||
|
@ -246,8 +246,8 @@ public class InvgProvider extends AbstractHafasProvider
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final String[] nameAndPlace = splitNameAndPlace(location);
|
final String[] placeAndName = splitPlaceAndName(location);
|
||||||
result.stationDepartures.add(new StationDepartures(new Location(LocationType.STATION, locationId, nameAndPlace[0], nameAndPlace[1]),
|
result.stationDepartures.add(new StationDepartures(new Location(LocationType.STATION, locationId, placeAndName[0], placeAndName[1]),
|
||||||
departures, null));
|
departures, null));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,13 +56,13 @@ public class NriProvider extends AbstractHafasProvider
|
||||||
private static final String[] PLACES = { "Oslo", "Bergen" };
|
private static final String[] PLACES = { "Oslo", "Bergen" };
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String[] splitNameAndPlace(final String name)
|
protected String[] splitPlaceAndName(final String name)
|
||||||
{
|
{
|
||||||
for (final String place : PLACES)
|
for (final String place : PLACES)
|
||||||
if (name.startsWith(place + " "))
|
if (name.startsWith(place + " "))
|
||||||
return new String[] { place, name.substring(place.length() + 1) };
|
return new String[] { place, name.substring(place.length() + 1) };
|
||||||
|
|
||||||
return super.splitNameAndPlace(name);
|
return super.splitPlaceAndName(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public NearbyStationsResult queryNearbyStations(final Location location, final int maxDistance, final int maxStations) throws IOException
|
public NearbyStationsResult queryNearbyStations(final Location location, final int maxDistance, final int maxStations) throws IOException
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class PlProvider extends AbstractHafasProvider
|
||||||
private static final String[] PLACES = { "Warszawa", "Kraków" };
|
private static final String[] PLACES = { "Warszawa", "Kraków" };
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String[] splitNameAndPlace(final String name)
|
protected String[] splitPlaceAndName(final String name)
|
||||||
{
|
{
|
||||||
for (final String place : PLACES)
|
for (final String place : PLACES)
|
||||||
{
|
{
|
||||||
|
@ -67,7 +67,7 @@ public class PlProvider extends AbstractHafasProvider
|
||||||
return new String[] { place, name.substring(place.length() + 1) };
|
return new String[] { place, name.substring(place.length() + 1) };
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.splitNameAndPlace(name);
|
return super.splitPlaceAndName(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public NearbyStationsResult queryNearbyStations(final Location location, final int maxDistance, final int maxStations) throws IOException
|
public NearbyStationsResult queryNearbyStations(final Location location, final int maxDistance, final int maxStations) throws IOException
|
||||||
|
|
|
@ -68,13 +68,13 @@ public class RmvProvider extends AbstractHafasProvider
|
||||||
"Darmstadt", "Aschaffenburg", "Berlin", "Fulda" };
|
"Darmstadt", "Aschaffenburg", "Berlin", "Fulda" };
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String[] splitNameAndPlace(final String name)
|
protected String[] splitPlaceAndName(final String name)
|
||||||
{
|
{
|
||||||
for (final String place : PLACES)
|
for (final String place : PLACES)
|
||||||
if (name.startsWith(place + " ") || name.startsWith(place + "-"))
|
if (name.startsWith(place + " ") || name.startsWith(place + "-"))
|
||||||
return new String[] { place, name.substring(place.length() + 1) };
|
return new String[] { place, name.substring(place.length() + 1) };
|
||||||
|
|
||||||
return super.splitNameAndPlace(name);
|
return super.splitPlaceAndName(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public NearbyStationsResult queryNearbyStations(final Location location, final int maxDistance, final int maxStations) throws IOException
|
public NearbyStationsResult queryNearbyStations(final Location location, final int maxDistance, final int maxStations) throws IOException
|
||||||
|
@ -231,8 +231,8 @@ public class RmvProvider extends AbstractHafasProvider
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final String[] nameAndPlace = splitNameAndPlace(location);
|
final String[] placeAndName = splitPlaceAndName(location);
|
||||||
result.stationDepartures.add(new StationDepartures(new Location(LocationType.STATION, locationId, nameAndPlace[0], nameAndPlace[1]),
|
result.stationDepartures.add(new StationDepartures(new Location(LocationType.STATION, locationId, placeAndName[0], placeAndName[1]),
|
||||||
departures, null));
|
departures, null));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,13 +87,13 @@ public class SeProvider extends AbstractHafasProvider
|
||||||
private static final Pattern P_SPLIT_NAME_KN = Pattern.compile("(.*?) \\((.*?) kn\\)");
|
private static final Pattern P_SPLIT_NAME_KN = Pattern.compile("(.*?) \\((.*?) kn\\)");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String[] splitNameAndPlace(final String name)
|
protected String[] splitPlaceAndName(final String name)
|
||||||
{
|
{
|
||||||
final Matcher m = P_SPLIT_NAME_KN.matcher(name);
|
final Matcher m = P_SPLIT_NAME_KN.matcher(name);
|
||||||
if (m.matches())
|
if (m.matches())
|
||||||
return new String[] { m.group(2), m.group(1) };
|
return new String[] { m.group(2), m.group(1) };
|
||||||
|
|
||||||
return super.splitNameAndPlace(name);
|
return super.splitPlaceAndName(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public NearbyStationsResult queryNearbyStations(final Location location, final int maxDistance, final int maxStations) throws IOException
|
public NearbyStationsResult queryNearbyStations(final Location location, final int maxDistance, final int maxStations) throws IOException
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class VbbProvider extends AbstractHafasProvider
|
||||||
private static final Pattern P_SPLIT_NAME_COMMA = Pattern.compile("([^,]*), ([^,]*)");
|
private static final Pattern P_SPLIT_NAME_COMMA = Pattern.compile("([^,]*), ([^,]*)");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String[] splitNameAndPlace(final String name)
|
protected String[] splitPlaceAndName(final String name)
|
||||||
{
|
{
|
||||||
final Matcher mParen = P_SPLIT_NAME_PAREN.matcher(name);
|
final Matcher mParen = P_SPLIT_NAME_PAREN.matcher(name);
|
||||||
if (mParen.matches())
|
if (mParen.matches())
|
||||||
|
@ -72,7 +72,7 @@ public class VbbProvider extends AbstractHafasProvider
|
||||||
if (mComma.matches())
|
if (mComma.matches())
|
||||||
return new String[] { mComma.group(1), mComma.group(2) };
|
return new String[] { mComma.group(1), mComma.group(2) };
|
||||||
|
|
||||||
return super.splitNameAndPlace(name);
|
return super.splitPlaceAndName(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public NearbyStationsResult queryNearbyStations(final Location location, final int maxDistance, final int maxStations) throws IOException
|
public NearbyStationsResult queryNearbyStations(final Location location, final int maxDistance, final int maxStations) throws IOException
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class ZvvProvider extends AbstractHafasProvider
|
||||||
private static final String[] PLACES = { "Zürich" };
|
private static final String[] PLACES = { "Zürich" };
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String[] splitNameAndPlace(final String name)
|
protected String[] splitPlaceAndName(final String name)
|
||||||
{
|
{
|
||||||
for (final String place : PLACES)
|
for (final String place : PLACES)
|
||||||
{
|
{
|
||||||
|
@ -65,7 +65,7 @@ public class ZvvProvider extends AbstractHafasProvider
|
||||||
return new String[] { place, name.substring(place.length() + 2) };
|
return new String[] { place, name.substring(place.length() + 2) };
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.splitNameAndPlace(name);
|
return super.splitPlaceAndName(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public NearbyStationsResult queryNearbyStations(final Location location, final int maxDistance, final int maxStations) throws IOException
|
public NearbyStationsResult queryNearbyStations(final Location location, final int maxDistance, final int maxStations) throws IOException
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue