1 |
package dk.thoerup.traininfo.provider; |
package dk.thoerup.traininfo.provider; |
2 |
|
|
3 |
import java.util.ArrayList; |
import android.location.Location; |
4 |
import java.util.List; |
import dk.thoerup.android.traininfo.common.DepartureBean; |
5 |
|
import dk.thoerup.android.traininfo.common.DepartureEntry; |
6 |
|
import dk.thoerup.android.traininfo.common.MetroBean; |
7 |
|
import dk.thoerup.android.traininfo.common.StationBean; |
8 |
|
import dk.thoerup.android.traininfo.common.TimetableBean; |
9 |
|
import dk.thoerup.android.traininfo.common.TimetableEntry; |
10 |
|
import dk.thoerup.android.traininfo.common.MetroBean.MetroEntry; |
11 |
|
import dk.thoerup.android.traininfo.common.StationBean.StationEntry; |
12 |
|
|
13 |
import dk.thoerup.traininfo.DepartureBean; |
public class DebugProvider implements DepartureProvider, StationProvider, TimetableProvider, MetroProvider { |
14 |
|
|
|
public class DebugProvider implements DepartureProvider { |
|
|
|
|
|
@Override |
|
|
public boolean lookupDepartures(int station) { |
|
|
return true; |
|
|
} |
|
15 |
|
|
16 |
@Override |
@Override |
17 |
public List<DepartureBean> getDepartures(int station) { |
public DepartureBean lookupDepartures(int station, boolean arrival) { |
18 |
List<DepartureBean> list = new ArrayList<DepartureBean>(); |
DepartureBean bean = new DepartureBean(); |
19 |
|
|
20 |
DepartureBean departure = new DepartureBean(); |
DepartureEntry departure = new DepartureEntry(); |
21 |
departure.setTime("08:03"); |
departure.setTime("08:03"); |
22 |
departure.setDestination("Dar-es Salaam"); |
departure.setDestination("Dar-es Salaam"); |
23 |
departure.setOrigin("Sao Paulo"); |
departure.setOrigin("Sao Paulo"); |
24 |
departure.setLocation("Beijing"); |
departure.setLocation("Beijing"); |
25 |
departure.setLastUpdate("1"); |
departure.setUpdated(1); |
26 |
departure.setTrainNumber("RA-123"); |
departure.setTrainNumber("RA-123"); |
27 |
list.add(departure); |
bean.entries.add(departure); |
28 |
|
|
29 |
departure = new DepartureBean(); |
departure = new DepartureEntry(); |
30 |
departure.setTime("13:39"); |
departure.setTime("13:39"); |
31 |
departure.setDestination("Timbuktu"); |
departure.setDestination("Timbuktu"); |
32 |
departure.setOrigin("Anchorage"); |
departure.setOrigin("Anchorage"); |
33 |
departure.setLocation("Helsinki"); |
departure.setLocation("Helsinki"); |
34 |
departure.setLastUpdate("2"); |
departure.setUpdated(2); |
35 |
departure.setTrainNumber("IC-7"); |
departure.setTrainNumber("IC-7"); |
36 |
departure.setStatus("2 days delayed"); |
departure.setStatus("2 days delayed"); |
37 |
list.add(departure); |
bean.entries.add(departure); |
38 |
|
|
39 |
departure = new DepartureBean(); |
departure = new DepartureEntry(); |
40 |
departure.setTime("21:41"); |
departure.setTime("21:41"); |
41 |
departure.setDestination("Skive"); |
departure.setDestination("Skive"); |
42 |
departure.setOrigin("Virksund"); |
departure.setOrigin("Virksund"); |
43 |
departure.setLocation("Hald"); |
departure.setLocation("Hald"); |
44 |
departure.setLastUpdate("2"); |
departure.setUpdated(2); |
45 |
departure.setTrainNumber("IC-7"); |
departure.setTrainNumber("IC-7"); |
46 |
departure.setNote("Kun ståpladser"); |
departure.setNote("Kun st�pladser"); |
47 |
list.add(departure); |
bean.entries.add(departure); |
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
return bean; |
52 |
|
} |
53 |
|
|
54 |
|
|
55 |
|
public StationBean getStations() { |
56 |
|
StationBean stations = new StationBean(); |
57 |
|
|
58 |
|
StationEntry station = new StationEntry(); |
59 |
|
station.setName("Andeby"); |
60 |
|
station.setCalcdist(1700); |
61 |
|
station.setId(1); |
62 |
|
station.setLatitude(56.0); |
63 |
|
station.setLongitude(10.0); |
64 |
|
station.setIsRegional(true); |
65 |
|
stations.entries.add(station); |
66 |
|
|
67 |
|
station = new StationEntry(); |
68 |
|
station.setName("Gåserød"); |
69 |
|
station.setCalcdist(5300); |
70 |
|
station.setId(2); |
71 |
|
station.setLatitude(58.0); |
72 |
|
station.setLongitude(10.0); |
73 |
|
station.setIsRegional(true); |
74 |
|
stations.entries.add(station); |
75 |
|
|
76 |
|
station = new StationEntry(); |
77 |
|
station.setName("Pladerballe"); |
78 |
|
station.setCalcdist(15600); |
79 |
|
station.setId(3); |
80 |
|
station.setLatitude(52.0); |
81 |
|
station.setLongitude(11.0); |
82 |
|
station.setIsRegional(true); |
83 |
|
station.setIsMetro(true); |
84 |
|
stations.entries.add(station); |
85 |
|
|
86 |
|
return stations; |
87 |
|
} |
88 |
|
|
89 |
|
@Override |
90 |
|
public StationBean lookupStations(Location location) { |
91 |
|
return getStations(); |
92 |
|
} |
93 |
|
|
94 |
|
@Override |
95 |
|
public StationBean lookupStationsByName(String name) { |
96 |
|
return getStations(); |
97 |
|
} |
98 |
|
|
99 |
|
|
100 |
|
|
101 |
|
@Override |
102 |
|
public StationBean lookupStationsByIds(String ids) { |
103 |
|
return getStations(); |
104 |
|
} |
105 |
|
|
106 |
|
@Override |
107 |
|
public TimetableBean lookupTimetable(String type, String trainID) { |
108 |
|
TimetableBean timetables = new TimetableBean(); |
109 |
|
|
110 |
|
TimetableEntry timetable = new TimetableEntry(); |
111 |
|
timetable.setStation("Andeby"); |
112 |
|
timetable.setArrival(""); |
113 |
|
timetable.setDeparture("05:17"); |
114 |
|
timetable.setCurrent(false); |
115 |
|
timetables.entries.add(timetable); |
116 |
|
|
117 |
|
timetable = new TimetableEntry(); |
118 |
|
timetable.setStation("Gåserød"); |
119 |
|
timetable.setArrival("07:45"); |
120 |
|
timetable.setDeparture("07:46"); |
121 |
|
timetable.setCurrent(false); |
122 |
|
timetables.entries.add(timetable); |
123 |
|
|
124 |
|
timetable = new TimetableEntry(); |
125 |
|
timetable.setStation("Smallville"); |
126 |
|
timetable.setArrival("08:32"); |
127 |
|
timetable.setDeparture("08:32"); |
128 |
|
timetable.setCurrent(true); |
129 |
|
timetables.entries.add(timetable); |
130 |
|
|
131 |
|
timetable = new TimetableEntry(); |
132 |
|
timetable.setStation("Pløresødal lejren"); |
133 |
|
timetable.setArrival("09:02"); |
134 |
|
timetable.setDeparture(""); |
135 |
|
timetable.setCurrent(false); |
136 |
|
timetables.entries.add(timetable); |
137 |
|
|
138 |
|
return timetables; |
139 |
|
} |
140 |
|
|
141 |
|
|
142 |
|
@Override |
143 |
|
public MetroBean lookupMetroInfo(int stationID) { |
144 |
|
MetroBean metro = new MetroBean(); |
145 |
|
|
146 |
|
metro.operationInfo = "Metroen kører normalt og uden forsinkelser."; |
147 |
|
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."; |
148 |
|
|
149 |
return list; |
MetroEntry ent = new MetroEntry(); |
150 |
|
ent.metro = "M1M2"; |
151 |
|
ent.destination = "Mod Vanløse"; |
152 |
|
ent.minutes = "0,5 2 3"; |
153 |
|
metro.entries.add(ent); |
154 |
|
|
155 |
|
ent = new MetroEntry(); |
156 |
|
ent.metro = "M1"; |
157 |
|
ent.destination = "Mod Vestamager"; |
158 |
|
ent.minutes = "0,5 6"; |
159 |
|
metro.entries.add(ent); |
160 |
|
|
161 |
|
ent = new MetroEntry(); |
162 |
|
ent.metro = "M2"; |
163 |
|
ent.destination = "Mod Lufthavnen"; |
164 |
|
ent.minutes = "3"; |
165 |
|
metro.entries.add(ent); |
166 |
|
|
167 |
|
return metro; |
168 |
} |
} |
169 |
|
|
170 |
|
|
171 |
} |
} |