3 |
import java.util.ArrayList; |
import java.util.ArrayList; |
4 |
import java.util.List; |
import java.util.List; |
5 |
|
|
6 |
|
import android.location.Location; |
7 |
import dk.thoerup.traininfo.DepartureBean; |
import dk.thoerup.traininfo.DepartureBean; |
8 |
|
import dk.thoerup.traininfo.DepartureEntry; |
9 |
|
import dk.thoerup.traininfo.StationBean; |
10 |
|
import dk.thoerup.traininfo.TimetableBean; |
11 |
|
|
12 |
public class DebugProvider implements DepartureProvider { |
public class DebugProvider implements DepartureProvider, StationProvider, TimetableProvider { |
13 |
|
|
|
@Override |
|
|
public void lookupDepartures(String station) { |
|
|
} |
|
14 |
|
|
15 |
@Override |
@Override |
16 |
public List<DepartureBean> getDepartures() { |
public DepartureBean lookupDepartures(int station, boolean arrival) { |
17 |
List<DepartureBean> list = new ArrayList<DepartureBean>(); |
DepartureBean bean = new DepartureBean(); |
18 |
|
|
19 |
DepartureBean departure = new DepartureBean(); |
DepartureEntry departure = new DepartureEntry(); |
20 |
departure.setTime("17:03"); |
departure.setTime("08:03"); |
21 |
departure.setDestination("Dar-es Salaam"); |
departure.setDestination("Dar-es Salaam"); |
22 |
departure.setOrigin("Sao Paulo"); |
departure.setOrigin("Sao Paulo"); |
23 |
departure.setLocation("Beijing"); |
departure.setLocation("Beijing"); |
24 |
departure.setLastUpdate("1"); |
departure.setLastUpdate("1"); |
25 |
departure.setTrainNumber("RA-123"); |
departure.setTrainNumber("RA-123"); |
26 |
list.add(departure); |
bean.entries.add(departure); |
27 |
|
|
28 |
departure = new DepartureBean(); |
departure = new DepartureEntry(); |
29 |
departure.setTime("23:39"); |
departure.setTime("13:39"); |
30 |
departure.setDestination("Timbuktu"); |
departure.setDestination("Timbuktu"); |
31 |
departure.setOrigin("Anchorage"); |
departure.setOrigin("Anchorage"); |
32 |
departure.setLocation("Helsinki"); |
departure.setLocation("Helsinki"); |
33 |
departure.setLastUpdate("2"); |
departure.setLastUpdate("2"); |
34 |
departure.setTrainNumber("IC-7"); |
departure.setTrainNumber("IC-7"); |
35 |
list.add(departure); |
departure.setStatus("2 days delayed"); |
36 |
|
bean.entries.add(departure); |
37 |
|
|
38 |
|
departure = new DepartureEntry(); |
39 |
|
departure.setTime("21:41"); |
40 |
|
departure.setDestination("Skive"); |
41 |
|
departure.setOrigin("Virksund"); |
42 |
|
departure.setLocation("Hald"); |
43 |
|
departure.setLastUpdate("2"); |
44 |
|
departure.setTrainNumber("IC-7"); |
45 |
|
departure.setNote("Kun st�pladser"); |
46 |
|
bean.entries.add(departure); |
47 |
|
|
48 |
|
|
49 |
return list; |
|
50 |
|
return bean; |
51 |
} |
} |
52 |
|
|
53 |
|
|
54 |
|
public List<StationBean> getStations() { |
55 |
|
List<StationBean> stations = new ArrayList<StationBean>(); |
56 |
|
|
57 |
|
StationBean station = new StationBean(); |
58 |
|
station.setName("Andeby"); |
59 |
|
station.setDistance(1700); |
60 |
|
station.setId(1); |
61 |
|
station.setLatitude(56.0); |
62 |
|
station.setLongitude(10.0); |
63 |
|
station.setRegional(true); |
64 |
|
stations.add(station); |
65 |
|
|
66 |
|
station = new StationBean(); |
67 |
|
station.setName("Gåserød"); |
68 |
|
station.setDistance(5300); |
69 |
|
station.setId(2); |
70 |
|
station.setLatitude(58.0); |
71 |
|
station.setLongitude(10.0); |
72 |
|
station.setRegional(true); |
73 |
|
stations.add(station); |
74 |
|
|
75 |
|
station = new StationBean(); |
76 |
|
station.setName("Pladerballe"); |
77 |
|
station.setDistance(15600); |
78 |
|
station.setId(3); |
79 |
|
station.setLatitude(52.0); |
80 |
|
station.setLongitude(11.0); |
81 |
|
station.setRegional(true); |
82 |
|
stations.add(station); |
83 |
|
|
84 |
|
return stations; |
85 |
|
} |
86 |
|
|
87 |
|
@Override |
88 |
|
public List<StationBean> lookupStations(Location location) { |
89 |
|
return getStations(); |
90 |
|
} |
91 |
|
|
92 |
|
@Override |
93 |
|
public List<StationBean> lookupStationsByName(String name) { |
94 |
|
return getStations(); |
95 |
|
} |
96 |
|
|
97 |
|
|
98 |
|
|
99 |
|
@Override |
100 |
|
public List<StationBean> lookupStationsByIds(String ids) { |
101 |
|
return getStations(); |
102 |
|
} |
103 |
|
|
104 |
|
@Override |
105 |
|
public List<TimetableBean> lookupTimetable(String type, String trainID) { |
106 |
|
List<TimetableBean> timetables = new ArrayList<TimetableBean>(); |
107 |
|
|
108 |
|
TimetableBean timetable = new TimetableBean(); |
109 |
|
timetable.setStation("Andeby"); |
110 |
|
timetable.setArrival(""); |
111 |
|
timetable.setDeparture("05:17"); |
112 |
|
timetable.setCurrent(false); |
113 |
|
timetables.add(timetable); |
114 |
|
|
115 |
|
timetable = new TimetableBean(); |
116 |
|
timetable.setStation("Gåserød"); |
117 |
|
timetable.setArrival("07:45"); |
118 |
|
timetable.setDeparture("07:46"); |
119 |
|
timetable.setCurrent(false); |
120 |
|
timetables.add(timetable); |
121 |
|
|
122 |
|
timetable = new TimetableBean(); |
123 |
|
timetable.setStation("Smallville"); |
124 |
|
timetable.setArrival("08:32"); |
125 |
|
timetable.setDeparture("08:32"); |
126 |
|
timetable.setCurrent(true); |
127 |
|
timetables.add(timetable); |
128 |
|
|
129 |
|
timetable = new TimetableBean(); |
130 |
|
timetable.setStation("Pløresødal lejren"); |
131 |
|
timetable.setArrival("09:02"); |
132 |
|
timetable.setDeparture(""); |
133 |
|
timetable.setCurrent(false); |
134 |
|
timetables.add(timetable); |
135 |
|
|
136 |
|
return timetables; |
137 |
|
} |
138 |
|
|
139 |
|
|
140 |
} |
} |