package ch.epfl.isochrone.tiledmap;


public class CachedTileProvider implements TileProvider{
    private TileProvider tp;
    private TileCache cache;
    
    public CachedTileProvider(TileProvider tp)
    {
        this.tp=tp;
        this.cache=new TileCache();
    }

    @Override
    public Tile tileAt(int zoom, int x, int y) {
        Tile t = cache.get(zoom, x, y);
        
        
            
        
        if (t==null)
        {
            t = tp.tileAt(zoom, x, y);
            cache.put(zoom, x, y, t);
        }
        
        
        
        return t;
    }
}
