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

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

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

revision 1026 by torben, Wed Sep 30 09:14:27 2009 UTC revision 1027 by torben, Wed Sep 8 06:03:45 2010 UTC
# Line 1  Line 1 
1  package dk.thoerup.traininfo.provider;  package dk.thoerup.traininfo.provider;
2    
3    
4    
5    
6  public class ProviderFactory {  public class ProviderFactory {
7          private static DepartureProvider departureProvider = null;          private static DepartureProvider departureProvider = null;
8          private static StationProvider stationProvider = null;          private static StationProvider stationProvider = null;
# Line 8  public class ProviderFactory { Line 10  public class ProviderFactory {
10                    
11          private static final boolean DEBUG = false;          private static final boolean DEBUG = false;
12                    
13            //TODO: this one really doesn't belong here ... and damn it is ugly code
14            public static void purgeOldEntries() {          
15                    synchronized (ProviderFactory.class) {
16                            if (stationProvider != null && stationProvider instanceof XmlStationProvider) {
17                                    ((XmlStationProvider)stationProvider).stationCache.purgeOldEntries();
18                            }
19                            
20                            if (departureProvider != null && departureProvider instanceof XmlDepartureProvider) {
21                                    ((XmlDepartureProvider)departureProvider).departureCache.purgeOldEntries();
22                            }
23                            
24                            if (timetableProvider != null && timetableProvider instanceof XmlTimetableProvider) {
25                                    ((XmlTimetableProvider)timetableProvider).timetableCache.purgeOldEntries();
26                            }
27                    }
28    
29            }
30            
31          public static DepartureProvider getDepartureProvider() {          public static DepartureProvider getDepartureProvider() {
32                  if (departureProvider == null) {                  if (departureProvider == null) {
33                          if (!DEBUG) {                          if (!DEBUG) {

Legend:
Removed from v.1026  
changed lines
  Added in v.1027

  ViewVC Help
Powered by ViewVC 1.1.20