Changeset 2204


Ignore:
Timestamp:
02/01/07 16:48:55 (13 years ago)
Author:
curtis
Message:

Remove bounds sanity checking from file pattern (until after the release).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/formats/FilePattern.java

    r2197 r2204  
    5151  private String pattern; 
    5252 
    53   /** The original file, if specified. */ 
    54   private static String original; 
    55  
    5653  /** The validity of the file pattern. */ 
    5754  private boolean valid; 
     
    9087 
    9188  /** Creates a pattern object using the given file as a template. */ 
    92   public FilePattern(Location file) {  
    93     this(FilePattern.findPattern(file));  
    94   } 
     89  public FilePattern(Location file) { this(FilePattern.findPattern(file)); } 
    9590 
    9691  /** 
     
    208203    Vector v = new Vector(); 
    209204    buildFiles("", num, v); 
    210     
    211     // check that the bounds are sane 
    212     int idx = -1; 
    213     for (int i=0; i<count.length-1; i++) { 
    214       int ndx = 1; 
    215       for (int j=i; j<count.length; j++) ndx *= count[j]; 
    216       ndx -= count[i]; 
    217       for (int j=0; j<count[0]; j++) { 
    218         String file = (String) v.get(ndx + j); 
    219         if (!new Location(file).exists()) { 
    220           for (int k=0; k<v.size(); k++) { 
    221             String prefix = getPrefix(i) + begin[i]; 
    222             int n = 0; 
    223             while (original.indexOf(prefix) == -1) { 
    224               n++; 
    225               prefix = getPrefix(i) + (begin[i].add(new BigInteger("" + n))); 
    226             } 
    227             idx = i + 1; 
    228             if (((String) v.get(k)).indexOf(prefix) == -1) { 
    229               v.remove(k); 
    230               ndx--; 
    231               k--; 
    232               valid = false; 
    233             } 
    234           } 
    235         } 
    236       } 
    237     } 
    238     
    239205    files = new String[v.size()]; 
    240206    v.copyInto(files); 
    241  
    242     if (idx != -1) { 
    243       String[] tmpFiles = new String[files.length]; 
    244       for (int i=0; i<tmpFiles.length; i++) { 
    245         tmpFiles[i] = new Location(files[i]).getName(); 
    246       } 
    247  
    248       Location l = new Location(files[0]); 
    249       this.pattern = findPattern(l.getName(), l.getParent(), tmpFiles); 
    250  
    251       startIndex = new int[] {startIndex[idx]};  
    252       endIndex = new int[] {endIndex[idx]}; 
    253       begin = new BigInteger[] {begin[idx]}; 
    254       end = new BigInteger[] {end[idx]}; 
    255       step = new BigInteger[] {step[idx]}; 
    256       count = new int[] {count[idx]}; 
    257       fixed = new boolean[] {fixed[idx]}; 
    258       zeroes = new int[] {zeroes[idx]}; 
    259     } 
    260207 
    261208    valid = true; 
     
    359306   */ 
    360307  public static String findPattern(String name, String dir) { 
    361     original = name; 
    362308    if (dir == null) dir = ""; // current directory 
    363309    else if (!dir.equals("") && !dir.endsWith(File.separator)) { 
Note: See TracChangeset for help on using the changeset viewer.