Changeset 3355


Ignore:
Timestamp:
11/09/07 13:08:59 (12 years ago)
Author:
melissa
Message:
  • Added two new API methods - 'boolean isInCache(int[])' and 'boolean isInCache(int)'. Both return true if the plane at the given position is currently in the cache.
  • Uncommented calls to recache().
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/formats/cache/Cache.java

    r3015 r3355  
    6060    listeners = new Vector(); 
    6161    reset(); 
     62    recache(); 
    6263  } 
    6364 
     
    7374    int ndx = FormatTools.positionToRaster(strategy.getLengths(), pos); 
    7475    return cache[ndx]; 
     76  } 
     77 
     78  /** 
     79   * Returns true if the object at the given dimensional position is 
     80   * in the cache. 
     81   */ 
     82  public boolean isInCache(int[] pos) throws CacheException { 
     83    return isInCache(FormatTools.positionToRaster(strategy.getLengths(), pos)); 
     84  } 
     85 
     86  /** Returns true if the object at the given index is in the cache. */ 
     87  public boolean isInCache(int pos) throws CacheException { 
     88    return inCache[pos]; 
    7589  } 
    7690 
     
    103117    this.strategy = strategy; 
    104118    notifyListeners(new CacheEvent(this, CacheEvent.STRATEGY_CHANGED)); 
    105 //    reset(); 
    106 //    recache(); 
     119    reset(); 
     120    recache(); 
    107121  } 
    108122 
     
    112126    this.source = source; 
    113127    notifyListeners(new CacheEvent(this, CacheEvent.SOURCE_CHANGED)); 
    114 //    reset(); 
    115 //    recache(); 
     128    reset(); 
     129    recache(); 
    116130  } 
    117131 
     
    133147    int ndx = FormatTools.positionToRaster(len, pos); 
    134148    notifyListeners(new CacheEvent(this, CacheEvent.POSITION_CHANGED, ndx)); 
    135 //    recache(); 
     149    recache(); 
    136150  } 
    137151 
Note: See TracChangeset for help on using the changeset viewer.