/[projects]/android/TrainInfoService/src/dk/thoerup/traininfoservice/banedk/TimeoutMap.java
ViewVC logotype

Diff of /android/TrainInfoService/src/dk/thoerup/traininfoservice/banedk/TimeoutMap.java

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

revision 428 by torben, Fri Oct 9 08:52:37 2009 UTC revision 432 by torben, Sat Oct 10 09:56:10 2009 UTC
# Line 1  Line 1 
1  package dk.thoerup.traininfoservice.banedk;  package dk.thoerup.traininfoservice.banedk;
2    
3  import java.util.concurrent.ConcurrentHashMap;  import java.util.ArrayList;
4  import java.util.Collection;  import java.util.Collection;
5  import java.util.Map;  import java.util.Map;
6  import java.util.Set;  import java.util.Set;
7    import java.util.concurrent.ConcurrentHashMap;
8    
9    
 import com.sun.xml.rpc.processor.schema.UnimplementedFeatureException;  
10    
11  public class TimeoutMap<K,V> implements Map<K,V>{  public class TimeoutMap<K,V> implements Map<K,V>{
12    
# Line 43  public class TimeoutMap<K,V> implements Line 44  public class TimeoutMap<K,V> implements
44    
45          @Override          @Override
46          public boolean containsValue(Object arg0) {          public boolean containsValue(Object arg0) {
47                  //TODO someday implement this                  return values().contains(arg0);        
                 throw new UnsupportedOperationException();  
                   
48          }          }
49    
50          @Override          @Override
# Line 66  public class TimeoutMap<K,V> implements Line 65  public class TimeoutMap<K,V> implements
65    
66          @Override          @Override
67          public void putAll(Map<? extends K, ? extends V> arg0) {          public void putAll(Map<? extends K, ? extends V> arg0) {
68                  //TODO someday implement this                  for(K key : arg0.keySet()) {
69                  throw new UnsupportedOperationException();                          this.put(key, arg0.get(key) );
70                    }
71          }          }
72    
73          @Override          @Override
# Line 82  public class TimeoutMap<K,V> implements Line 82  public class TimeoutMap<K,V> implements
82    
83          @Override          @Override
84          public Collection<V> values() {          public Collection<V> values() {
85                  //TODO someday implement this                  ArrayList<V> values = new ArrayList<V>();
86                  throw new UnsupportedOperationException();                  for (CacheItem<V> item : cache.values()) {
87                            values.add( item.value );
88                    }
89                    
90                    return values;
91    
92          }          }
93    
94          @Override          @Override
# Line 108  public class TimeoutMap<K,V> implements Line 113  public class TimeoutMap<K,V> implements
113          public V put(K key, V value) {                    public V put(K key, V value) {          
114                  CacheItem<V> item= new CacheItem<V>(value);                  CacheItem<V> item= new CacheItem<V>(value);
115                                    
116                  return cache.put(key, item).value;                  item = cache.put(key, item);
117                    
118                    if (item != null)
119                            return item.value;
120                    else
121                            return null;
122          }          }
123                    
124  }  }

Legend:
Removed from v.428  
changed lines
  Added in v.432

  ViewVC Help
Powered by ViewVC 1.1.20