1 |
package dk.thoerup.traininfo.provider;
|
2 |
|
3 |
import java.util.ArrayList;
|
4 |
import java.util.List;
|
5 |
|
6 |
import android.location.Location;
|
7 |
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, StationProvider, TimetableProvider, MetroProvider {
|
13 |
|
14 |
|
15 |
@Override
|
16 |
public DepartureBean lookupDepartures(int station, boolean arrival) {
|
17 |
DepartureBean bean = new DepartureBean();
|
18 |
|
19 |
DepartureEntry departure = new DepartureEntry();
|
20 |
departure.setTime("08:03");
|
21 |
departure.setDestination("Dar-es Salaam");
|
22 |
departure.setOrigin("Sao Paulo");
|
23 |
departure.setLocation("Beijing");
|
24 |
departure.setLastUpdate("1");
|
25 |
departure.setTrainNumber("RA-123");
|
26 |
bean.entries.add(departure);
|
27 |
|
28 |
departure = new DepartureEntry();
|
29 |
departure.setTime("13:39");
|
30 |
departure.setDestination("Timbuktu");
|
31 |
departure.setOrigin("Anchorage");
|
32 |
departure.setLocation("Helsinki");
|
33 |
departure.setLastUpdate("2");
|
34 |
departure.setTrainNumber("IC-7");
|
35 |
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 |
|
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 |
station.setMetro(true);
|
83 |
stations.add(station);
|
84 |
|
85 |
return stations;
|
86 |
}
|
87 |
|
88 |
@Override
|
89 |
public List<StationBean> lookupStations(Location location) {
|
90 |
return getStations();
|
91 |
}
|
92 |
|
93 |
@Override
|
94 |
public List<StationBean> lookupStationsByName(String name) {
|
95 |
return getStations();
|
96 |
}
|
97 |
|
98 |
|
99 |
|
100 |
@Override
|
101 |
public List<StationBean> lookupStationsByIds(String ids) {
|
102 |
return getStations();
|
103 |
}
|
104 |
|
105 |
@Override
|
106 |
public List<TimetableBean> lookupTimetable(String type, String trainID) {
|
107 |
List<TimetableBean> timetables = new ArrayList<TimetableBean>();
|
108 |
|
109 |
TimetableBean timetable = new TimetableBean();
|
110 |
timetable.setStation("Andeby");
|
111 |
timetable.setArrival("");
|
112 |
timetable.setDeparture("05:17");
|
113 |
timetable.setCurrent(false);
|
114 |
timetables.add(timetable);
|
115 |
|
116 |
timetable = new TimetableBean();
|
117 |
timetable.setStation("Gåserød");
|
118 |
timetable.setArrival("07:45");
|
119 |
timetable.setDeparture("07:46");
|
120 |
timetable.setCurrent(false);
|
121 |
timetables.add(timetable);
|
122 |
|
123 |
timetable = new TimetableBean();
|
124 |
timetable.setStation("Smallville");
|
125 |
timetable.setArrival("08:32");
|
126 |
timetable.setDeparture("08:32");
|
127 |
timetable.setCurrent(true);
|
128 |
timetables.add(timetable);
|
129 |
|
130 |
timetable = new TimetableBean();
|
131 |
timetable.setStation("Pløresødal lejren");
|
132 |
timetable.setArrival("09:02");
|
133 |
timetable.setDeparture("");
|
134 |
timetable.setCurrent(false);
|
135 |
timetables.add(timetable);
|
136 |
|
137 |
return timetables;
|
138 |
}
|
139 |
|
140 |
|
141 |
@Override
|
142 |
public MetroBean lookupMetroInfo(int stationID) {
|
143 |
MetroBean metro = new MetroBean();
|
144 |
|
145 |
metro.operationInfo = "Metroen kører normalt og uden forsinkelser.";
|
146 |
metro.plan = "Dag-/aftendrift. Metroen kører hvert 3. minut mellem Vanløse og Christianshavn - og hvert 6. minut til og fra Vestamager og Lufthavnen.";
|
147 |
|
148 |
MetroEntry ent = new MetroEntry();
|
149 |
ent.metro = "M1M2";
|
150 |
ent.destination = "Mod Vanløse";
|
151 |
ent.minutes = "0,5 2 3";
|
152 |
metro.entries.add(ent);
|
153 |
|
154 |
ent = new MetroEntry();
|
155 |
ent.metro = "M1";
|
156 |
ent.destination = "Mod Vestamager";
|
157 |
ent.minutes = "0,5 6";
|
158 |
metro.entries.add(ent);
|
159 |
|
160 |
ent = new MetroEntry();
|
161 |
ent.metro = "M2";
|
162 |
ent.destination = "Mod Lufthavnen";
|
163 |
ent.minutes = "3";
|
164 |
metro.entries.add(ent);
|
165 |
|
166 |
return metro;
|
167 |
}
|
168 |
|
169 |
|
170 |
}
|