Changeset 2961


Ignore:
Timestamp:
07/10/07 17:01:16 (13 years ago)
Author:
curtis
Message:

A bunch of work on the caching logic. Still broken though.

Location:
trunk/loci/formats/cache
Files:
9 edited

Legend:

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

    r2952 r2961  
    88import loci.formats.*; 
    99 
    10 /** Retrieves BufferedImages from a file, using Bio-Formats. */ 
     10/** 
     11 * Retrieves BufferedImages from a data source (e.g., a file) using Bio-Formats. 
     12 */ 
    1113public class BufferedImageSource extends CacheSource { 
    1214 
    1315  // -- Fields -- 
    1416 
     17  /** Reader from which to draw BufferedImages. */ 
    1518  private IFormatReader reader; 
    1619 
    17   // -- Constructor -- 
     20  // -- Constructors -- 
    1821 
    19   public BufferedImageSource(Object o) throws CacheException { 
    20     super(o);  
    21     try { 
    22       if (o instanceof IFormatReader) reader = (IFormatReader) o; 
    23       else { 
    24         reader = new FileStitcher(); 
    25         reader.setId(o.toString());  
    26       }  
    27     } 
     22  /** Constructs a BufferedImage source from the given Bio-Formats reader. */ 
     23  public BufferedImageSource(IFormatReader r) throws CacheException { 
     24    super(r); 
     25    reader = r; 
     26  } 
     27 
     28  /** Constructs a BufferedImage source drawing from the given file. */ 
     29  public BufferedImageSource(String id) throws CacheException { 
     30    this(new FileStitcher()); 
     31    try { reader.setId(id); } 
    2832    catch (FormatException exc) { throw new CacheException(exc); } 
    2933    catch (IOException exc) { throw new CacheException(exc); } 
  • trunk/loci/formats/cache/ByteArraySource.java

    r2952 r2961  
    1313  // -- Fields -- 
    1414 
     15  /** Reader from which to draw byte arrays. */ 
    1516  private IFormatReader reader; 
    1617 
    17   // -- Constructor -- 
     18  // -- Constructors -- 
    1819 
    19   public ByteArraySource(Object o) throws CacheException { 
    20     super(o);  
    21     try { 
    22       if (o instanceof IFormatReader) reader = (IFormatReader) o; 
    23       else { 
    24         reader = new FileStitcher(); 
    25         reader.setId(o.toString());  
    26       }  
    27     } 
     20  /** Constructs a byte array source from the given Bio-Formats reader. */ 
     21  public ByteArraySource(IFormatReader r) throws CacheException { 
     22    super(r); 
     23    reader = r; 
     24  } 
     25 
     26  /** Constructs a byte array source drawing from the given file. */ 
     27  public ByteArraySource(String id) throws CacheException { 
     28    this(new FileStitcher()); 
     29    try { reader.setId(id); } 
    2830    catch (FormatException exc) { throw new CacheException(exc); } 
    2931    catch (IOException exc) { throw new CacheException(exc); } 
  • trunk/loci/formats/cache/Cache.java

    r2952 r2961  
    1313  // -- Fields -- 
    1414 
     15  /** Current cache strategy. */ 
    1516  private ICacheStrategy strategy; 
     17 
     18  /** Current cache source. */ 
    1619  private ICacheSource source; 
     20 
     21  /** Current dimensional position. */ 
    1722  private int[] currentPos; 
     23 
     24  /** Master array containing cached objects. */ 
    1825  private Object[] cache; 
     26 
     27  /** Whether each position is currently supposed to be cached. */ 
    1928  private boolean[] inCache; 
    2029 
    2130  // -- Constructors -- 
    2231 
    23   public Cache() { 
    24   } 
    25  
     32  /** Constructs an object cache with the given cache strategy and source. */ 
    2633  public Cache(ICacheStrategy strategy, ICacheSource source)  
    2734    throws CacheException 
    2835  { 
     36    if (strategy == null) throw new CacheException("strategy is null"); 
     37    if (source == null) throw new CacheException("source is null"); 
    2938    this.strategy = strategy; 
    3039    this.source = source; 
     
    3443  // -- Cache API methods -- 
    3544 
     45  /** Gets the cached object at the given dimensional position. */ 
    3646  public Object getObject(int[] pos) throws CacheException { 
    3747    if (pos.length != strategy.getLengths().length) { 
     
    4555  } 
    4656 
     57  /** Clears the cache. */ 
    4758  public void reset() throws CacheException { 
    4859    currentPos = new int[strategy.getLengths().length]; 
     
    5263  } 
    5364 
     65  /** Gets the cache's caching strategy. */ 
    5466  public ICacheStrategy getStrategy() { return strategy; } 
     67 
     68  /** Gets the cache's caching source. */ 
    5569  public ICacheSource getSource() { return source; } 
     70 
     71  /** Gets the current dimensional position. */ 
    5672  public int[] getCurrentPos() { return currentPos; } 
    5773 
     74  /** Sets the cache's caching strategy. */ 
    5875  public void setStrategy(ICacheStrategy strategy) throws CacheException { 
     76    if (strategy == null) throw new CacheException("strategy is null"); 
    5977    this.strategy = strategy; 
    60     if (source != null && strategy != null) reset();  
    61     if (currentPos != null) load(currentPos); 
    62   } 
    63  
     78    reset();  
     79    load(currentPos); 
     80  } 
     81 
     82  /** Sets the cache's caching source. */ 
    6483  public void setSource(ICacheSource source) throws CacheException { 
     84    if (source == null) throw new CacheException("source is null"); 
    6585    this.source = source; 
    66     if (source != null && strategy != null) reset();  
    67     if (currentPos != null) load(currentPos); 
     86    reset();  
     87    load(currentPos); 
     88  } 
     89 
     90  /** Sets the current dimensional position. */ 
     91  public void setCurrentPos(int[] pos) throws CacheException { 
     92    if (pos == null) throw new CacheException("pos is null"); 
     93    if (pos.length != currentPos.length) { 
     94      throw new CacheException("pos length mismatch (is " + 
     95        pos.length + ", expected " + currentPos.length); 
     96    } 
     97    int[] len = strategy.getLengths(); 
     98    for (int i=0; i<pos.length; i++) { 
     99      if (pos[i] < 0 || pos[i] >= len[i]) { 
     100        throw new CacheException("invalid pos[" + i + "] (is " + 
     101          pos[i] + ", expected [0, " + (len[i] - 1) + "])"); 
     102      } 
     103    } 
     104    System.arraycopy(pos, 0, currentPos, 0, pos.length); 
     105    load(currentPos); 
    68106  } 
    69107 
     
    72110  private void load(int[] pos) throws CacheException { 
    73111    int[][] indices = strategy.getLoadList(pos);  
     112    int[] len = strategy.getLengths(); 
    74113 
    75114    Arrays.fill(inCache, false); 
    76115    for (int i=0; i<indices.length; i++) { 
    77       int ndx = FormatTools.positionToRaster(strategy.getLengths(), indices[i]); 
     116      int ndx = FormatTools.positionToRaster(len, indices[i]); 
    78117      if (ndx >= 0) inCache[ndx] = true; 
    79118    }  
    80119 
    81120    for (int i=0; i<cache.length; i++) { 
    82       if (!inCache[i]) { 
    83         cache[i] = null; 
     121      if (!inCache[i]) cache[i] = null; 
     122    }     
     123 
     124    for (int i=0; i<indices.length; i++) { 
     125      int ndx = FormatTools.positionToRaster(len, indices[i]); 
     126      if (ndx >= 0 && cache[ndx] == null) { 
     127        cache[ndx] = source.getObject(len, indices[i]); 
    84128      }  
    85     }     
    86  
    87     for (int i=0; i<indices.length; i++) { 
    88       int ndx = FormatTools.positionToRaster(strategy.getLengths(), indices[i]); 
    89       if (ndx >= 0 && cache[ndx] == null) { 
    90         cache[ndx] = source.getObject(strategy.getLengths(), indices[i]); 
    91       }  
    92     } 
     129    } 
     130  } 
     131 
     132  /** Helper utility for outputting contents of an int array, used by main. */ 
     133  private static final void printArray(String name, int[] array) { 
     134    System.out.print(name + " ="); 
     135    for (int i=0; i<array.length; i++) System.out.print(" " + array[i]); 
     136    System.out.println(); 
     137  } 
     138 
     139  /** Helper utility for constructing lengths array, used by main. */ 
     140  private static final int[] getLengths(IFormatReader r) { 
     141    return new int[] {r.getSizeZ(), r.getSizeC(), r.getSizeT()}; 
    93142  } 
    94143 
    95144  // -- Main method --  
    96145 
     146  /** Interactive interpreter for testing Bio-Formats caching implementation. */ 
    97147  public static void main(String[] args) throws Exception { 
    98     Cache cache = new Cache();; 
     148    if (args.length < 1) { 
     149      System.out.println("Please specify a filename containing image data."); 
     150      System.exit(1); 
     151    } 
    99152    ImageReader reader = new ImageReader(); 
    100     reader.setId(args[0]); 
     153    String id = args[0]; 
     154    System.out.println("Reading " + id); 
     155    reader.setId(id); 
     156    System.out.println("Initializing cache"); 
     157    Cache cache = new Cache( 
     158      new CrosshairStrategy(getLengths(reader)), 
     159      new BufferedImageSource(reader)); 
    101160    String cmd = ""; 
    102161    BufferedReader r = new BufferedReader(new InputStreamReader(System.in)); 
    103     while (!cmd.equals("exit")) { 
     162    System.out.println("Entering Bio-Formats caching test console"); 
     163    while (true) { 
    104164      System.out.print("> "); 
    105165      cmd = r.readLine().trim(); 
     
    108168      else if (cmd.equals("help")) { 
    109169        System.out.println("Available commands:"); 
     170        System.out.println("  info"); 
     171        System.out.println("  strategy"); 
    110172        System.out.println("  source"); 
    111         System.out.println("  strategy"); 
     173        System.out.println("  position"); 
    112174        System.out.println("  forward"); 
    113175        System.out.println("  backward"); 
    114176        System.out.println("  priority"); 
    115177        System.out.println("  read"); 
     178        System.out.println("  exit"); 
    116179      } 
    117180      else if (cmd.equals("read")) { 
     
    122185        System.out.print("T: "); 
    123186        int t = Integer.parseInt(r.readLine().trim()); 
     187        System.out.println("Retrieving Z" + z + "-C" + c + "-T" + t); 
    124188        Object o = cache.getObject(new int[] {z, c, t}); 
     189      } 
     190      else if (cmd.equals("info")) { 
     191        // output strategy information 
     192        ICacheStrategy strategy = cache.getStrategy(); 
     193        System.out.println("strategy = " + strategy.getClass().getName()); 
     194        printArray("\tpriorities", strategy.getPriorities()); 
     195        System.out.println("\tforwardFirst = " + strategy.getForwardFirst()); 
     196        printArray("\tforward", strategy.getForward()); 
     197        printArray("\tbackward", strategy.getBackward()); 
     198        printArray("\tlengths", strategy.getLengths()); 
     199        // output source information 
     200        ICacheSource source = cache.getSource(); 
     201        System.out.println("source = " + source.getClass().getName()); 
     202        System.out.println("\tobject count = " + source.getObjectCount()); 
     203        // output dimensional position 
     204        printArray("pos", cache.getCurrentPos()); 
    125205      } 
    126206      else if (cmd.equals("strategy")) { 
     
    129209        System.out.print("> "); 
    130210        int n = Integer.parseInt(r.readLine().trim()); 
    131         int[] l = new int[] {reader.getSizeZ(), reader.getSizeC(),  
    132           reader.getSizeT()}; 
    133         int[] f = new int[] {0, 0, 0}; 
     211        int[] l = getLengths(reader); 
    134212        switch (n) { 
    135213          case 0: 
    136             cache.setStrategy(new CrosshairStrategy(true, l, f, f)); 
     214            cache.setStrategy(new CrosshairStrategy(l)); 
     215            System.out.println("Strategy set to crosshair"); 
    137216            break; 
    138217          case 1: 
    139             cache.setStrategy(new RectangleStrategy(true, l, f, f)); 
     218            cache.setStrategy(new RectangleStrategy(l)); 
     219            System.out.println("Strategy set to rectangle"); 
    140220            break; 
     221          default: 
     222            System.out.println("Unknown strategy: " + n); 
    141223        } 
    142224      } 
     
    148230        int n = Integer.parseInt(r.readLine().trim()); 
    149231        switch (n) { 
    150           case 0: cache.setSource(new BufferedImageSource(reader)); break;  
    151           case 1: cache.setSource(new ByteArraySource(reader)); break; 
    152           case 2: cache.setSource(new ImageProcessorSource(reader)); break; 
     232          case 0: 
     233            cache.setSource(new BufferedImageSource(reader)); 
     234            System.out.println("Source set to BufferedImage"); 
     235            break;  
     236          case 1: 
     237            cache.setSource(new ByteArraySource(reader)); 
     238            System.out.println("Source set to byte array"); 
     239            break; 
     240          case 2: 
     241            cache.setSource(new ImageProcessorSource(reader)); 
     242            System.out.println("Source set to ImageProcessor"); 
     243            break; 
     244          default: 
     245            System.out.println("Unknown source: " + n); 
    153246        } 
     247      } 
     248      else if (cmd.equals("position")) { 
     249        System.out.print("Z: "); 
     250        int z = Integer.parseInt(r.readLine().trim()); 
     251        System.out.print("C: "); 
     252        int c = Integer.parseInt(r.readLine().trim()); 
     253        System.out.print("T: "); 
     254        int t = Integer.parseInt(r.readLine().trim()); 
     255        cache.setCurrentPos(new int[] {z, c, t}); 
    154256      } 
    155257      else if (cmd.equals("forward")) { 
     
    176278      } 
    177279      else if (cmd.equals("priority")) { 
    178         System.out.println("0 => high priority"); 
    179         System.out.println("1 => medium priority"); 
    180         System.out.println("2 => low priority"); 
     280        System.out.println(ICacheStrategy.MIN_PRIORITY + " => min priority"); 
     281        System.out.println(ICacheStrategy.LOW_PRIORITY + " => low priority"); 
     282        System.out.println( 
     283          ICacheStrategy.NORMAL_PRIORITY + " => normal priority"); 
     284        System.out.println(ICacheStrategy.HIGH_PRIORITY + " => high priority"); 
     285        System.out.println(ICacheStrategy.MAX_PRIORITY + " => max priority"); 
    181286        System.out.print("Z: "); 
    182287        int z = Integer.parseInt(r.readLine().trim()); 
     
    189294        cache.getStrategy().setPriority(t, 2); 
    190295      } 
     296      else if (cmd.equals("exit")) break; 
     297      else System.out.println("Unknown command: " + cmd); 
    191298    } 
    192299    reader.close();  
  • trunk/loci/formats/cache/CacheException.java

    r2866 r2961  
    55package loci.formats.cache; 
    66 
     7import loci.formats.FormatException; 
     8 
    79/** 
    810 * CacheException is the exception thrown when something 
    911 * goes wrong performing a cache operation. 
    1012 */ 
    11 public class CacheException extends Exception { 
     13public class CacheException extends FormatException { 
    1214 
    1315  public CacheException() { super(); } 
  • trunk/loci/formats/cache/CacheStrategy.java

    r2947 r2961  
    55package loci.formats.cache; 
    66 
     7import java.util.Arrays; 
     8 
    79public abstract class CacheStrategy implements ICacheStrategy { 
    810 
    911  // -- Constants -- 
    1012 
    11   public static final int HIGH_PRIORITY = 0; 
     13  public static final int DEFAULT_FORWARD = 20; 
     14  public static final int DEFAULT_BACKWARD = 10; 
    1215 
    1316  // -- Fields -- 
    1417  
    15   protected boolean forwardFirst; 
    16   protected int[] priorities; 
    17   protected int[] forward, backward; 
     18  /** Length of each dimensional axis. */ 
    1819  protected int[] lengths; 
    1920 
    20   // -- Constructor -- 
     21  /** Whether or not forward slices should be loaded first. */ 
     22  protected boolean forwardFirst; 
    2123 
    22   public CacheStrategy(boolean forwardFirst, int[] lengths,  
    23     int[] forward, int[] backward)  
    24   { 
     24  /** Number of planes to cache forward along each axis. */ 
     25  protected int[] forward; 
     26 
     27  /** Number of planes to cache backward along each axis. */ 
     28  protected int[] backward; 
     29 
     30  /** Priority for caching each axis. Controls axis caching order. */ 
     31  protected int[] priorities; 
     32 
     33  // -- Constructors -- 
     34 
     35  public CacheStrategy(int[] lengths) { 
    2536    this.lengths = lengths; 
    26     this.forward = forward; 
    27     this.backward = backward; 
    28     this.forwardFirst = forwardFirst;  
     37    forwardFirst = true; 
     38    forward = new int[lengths.length]; 
     39    Arrays.fill(forward, DEFAULT_FORWARD); 
     40    backward = new int[lengths.length]; 
     41    Arrays.fill(backward, DEFAULT_BACKWARD); 
    2942    priorities = new int[lengths.length]; 
     43    Arrays.fill(priorities, NORMAL_PRIORITY); 
    3044  } 
    3145 
     
    7892    for (int i=0; i<priorities.length; i++) { 
    7993      if (priorities[i] >= basePriority && i != ndx) { 
    80         if (!(priorities[i] == basePriority && i < ndx)) {  
     94        if (priorities[i] != basePriority || i >= ndx) {  
    8195          return i; 
    8296        }  
  • trunk/loci/formats/cache/CrosshairStrategy.java

    r2948 r2961  
    88import java.util.Vector; 
    99 
     10/** 
     11 * A crosshair strategy caches planes extending from the the current 
     12 * dimensional position along each individual axis, but not combinations of 
     13 * axes. For example, if the current position is Z5-C2-T18, the strategy will 
     14 * preload the next and previous focal planes (Z6-C2-T18 and Z4-C2-T18), 
     15 * the next and previous channels (Z5-C3-T18 and Z5-C1-T18), 
     16 * and the next and previous time points (Z5-C2-T19 and Z5-C2-T17), 
     17 * but nothing diverging on multiple axes (e.g., Z6-C3-T19 or Z4-C1-T17). 
     18 * <p> 
     19 * Planes closest to the current position are loaded first, with axes 
     20 * prioritized according to the cache strategy's priority settings. 
     21 * <p> 
     22 * To illustrate the crosshair strategy, here is a diagram showing a case 
     23 * in 2D with 56 dimensional positions (7Z x 8T). Forward first option is set 
     24 * to false, forward value is 2 for both Z and T, backward value is also 2 for 
     25 * both, and priority is normal for both. 
     26 * The numbers indicate the order planes will be cached, with "0" 
     27 * corresponding to the current dimensional position. 
     28 * <pre> 
     29 *      T  0  1  2  3  4  5  6  7 
     30 *    Z /------------------------ 
     31 *    0 | 
     32 *    1 |           8 
     33 *    2 |           4 
     34 *    3 |     6  2  0  1  5 
     35 *    4 |           3 
     36 *    5 |           7 
     37 *    6 | 
     38 * </pre> 
     39 */ 
    1040public class CrosshairStrategy extends CacheStrategy { 
     41 
     42  // -- Static fields -- 
     43 
     44  /** Persistent Vector for calling {@link #getLoadList(int[])} efficiently. */ 
     45  private static ThreadLocal listVector = new ThreadLocal() { 
     46    protected synchronized Object initialValue() { 
     47      return new Vector(); 
     48    } 
     49  }; 
    1150 
    1251  // -- Constructor -- 
    1352 
    14   public CrosshairStrategy(boolean forwardFirst, int[] lengths, int[] forward,  
    15     int[] backward)  
    16   { 
    17     super(forwardFirst, lengths, forward, backward); 
    18   } 
     53  /** Constructs a crosshair strategy. */ 
     54  public CrosshairStrategy(int[] lengths) { super(lengths); } 
    1955 
    2056  // -- ICacheStrategy API methods -- 
     
    3874    int count = 0; 
    3975 
    40     Vector list = new Vector(); 
     76    Vector list = (Vector) listVector.get(); 
     77    list.clear(); 
    4178 
    4279    int firstNdx = 0; 
     
    5087    while (count < total) { 
    5188      int[] tmp = new int[positions.length]; 
    52       for (int i=0; i<tmp.length; i++) tmp[i] = positions[i]; 
     89      System.arraycopy(positions, 0, tmp, 0, positions.length); 
    5390      list.add(tmp);  
    5491      positions =  
  • trunk/loci/formats/cache/ICacheStrategy.java

    r2866 r2961  
    66 
    77public interface ICacheStrategy { 
     8 
     9  // -- Constants -- 
     10 
     11  int MIN_PRIORITY = -10; 
     12  int LOW_PRIORITY = -5; 
     13  int NORMAL_PRIORITY = 0; 
     14  int HIGH_PRIORITY = 5; 
     15  int MAX_PRIORITY = 10; 
     16 
     17  // -- ICacheStrategy API methods -- 
    818 
    919  /**  
  • trunk/loci/formats/cache/ImageProcessorSource.java

    r2952 r2961  
    4040  } 
    4141 
     42 
    4243  // -- Fields -- 
    4344 
     45  /** Reader from which to draw ImageProcessors. */ 
    4446  private IFormatReader reader; 
    4547 
    46   // -- Constructor -- 
    47  
    48   public ImageProcessorSource(Object o) throws CacheException { 
    49     super(o);  
    50     try { 
    51       if (o instanceof IFormatReader) reader = (IFormatReader) o; 
    52       else { 
    53         reader = new FileStitcher(); 
    54         reader.setId(o.toString());  
    55       }  
    56     } 
     48  // -- Constructors -- 
     49 
     50  /** Constructs an ImageProcessor source from the given Bio-Formats reader. */ 
     51  public ImageProcessorSource(IFormatReader r) throws CacheException { 
     52    super(r); 
     53    reader = r; 
     54  } 
     55 
     56  /** Constructs an ImageProcessor source drawing from the given file. */ 
     57  public ImageProcessorSource(String id) throws CacheException { 
     58    this(new FileStitcher()); 
     59    try { reader.setId(id); } 
    5760    catch (FormatException exc) { throw new CacheException(exc); } 
    5861    catch (IOException exc) { throw new CacheException(exc); } 
  • trunk/loci/formats/cache/RectangleStrategy.java

    r2948 r2961  
    88import java.util.Vector; 
    99 
     10/** 
     11 * A rectangle strategy caches planes extending from the the current 
     12 * dimensional position along each axis and combination of axes. 
     13 * For example, if the current position is Z5-C2-T18, the strategy will 
     14 * preload the next and previous focal planes (Z6-C2-T18 and Z4-C2-T18), 
     15 * the next and previous channels (Z5-C3-T18 and Z5-C1-T18), 
     16 * the next and previous time points (Z5-C2-T19 and Z5-C2-T17), and 
     17 * all combinations thereof (Z6-C3-T18, Z6-C1-T18, Z4-C3-T18, Z4-C1-T18, 
     18 * Z6-C3-T19, etc.). 
     19 * <p> 
     20 * Planes closest to the current position are loaded first, with axes 
     21 * prioritized according to the cache strategy's priority settings. 
     22 * <p> 
     23 * To illustrate the rectangle strategy, here is a diagram showing a case 
     24 * in 2D with 56 dimensional positions (7Z x 8T). Forward first option is set 
     25 * to false, forward value is 2 for both Z and T, backward value is also 2 for 
     26 * both, and priority is normal for both. 
     27 * The numbers indicate the order planes will be cached, with "0" 
     28 * corresponding to the current dimensional position. 
     29 * <pre> 
     30 *      T  0  1  2  3  4  5  6  7 
     31 *    Z /------------------------ 
     32 *    0 | 
     33 *    1 |    24 16 12 15 23 
     34 *    2 |    20  8  4  7 19 
     35 *    3 |    10  2  0  1  9 
     36 *    4 |    18  6  3  5 17 
     37 *    5 |    22 14 11 13 21 
     38 *    6 | 
     39 * </pre> 
     40 */ 
    1041public class RectangleStrategy extends CacheStrategy { 
     42 
     43  // -- Static fields -- 
     44 
     45  /** Persistent Vector for calling {@link #getLoadList(int[])} efficiently. */ 
     46  private static ThreadLocal listVector = new ThreadLocal() { 
     47    protected synchronized Object initialValue() { 
     48      return new Vector(); 
     49    } 
     50  }; 
    1151 
    1252  // -- Fields -- 
     
    1757  // -- Constructor -- 
    1858 
    19   public RectangleStrategy(boolean forwardFirst, int[] lengths, int[] forward,  
    20     int[] backward)  
    21   { 
    22     super(forwardFirst, lengths, forward, backward); 
    23   } 
     59  /** Constructs a rectangle strategy. */ 
     60  public RectangleStrategy(int[] lengths) { super(lengths); } 
    2461 
    2562  // -- ICacheStrategy API methods -- 
     
    4582    int count = 0; 
    4683 
    47     Vector list = new Vector(); 
     84    Vector list = (Vector) listVector.get(); 
     85    list.clear(); 
    4886 
    4987    int firstNdx = 0; 
     
    5795    while (count < total) { 
    5896      int[] tmp = new int[positions.length]; 
    59       for (int i=0; i<tmp.length; i++) tmp[i] = positions[i]; 
     97      System.arraycopy(positions, 0, tmp, 0, positions.length); 
    6098      list.add(tmp); 
    6199      positions = increment(positions, firstNdx); 
Note: See TracChangeset for help on using the changeset viewer.