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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 835 by torben, Fri Jun 11 14:05:24 2010 UTC revision 1066 by torben, Thu Sep 16 15:32:42 2010 UTC
# Line 1  Line 1 
1  package dk.thoerup.traininfo.provider;  package dk.thoerup.traininfo.provider;
2    
 import java.util.ArrayList;  
 import java.util.List;  
   
3  import android.location.Location;  import android.location.Location;
4    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 {
 import dk.thoerup.traininfo.StationBean;  
 import dk.thoerup.traininfo.TimetableBean;  
   
 public class DebugProvider implements DepartureProvider, StationProvider, TimetableProvider {  
14    
         @Override  
         public boolean lookupDepartures(int station, boolean arrival) {  
                 return true;  
         }        
15                    
16          @Override          @Override
17          public List<DepartureBean> getDepartures(int station, boolean arrival) {          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 list;                  return bean;
52          }          }
53    
54          @Override          
55          public List<StationBean> getStations() {          public StationBean getStations() {
56                  List<StationBean> stations = new ArrayList<StationBean>();                  StationBean stations = new StationBean();
57                                    
58                  StationBean station = new StationBean();                  StationEntry station = new StationEntry();
59                  station.setName("Andeby");                                station.setName("Andeby");              
60                  station.setDistance(1700);                                station.setCalcdist(1700);              
61                  station.setId(1);                  station.setId(1);
62                  station.setLatitude(56.0);                  station.setLatitude(56.0);
63                  station.setLongitude(10.0);                              station.setLongitude(10.0);            
64                  station.setRegional(true);                  station.setIsRegional(true);
65                  stations.add(station);                  stations.entries.add(station);
66                                    
67                  station = new StationBean();                  station = new StationEntry();
68                  station.setName("Gåserød");                            station.setName("Gåserød");          
69                  station.setDistance(5300);                                station.setCalcdist(5300);              
70                  station.setId(2);                  station.setId(2);
71                  station.setLatitude(58.0);                  station.setLatitude(58.0);
72                  station.setLongitude(10.0);                  station.setLongitude(10.0);
73                  station.setRegional(true);                  station.setIsRegional(true);
74                  stations.add(station);                  stations.entries.add(station);
75                                    
76                  station = new StationBean();                  station = new StationEntry();
77                  station.setName("Pladerballe");                          station.setName("Pladerballe");        
78                  station.setDistance(15600);                              station.setCalcdist(15600);            
79                  station.setId(3);                  station.setId(3);
80                  station.setLatitude(52.0);                  station.setLatitude(52.0);
81                  station.setLongitude(11.0);                  station.setLongitude(11.0);
82                  station.setRegional(true);                  station.setIsRegional(true);
83                  stations.add(station);                  station.setIsMetro(true);
84                    stations.entries.add(station);
85                                    
86                  return stations;                  return stations;
87          }          }
88    
89          @Override          @Override
90          public boolean lookupStations(Location location) {          public StationBean lookupStations(Location location) {
91                  return true;                  return getStations();
92          }          }
93                    
94          @Override          @Override
95          public boolean lookupStationsByName(String name) {          public StationBean lookupStationsByName(String name) {
96                  return true;                  return getStations();
97          }          }
98                    
99                    
100    
101          @Override          @Override
102          public boolean lookupStationsByIds(String ids) {          public StationBean lookupStationsByIds(String ids) {
103                  return true;                  return getStations();
104          }          }
105    
106          @Override          @Override
107          public List<TimetableBean> getTimetable(String type, String trainID) {          public TimetableBean lookupTimetable(String type, String trainID) {
108                  List<TimetableBean> timetables = new ArrayList<TimetableBean>();                  TimetableBean timetables = new TimetableBean();
109                                    
110                  TimetableBean timetable = new TimetableBean();                  TimetableEntry timetable = new TimetableEntry();
111                  timetable.setStation("Andeby");                  timetable.setStation("Andeby");
112                  timetable.setArrival("");                  timetable.setArrival("");
113                  timetable.setDeparture("05:17");                  timetable.setDeparture("05:17");
114                  timetable.setCurrent(false);                  timetable.setCurrent(false);
115                  timetables.add(timetable);                  timetables.entries.add(timetable);
116                                    
117                  timetable = new TimetableBean();                  timetable = new TimetableEntry();
118                  timetable.setStation("Gåserød");                  timetable.setStation("Gåserød");
119                  timetable.setArrival("07:45");                  timetable.setArrival("07:45");
120                  timetable.setDeparture("07:46");                  timetable.setDeparture("07:46");
121                  timetable.setCurrent(false);                  timetable.setCurrent(false);
122                  timetables.add(timetable);                  timetables.entries.add(timetable);
123    
124                  timetable = new TimetableBean();                  timetable = new TimetableEntry();
125                  timetable.setStation("Smallville");                  timetable.setStation("Smallville");
126                  timetable.setArrival("08:32");                  timetable.setArrival("08:32");
127                  timetable.setDeparture("08:32");                  timetable.setDeparture("08:32");
128                  timetable.setCurrent(true);                  timetable.setCurrent(true);
129                  timetables.add(timetable);                  timetables.entries.add(timetable);
130    
131                  timetable = new TimetableBean();                  timetable = new TimetableEntry();
132                  timetable.setStation("Pløresødal lejren");                  timetable.setStation("Pløresødal lejren");
133                  timetable.setArrival("09:02");                  timetable.setArrival("09:02");
134                  timetable.setDeparture("");                  timetable.setDeparture("");
135                  timetable.setCurrent(false);                  timetable.setCurrent(false);
136                  timetables.add(timetable);                  timetables.entries.add(timetable);
137                                    
138                  return timetables;                  return timetables;
139          }          }
140    
141    
142          @Override          @Override
143          public boolean lookupTimetable(String type, String trainID) {          public MetroBean lookupMetroInfo(int stationID) {
144                  return true;                  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                    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  }  }

Legend:
Removed from v.835  
changed lines
  Added in v.1066

  ViewVC Help
Powered by ViewVC 1.1.20