Changeset 6263


Ignore:
Timestamp:
05/10/10 18:47:36 (10 years ago)
Author:
curtis
Message:

Use List/ArrayList instead of Vector.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/components/bio-formats/src/loci/formats/FilePattern.java

    r6141 r6263  
    2626import java.io.File; 
    2727import java.math.BigInteger; 
     28import java.util.ArrayList; 
    2829import java.util.Arrays; 
    29 import java.util.Vector; 
     30import java.util.List; 
    3031 
    3132import loci.common.Location; 
     
    121122    // locate numerical blocks 
    122123    int len = pattern.length(); 
    123     Vector<Integer> lt = new Vector<Integer>(len); 
    124     Vector<Integer> gt = new Vector<Integer>(len); 
     124    List<Integer> lt = new ArrayList<Integer>(len); 
     125    List<Integer> gt = new ArrayList<Integer>(len); 
    125126    int left = -1; 
    126127    while (true) { 
     
    145146    endIndex = new int[num]; 
    146147    for (int i=0; i<num; i++) { 
    147       int val = ((Integer) lt.elementAt(i)).intValue(); 
     148      int val = lt.get(i); 
    148149      if (i > 0 && val < endIndex[i - 1]) { 
    149150        msg = "Bad numerical block marker order."; 
     
    151152      } 
    152153      startIndex[i] = val; 
    153       val = ((Integer) gt.elementAt(i)).intValue(); 
     154      val = gt.get(i); 
    154155      if (val <= startIndex[i]) { 
    155156        msg = "Bad numerical block marker order."; 
     
    214215 
    215216    // build file listing 
    216     Vector<String> v = new Vector<String>(); 
    217     buildFiles("", num, v); 
    218     files = new String[v.size()]; 
    219     v.copyInto(files); 
     217    List<String> fileList = new ArrayList<String>(); 
     218    buildFiles("", num, fileList); 
     219    files = fileList.toArray(new String[0]); 
    220220 
    221221    valid = true; 
     
    548548  /** Filters the given list of filenames according to the specified filter. */ 
    549549  private static String[] matchFiles(String[] inFiles, NumberFilter filter) { 
    550     Vector<String> v = new Vector<String>(); 
     550    List<String> list = new ArrayList<String>(); 
    551551    for (int i=0; i<inFiles.length; i++) { 
    552       if (filter.accept(inFiles[i])) v.add(inFiles[i]); 
    553     } 
    554     String[] s = new String[v.size()]; 
    555     v.copyInto(s); 
    556     return s; 
     552      if (filter.accept(inFiles[i])) list.add(inFiles[i]); 
     553    } 
     554    return list.toArray(new String[0]); 
    557555  } 
    558556 
     
    560558 
    561559  /** Recursive method for building filenames for the file listing. */ 
    562   private void buildFiles(String prefix, int ndx, Vector<String> fileList) { 
     560  private void buildFiles(String prefix, int ndx, List<String> fileList) { 
    563561    // compute bounds for constant (non-block) pattern fragment 
    564562    int num = startIndex.length; 
Note: See TracChangeset for help on using the changeset viewer.