--- android/TrainInfo/src/dk/thoerup/traininfo/provider/DebugProvider.java 2010/05/03 12:39:34 700 +++ android/TrainInfo/src/dk/thoerup/traininfo/provider/DebugProvider.java 2010/09/16 15:32:42 1066 @@ -1,148 +1,171 @@ package dk.thoerup.traininfo.provider; -import java.util.ArrayList; -import java.util.List; - import android.location.Location; +import dk.thoerup.android.traininfo.common.DepartureBean; +import dk.thoerup.android.traininfo.common.DepartureEntry; +import dk.thoerup.android.traininfo.common.MetroBean; +import dk.thoerup.android.traininfo.common.StationBean; +import dk.thoerup.android.traininfo.common.TimetableBean; +import dk.thoerup.android.traininfo.common.TimetableEntry; +import dk.thoerup.android.traininfo.common.MetroBean.MetroEntry; +import dk.thoerup.android.traininfo.common.StationBean.StationEntry; -import dk.thoerup.traininfo.DepartureBean; -import dk.thoerup.traininfo.StationBean; -import dk.thoerup.traininfo.TimetableBean; - -public class DebugProvider implements DepartureProvider, StationProvider, TimetableProvider { +public class DebugProvider implements DepartureProvider, StationProvider, TimetableProvider, MetroProvider { - @Override - public boolean lookupDepartures(int station) { - return true; - } @Override - public List getDepartures(int station) { - List list = new ArrayList(); + public DepartureBean lookupDepartures(int station, boolean arrival) { + DepartureBean bean = new DepartureBean(); - DepartureBean departure = new DepartureBean(); + DepartureEntry departure = new DepartureEntry(); departure.setTime("08:03"); departure.setDestination("Dar-es Salaam"); departure.setOrigin("Sao Paulo"); departure.setLocation("Beijing"); - departure.setLastUpdate("1"); + departure.setUpdated(1); departure.setTrainNumber("RA-123"); - list.add(departure); + bean.entries.add(departure); - departure = new DepartureBean(); + departure = new DepartureEntry(); departure.setTime("13:39"); departure.setDestination("Timbuktu"); departure.setOrigin("Anchorage"); departure.setLocation("Helsinki"); - departure.setLastUpdate("2"); + departure.setUpdated(2); departure.setTrainNumber("IC-7"); departure.setStatus("2 days delayed"); - list.add(departure); + bean.entries.add(departure); - departure = new DepartureBean(); + departure = new DepartureEntry(); departure.setTime("21:41"); departure.setDestination("Skive"); departure.setOrigin("Virksund"); departure.setLocation("Hald"); - departure.setLastUpdate("2"); + departure.setUpdated(2); departure.setTrainNumber("IC-7"); departure.setNote("Kun st�pladser"); - list.add(departure); + bean.entries.add(departure); - return list; + return bean; } - @Override - public List getStations() { - List stations = new ArrayList(); + + public StationBean getStations() { + StationBean stations = new StationBean(); - StationBean station = new StationBean(); + StationEntry station = new StationEntry(); station.setName("Andeby"); - station.setDistance(1700); + station.setCalcdist(1700); station.setId(1); station.setLatitude(56.0); station.setLongitude(10.0); - station.setRegional(true); - stations.add(station); + station.setIsRegional(true); + stations.entries.add(station); - station = new StationBean(); + station = new StationEntry(); station.setName("Gåserød"); - station.setDistance(5300); + station.setCalcdist(5300); station.setId(2); station.setLatitude(58.0); station.setLongitude(10.0); - station.setRegional(true); - stations.add(station); + station.setIsRegional(true); + stations.entries.add(station); - station = new StationBean(); + station = new StationEntry(); station.setName("Pladerballe"); - station.setDistance(15600); + station.setCalcdist(15600); station.setId(3); station.setLatitude(52.0); station.setLongitude(11.0); - station.setRegional(true); - stations.add(station); + station.setIsRegional(true); + station.setIsMetro(true); + stations.entries.add(station); return stations; } @Override - public boolean lookupStations(Location location) { - return true; + public StationBean lookupStations(Location location) { + return getStations(); } @Override - public boolean lookupStationsByName(String name) { - return true; + public StationBean lookupStationsByName(String name) { + return getStations(); } @Override - public boolean lookupStationsByIds(String ids) { - return true; + public StationBean lookupStationsByIds(String ids) { + return getStations(); } @Override - public List getTimetable(String type, String trainID) { - List timetables = new ArrayList(); + public TimetableBean lookupTimetable(String type, String trainID) { + TimetableBean timetables = new TimetableBean(); - TimetableBean timetable = new TimetableBean(); + TimetableEntry timetable = new TimetableEntry(); timetable.setStation("Andeby"); timetable.setArrival(""); timetable.setDeparture("05:17"); timetable.setCurrent(false); - timetables.add(timetable); + timetables.entries.add(timetable); - timetable = new TimetableBean(); + timetable = new TimetableEntry(); timetable.setStation("Gåserød"); timetable.setArrival("07:45"); timetable.setDeparture("07:46"); timetable.setCurrent(false); - timetables.add(timetable); + timetables.entries.add(timetable); - timetable = new TimetableBean(); + timetable = new TimetableEntry(); timetable.setStation("Smallville"); timetable.setArrival("08:32"); timetable.setDeparture("08:32"); timetable.setCurrent(true); - timetables.add(timetable); + timetables.entries.add(timetable); - timetable = new TimetableBean(); + timetable = new TimetableEntry(); timetable.setStation("Pløresødal lejren"); timetable.setArrival("09:02"); timetable.setDeparture(""); timetable.setCurrent(false); - timetables.add(timetable); + timetables.entries.add(timetable); return timetables; } + @Override - public boolean lookupTimetable(String type, String trainID) { - return true; + public MetroBean lookupMetroInfo(int stationID) { + MetroBean metro = new MetroBean(); + + metro.operationInfo = "Metroen kører normalt og uden forsinkelser."; + 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."; + + MetroEntry ent = new MetroEntry(); + ent.metro = "M1M2"; + ent.destination = "Mod Vanløse"; + ent.minutes = "0,5 2 3"; + metro.entries.add(ent); + + ent = new MetroEntry(); + ent.metro = "M1"; + ent.destination = "Mod Vestamager"; + ent.minutes = "0,5 6"; + metro.entries.add(ent); + + ent = new MetroEntry(); + ent.metro = "M2"; + ent.destination = "Mod Lufthavnen"; + ent.minutes = "3"; + metro.entries.add(ent); + + return metro; } + }