mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-19 08:49:58 +00:00
preparation for consolidation of connectionsQueryUri() and checkConnectionsQuery()
git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@36 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
parent
8a67ce69dd
commit
8e2786cb7e
5 changed files with 20 additions and 31 deletions
|
@ -135,9 +135,9 @@ public final class VbbProvider implements NetworkProvider
|
|||
private static final Pattern P_CHECK_TO = Pattern.compile("Nach:");
|
||||
private static final Pattern P_CHECK_CONNECTIONS_ERROR = Pattern.compile("(zu dicht beieinander)|(keine Verbindung gefunden)");
|
||||
|
||||
public CheckConnectionsQueryResult checkConnectionsQuery(final String uri) throws IOException
|
||||
public CheckConnectionsQueryResult checkConnectionsQuery(final String queryUri) throws IOException
|
||||
{
|
||||
final CharSequence page = ParserUtils.scrape(uri);
|
||||
final CharSequence page = ParserUtils.scrape(queryUri);
|
||||
|
||||
final Matcher mError = P_CHECK_CONNECTIONS_ERROR.matcher(page);
|
||||
if (mError.find())
|
||||
|
@ -160,18 +160,18 @@ public final class VbbProvider implements NetworkProvider
|
|||
|
||||
if (addresses.isEmpty())
|
||||
{
|
||||
return CheckConnectionsQueryResult.OK;
|
||||
return new CheckConnectionsQueryResult(CheckConnectionsQueryResult.Status.OK, queryUri, null, null, null);
|
||||
}
|
||||
else if (P_CHECK_FROM.matcher(page).find())
|
||||
{
|
||||
if (P_CHECK_TO.matcher(page).find())
|
||||
return new CheckConnectionsQueryResult(CheckConnectionsQueryResult.Status.AMBIGUOUS, null, addresses, null);
|
||||
return new CheckConnectionsQueryResult(CheckConnectionsQueryResult.Status.AMBIGUOUS, queryUri, null, addresses, null);
|
||||
else
|
||||
return new CheckConnectionsQueryResult(CheckConnectionsQueryResult.Status.AMBIGUOUS, null, null, addresses);
|
||||
return new CheckConnectionsQueryResult(CheckConnectionsQueryResult.Status.AMBIGUOUS, queryUri, null, null, addresses);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new CheckConnectionsQueryResult(CheckConnectionsQueryResult.Status.AMBIGUOUS, addresses, null, null);
|
||||
return new CheckConnectionsQueryResult(CheckConnectionsQueryResult.Status.AMBIGUOUS, queryUri, addresses, null, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue