--- android/TrainInfo/src/dk/thoerup/traininfo/provider/DebugProvider.java 2009/09/11 12:24:53 319 +++ android/TrainInfo/src/dk/thoerup/traininfo/provider/DebugProvider.java 2011/03/31 17:39:20 1249 @@ -1,53 +1,177 @@ 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; +public class DebugProvider implements DepartureProvider, StationProvider, TimetableProvider, MetroProvider { -public class DebugProvider implements DepartureProvider { - - @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,String type) { + 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); + departure.setNote("Kun st�pladser"); + bean.entries.add(departure); + + + + return bean; + } + + + public StationBean getStations() { + StationBean stations = new StationBean(); + + StationEntry station = new StationEntry(); + station.setName("Andeby"); + station.setCalcdist(1700); + station.setId(1); + station.setLatitude(56.0); + station.setLongitude(10.0); + station.setIsRegional(true); + stations.entries.add(station); + + station = new StationEntry(); + station.setName("GÃ¥serød"); + station.setCalcdist(5300); + station.setId(2); + station.setLatitude(58.0); + station.setLongitude(10.0); + station.setIsRegional(true); + stations.entries.add(station); + + station = new StationEntry(); + station.setName("Pladerballe"); + station.setCalcdist(15600); + station.setId(3); + station.setLatitude(52.0); + station.setLongitude(11.0); + station.setIsRegional(true); + station.setIsMetro(true); + stations.entries.add(station); + + return stations; + } + + @Override + public StationBean lookupStationsByLocation(Location location) { + return getStations(); + } + + @Override + public StationBean lookupStationsByName(String name) { + return getStations(); + } + + + + @Override + public StationBean lookupStationsByIds(String ids) { + return getStations(); + } + + @Override + public TimetableBean lookupTimetable(String type, String trainID) { + TimetableBean timetables = new TimetableBean(); + + TimetableEntry timetable = new TimetableEntry(); + timetable.setStation("Andeby"); + timetable.setArrival(""); + timetable.setDeparture("05:17"); + timetable.setCurrent(false); + timetables.entries.add(timetable); + + timetable = new TimetableEntry(); + timetable.setStation("GÃ¥serød"); + timetable.setArrival("07:45"); + timetable.setDeparture("07:46"); + timetable.setCurrent(false); + timetables.entries.add(timetable); + + timetable = new TimetableEntry(); + timetable.setStation("Smallville"); + timetable.setArrival("08:32"); + timetable.setDeparture("08:32"); + timetable.setCurrent(true); + timetables.entries.add(timetable); + + timetable = new TimetableEntry(); + timetable.setStation("Pløresødal lejren"); + timetable.setArrival("09:02"); + timetable.setDeparture(""); + timetable.setCurrent(false); + timetables.entries.add(timetable); + + return timetables; + } + + + @Override + 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 list; + return metro; } + + @Override + public void purgeOldEntries() { + // TODO Auto-generated method stub + } + + }