/[projects]/android/TrainInfo/src/dk/thoerup/traininfo/provider/DebugProvider.java
ViewVC logotype

Contents of /android/TrainInfo/src/dk/thoerup/traininfo/provider/DebugProvider.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1007 - (show annotations) (download)
Tue Aug 3 06:12:10 2010 UTC (13 years, 9 months ago) by torben
File size: 3780 byte(s)
switch the last 2 xml providers away from 2-step lookup
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 {
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 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 }

  ViewVC Help
Powered by ViewVC 1.1.20