mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-16 17:39:49 +00:00
Leipzig directions
git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@601 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
parent
0ef56f0081
commit
194a2738f0
2 changed files with 18 additions and 23 deletions
|
@ -21,17 +21,14 @@ import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.GregorianCalendar;
|
import java.util.GregorianCalendar;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import de.schildbach.pte.dto.Departure;
|
import de.schildbach.pte.dto.Departure;
|
||||||
import de.schildbach.pte.dto.GetConnectionDetailsResult;
|
|
||||||
import de.schildbach.pte.dto.Location;
|
import de.schildbach.pte.dto.Location;
|
||||||
import de.schildbach.pte.dto.LocationType;
|
import de.schildbach.pte.dto.LocationType;
|
||||||
import de.schildbach.pte.dto.QueryConnectionsResult;
|
|
||||||
import de.schildbach.pte.dto.QueryDeparturesResult;
|
import de.schildbach.pte.dto.QueryDeparturesResult;
|
||||||
import de.schildbach.pte.dto.QueryDeparturesResult.Status;
|
import de.schildbach.pte.dto.QueryDeparturesResult.Status;
|
||||||
import de.schildbach.pte.dto.StationDepartures;
|
import de.schildbach.pte.dto.StationDepartures;
|
||||||
|
@ -61,7 +58,7 @@ public class NasaProvider extends AbstractHafasProvider
|
||||||
public boolean hasCapabilities(final Capability... capabilities)
|
public boolean hasCapabilities(final Capability... capabilities)
|
||||||
{
|
{
|
||||||
for (final Capability capability : capabilities)
|
for (final Capability capability : capabilities)
|
||||||
if (capability == Capability.DEPARTURES)
|
if (capability == Capability.AUTOCOMPLETE_ONE_LINE || capability == Capability.DEPARTURES || capability == Capability.CONNECTIONS)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -262,6 +259,8 @@ public class NasaProvider extends AbstractHafasProvider
|
||||||
|
|
||||||
if (ucType.equals("STB"))
|
if (ucType.equals("STB"))
|
||||||
return 'T';
|
return 'T';
|
||||||
|
if ("STRB".equals(ucType))
|
||||||
|
return 'T';
|
||||||
|
|
||||||
if (ucType.equals("BSV"))
|
if (ucType.equals("BSV"))
|
||||||
return 'B';
|
return 'B';
|
||||||
|
@ -275,23 +274,4 @@ public class NasaProvider extends AbstractHafasProvider
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public QueryConnectionsResult queryConnections(final Location from, final Location via, final Location to, final Date date, final boolean dep,
|
|
||||||
final String products, final WalkSpeed walkSpeed) throws IOException
|
|
||||||
{
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public QueryConnectionsResult queryMoreConnections(String uri) throws IOException
|
|
||||||
{
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public GetConnectionDetailsResult getConnectionDetails(String connectionUri) throws IOException
|
|
||||||
{
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,13 +17,17 @@
|
||||||
|
|
||||||
package de.schildbach.pte.live;
|
package de.schildbach.pte.live;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import de.schildbach.pte.NasaProvider;
|
import de.schildbach.pte.NasaProvider;
|
||||||
|
import de.schildbach.pte.NetworkProvider.WalkSpeed;
|
||||||
import de.schildbach.pte.dto.Location;
|
import de.schildbach.pte.dto.Location;
|
||||||
|
import de.schildbach.pte.dto.LocationType;
|
||||||
import de.schildbach.pte.dto.NearbyStationsResult;
|
import de.schildbach.pte.dto.NearbyStationsResult;
|
||||||
|
import de.schildbach.pte.dto.QueryConnectionsResult;
|
||||||
import de.schildbach.pte.dto.QueryDeparturesResult;
|
import de.schildbach.pte.dto.QueryDeparturesResult;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -32,6 +36,7 @@ import de.schildbach.pte.dto.QueryDeparturesResult;
|
||||||
public class NasaProviderLiveTest
|
public class NasaProviderLiveTest
|
||||||
{
|
{
|
||||||
private final NasaProvider provider = new NasaProvider();
|
private final NasaProvider provider = new NasaProvider();
|
||||||
|
private static final String ALL_PRODUCTS = "IRSUTBFC";
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void autocomplete() throws Exception
|
public void autocomplete() throws Exception
|
||||||
|
@ -64,4 +69,14 @@ public class NasaProviderLiveTest
|
||||||
|
|
||||||
System.out.println(result.stationDepartures);
|
System.out.println(result.stationDepartures);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void shortConnection() throws Exception
|
||||||
|
{
|
||||||
|
final QueryConnectionsResult result = provider.queryConnections(new Location(LocationType.STATION, 13002, null, "Leipzig, Augustusplatz"),
|
||||||
|
null, new Location(LocationType.STATION, 8010205, null, "Leipzig Hbf"), new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL);
|
||||||
|
System.out.println(result);
|
||||||
|
final QueryConnectionsResult moreResult = provider.queryMoreConnections(result.context);
|
||||||
|
System.out.println(moreResult);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue