public abstract class CacheStrategy extends java.lang.Object implements CacheReporter, java.util.Comparator, ICacheStrategy
| Modifier and Type | Field and Description | 
|---|---|
static int | 
DEFAULT_RANGE
Default cache range. 
 | 
private boolean | 
dirty
Whether load order array needs to be recomputed
 before building the next load list. 
 | 
protected int[] | 
lengths
Length of each dimensional axis. 
 | 
protected java.util.Vector | 
listeners
List of cache event listeners. 
 | 
protected int[] | 
order
The order in which planes should be loaded along each axis. 
 | 
private int[][] | 
positions
The list of dimensional positions to consider caching, in order of
 preference based on strategy, axis priority and planar ordering. 
 | 
protected int[] | 
priorities
Priority for caching each axis. 
 | 
protected int[] | 
range
Number of planes to cache along each axis. 
 | 
BACKWARD_ORDER, CENTERED_ORDER, FORWARD_ORDER, HIGH_PRIORITY, LOW_PRIORITY, MAX_PRIORITY, MIN_PRIORITY, NORMAL_PRIORITY| Constructor and Description | 
|---|
CacheStrategy(int[] lengths)
Constructs a cache strategy. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
addCacheListener(CacheListener l)
Adds a listener for status update events. 
 | 
int | 
compare(java.lang.Object o1,
       java.lang.Object o2)
Default comparator orders dimensional positions based on distance from the
 current position, taking into account axis priorities and planar ordering. 
 | 
int | 
distance(int axis,
        int value)
Computes the distance from the given axis value to the
 axis center, taking into account the axis ordering scheme. 
 | 
CacheListener[] | 
getCacheListeners()
Gets a list of all registered status update listeners. 
 | 
int[] | 
getLengths()
Gets the lengths of all the axes. 
 | 
int[][] | 
getLoadList(int[] pos)
Gets the indices of the objects to cache,
 surrounding the object at the given position. 
 | 
int[] | 
getOrder()
Retrieves the order in which objects should be loaded along each axis. 
 | 
protected abstract int[][] | 
getPossiblePositions()
Gets positions to consider for possible inclusion in the cache,
 assuming a current position at the origin (0). 
 | 
int[] | 
getPriorities()
Retrieves the priority for caching each axis. 
 | 
int[] | 
getRange()
Retrieves the number of objects to cache along each axis. 
 | 
protected int | 
length()
Shortcut for computing total number of positions. 
 | 
protected void | 
notifyListeners(CacheEvent e)
Informs listeners of a cache update. 
 | 
protected int[] | 
pos(int raster)
Shortcut for converting rasterized position to N-D position. 
 | 
protected int[] | 
pos(int raster,
   int[] pos)
Shortcut for converting rasterized position to N-D position,
 using the given array instead of allocating a new one. 
 | 
protected int | 
raster(int[] pos)
Shortcut for converting N-D position to rasterized position. 
 | 
void | 
removeCacheListener(CacheListener l)
Removes a listener for status update events. 
 | 
void | 
setOrder(int order,
        int axis)
Sets the order in which objects should be loaded along each axis. 
 | 
void | 
setPriority(int priority,
           int axis)
Sets the priority for caching the given axis. 
 | 
void | 
setRange(int num,
        int axis)
Sets the number of objects to cache along the given axis. 
 | 
public static final int DEFAULT_RANGE
protected int[] lengths
protected int[] order
protected int[] range
protected int[] priorities
private int[][] positions
private boolean dirty
protected java.util.Vector listeners
protected abstract int[][] getPossiblePositions()
public int distance(int axis,
                    int value)
protected int raster(int[] pos)
protected int[] pos(int raster)
protected int[] pos(int raster,
                    int[] pos)
protected int length()
public void addCacheListener(CacheListener l)
CacheReporteraddCacheListener in interface CacheReporterpublic void removeCacheListener(CacheListener l)
CacheReporterremoveCacheListener in interface CacheReporterpublic CacheListener[] getCacheListeners()
CacheReportergetCacheListeners in interface CacheReporterpublic int compare(java.lang.Object o1,
                   java.lang.Object o2)
compare in interface java.util.Comparatorpublic int[][] getLoadList(int[] pos)
                    throws CacheException
ICacheStrategygetLoadList in interface ICacheStrategyCacheExceptionpublic int[] getPriorities()
ICacheStrategygetPriorities in interface ICacheStrategypublic void setPriority(int priority,
                        int axis)
ICacheStrategysetPriority in interface ICacheStrategypublic int[] getOrder()
ICacheStrategygetOrder in interface ICacheStrategypublic void setOrder(int order,
                     int axis)
ICacheStrategysetOrder in interface ICacheStrategyorder - One of:axis - The axis for which to set the order.public int[] getRange()
ICacheStrategygetRange in interface ICacheStrategypublic void setRange(int num,
                     int axis)
ICacheStrategysetRange in interface ICacheStrategypublic int[] getLengths()
ICacheStrategygetLengths in interface ICacheStrategyprotected void notifyListeners(CacheEvent e)
Copyright © 2022 Open Microscopy Environment