support product selection for XML API based connection queries

git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@706 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
andreas.schildbach@gmail.com 2011-06-18 14:26:03 +00:00
parent f442cd5ead
commit e10e60cb41
22 changed files with 630 additions and 5 deletions

View file

@ -36,7 +36,7 @@ public class VbnProvider extends AbstractHafasProvider
public VbnProvider()
{
super(API_BASE + "query.exe/dn", 11, null);
super(API_BASE + "query.exe/dn", 10, null);
}
public NetworkId id()
@ -53,6 +53,52 @@ public class VbnProvider extends AbstractHafasProvider
return false;
}
@Override
protected void setProductBits(final StringBuilder productBits, final char product)
{
if (product == 'I')
{
productBits.setCharAt(0, '1'); // Hochgeschwindigkeitszug
productBits.setCharAt(1, '1'); // IC/EC
productBits.setCharAt(2, '1'); // Fernverkehrszug
}
else if (product == 'R')
{
productBits.setCharAt(3, '1'); // Regionalverkehrszug
}
else if (product == 'S')
{
productBits.setCharAt(4, '1'); // S-Bahn
}
else if (product == 'U')
{
productBits.setCharAt(7, '1'); // U-Bahn
}
else if (product == 'T')
{
productBits.setCharAt(8, '1'); // Stadtbahn
}
else if (product == 'B')
{
productBits.setCharAt(5, '1'); // Bus
}
else if (product == 'P')
{
productBits.setCharAt(9, '1'); // Anruf-Sammel-Taxi
}
else if (product == 'F')
{
productBits.setCharAt(6, '1'); // Schiff
}
else if (product == 'C')
{
}
else
{
throw new IllegalArgumentException("cannot handle: " + product);
}
}
public NearbyStationsResult queryNearbyStations(final Location location, final int maxDistance, final int maxStations) throws IOException
{
final StringBuilder uri = new StringBuilder(API_BASE);