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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 381 - (hide annotations) (download)
Fri Oct 2 10:39:09 2009 UTC (14 years, 7 months ago) by torben
File size: 3188 byte(s)
Basic implementation of searchStationByName feature
1 torben 237 package dk.thoerup.traininfo.provider;
2    
3     import java.util.ArrayList;
4     import java.util.List;
5    
6 torben 363 import android.location.Location;
7    
8 torben 237 import dk.thoerup.traininfo.DepartureBean;
9 torben 363 import dk.thoerup.traininfo.StationBean;
10     import dk.thoerup.traininfo.TimetableBean;
11 torben 237
12 torben 363 public class DebugProvider implements DepartureProvider, StationProvider, TimetableProvider {
13 torben 237
14     @Override
15 torben 319 public boolean lookupDepartures(int station) {
16     return true;
17 torben 237 }
18    
19     @Override
20 torben 319 public List<DepartureBean> getDepartures(int station) {
21 torben 237 List<DepartureBean> list = new ArrayList<DepartureBean>();
22    
23     DepartureBean departure = new DepartureBean();
24 torben 244 departure.setTime("08:03");
25 torben 237 departure.setDestination("Dar-es Salaam");
26     departure.setOrigin("Sao Paulo");
27     departure.setLocation("Beijing");
28     departure.setLastUpdate("1");
29     departure.setTrainNumber("RA-123");
30     list.add(departure);
31    
32     departure = new DepartureBean();
33 torben 244 departure.setTime("13:39");
34 torben 237 departure.setDestination("Timbuktu");
35     departure.setOrigin("Anchorage");
36     departure.setLocation("Helsinki");
37     departure.setLastUpdate("2");
38     departure.setTrainNumber("IC-7");
39 torben 244 departure.setStatus("2 days delayed");
40 torben 237 list.add(departure);
41 torben 244
42     departure = new DepartureBean();
43     departure.setTime("21:41");
44     departure.setDestination("Skive");
45     departure.setOrigin("Virksund");
46     departure.setLocation("Hald");
47     departure.setLastUpdate("2");
48     departure.setTrainNumber("IC-7");
49 torben 363 departure.setNote("Kun st�pladser");
50 torben 244 list.add(departure);
51 torben 237
52 torben 244
53    
54 torben 237 return list;
55     }
56    
57 torben 363 @Override
58     public List<StationBean> getStations() {
59     List<StationBean> stations = new ArrayList<StationBean>();
60    
61     StationBean station = new StationBean();
62     station.setName("Andeby");
63     station.setDistance(1700);
64     station.setId(1);
65     station.setLatitude(56.0);
66     station.setLongitude(10.0);
67    
68     stations.add(station);
69    
70     return stations;
71     }
72    
73     @Override
74     public boolean lookupStations(Location location) {
75     return true;
76     }
77 torben 381
78     @Override
79     public boolean lookupStations(String name) {
80     return true;
81     }
82 torben 363
83     @Override
84     public List<TimetableBean> getTimetable() {
85     List<TimetableBean> timetables = new ArrayList<TimetableBean>();
86    
87     TimetableBean timetable = new TimetableBean();
88     timetable.setStation("Andeby");
89     timetable.setArrival("");
90     timetable.setDeparture("05:17");
91     timetable.setCurrent(false);
92     timetables.add(timetable);
93    
94     timetable = new TimetableBean();
95     timetable.setStation("Gåserød");
96     timetable.setArrival("07:45");
97     timetable.setDeparture("07:46");
98     timetable.setCurrent(false);
99     timetables.add(timetable);
100    
101     timetable = new TimetableBean();
102     timetable.setStation("Smallville");
103     timetable.setArrival("08:32");
104     timetable.setDeparture("08:32");
105     timetable.setCurrent(true);
106     timetables.add(timetable);
107    
108     timetable = new TimetableBean();
109     timetable.setStation("Pløresødal lejren");
110     timetable.setArrival("09:02");
111     timetable.setDeparture("");
112     timetable.setCurrent(false);
113     timetables.add(timetable);
114    
115     return timetables;
116     }
117    
118     @Override
119     public boolean lookupTimetable(String trainID) {
120     return true;
121     }
122    
123 torben 237 }

  ViewVC Help
Powered by ViewVC 1.1.20