001    /*
002    // This software is subject to the terms of the Common Public License
003    // Agreement, available at the following URL:
004    // http://www.opensource.org/licenses/cpl.html.
005    // Copyright (C) 2004-2005 TONBELLER AG
006    // All Rights Reserved.
007    // You must accept the terms of that agreement to use this software.
008    */
009    package mondrian.rolap.cache;
010    
011    import java.util.*;
012    
013    /**
014     * An implementation of {@link SmartCache} that uses hard
015     * references. Used for testing.
016     *
017     * @version $Id: //open/mondrian/src/main/mondrian/rolap/cache/HardSmartCache.java#5 $
018     */
019    public class HardSmartCache <K, V> implements SmartCache <K, V> {
020        Map<K, V> cache = new HashMap<K, V>();
021    
022        public V put(K key, V value) {
023            return cache.put(key, value);
024        }
025    
026        public V get(K key) {
027            return cache.get(key);
028        }
029    
030        public void clear() {
031            cache.clear();
032        }
033    
034        public int size() {
035            return cache.size();
036        }
037    
038        public Iterator<Map.Entry<K, V>> iterator() {
039            return cache.entrySet().iterator();
040        }
041    }
042    
043    // End HardSmartCache.java