22 |
|
|
23 |
|
|
24 |
@Override |
@Override |
25 |
public DepartureBean lookupDepartures(int stationID, boolean arrival) { |
public DepartureBean lookupDepartures(int stationID, boolean arrival,String type) { |
26 |
|
|
27 |
String key = "" + stationID + ":" + arrival; |
String key = "" + stationID + ":" + arrival + ":" + type; |
28 |
|
|
29 |
DepartureBean departures = departureCache.get(key); |
DepartureBean departures = departureCache.get(key); |
30 |
|
|
31 |
if (departures == null) { |
if (departures == null) { |
32 |
departures = lookupDeparturesWorker(stationID, arrival); |
departures = lookupDeparturesWorker(stationID, arrival, type); |
33 |
|
|
34 |
if (departures != null) { |
if (departures != null) { |
35 |
departureCache.put(key, departures); |
departureCache.put(key, departures); |
42 |
return departures; |
return departures; |
43 |
} |
} |
44 |
|
|
45 |
private DepartureBean lookupDeparturesWorker(int stationID, boolean arrival) { |
private DepartureBean lookupDeparturesWorker(int stationID, boolean arrival, String type) { |
46 |
|
|
47 |
try |
try |
48 |
{ |
{ |
49 |
int iArrival = arrival ? 1 : 0; |
int iArrival = arrival ? 1 : 0; |
50 |
String url = XmlUtil.SERVICE_BASE + "/DepartureServlet?format=xml&station=" + stationID + "&arrival=" + iArrival; |
String url = XmlUtil.SERVICE_BASE + "/DepartureServlet?format=xml&station=" + stationID + "&arrival=" + iArrival + "&type=" + type; |
51 |
Log.i("xmlurl",url); |
Log.i("xmlurl",url); |
52 |
String doc = DownloadUtil.getContentString(url, 30000, "ISO-8859-1"); |
String doc = DownloadUtil.getContentString(url, 30000, "ISO-8859-1"); |
53 |
|
|