Changeset 2757


Ignore:
Timestamp:
05/07/07 12:13:59 (13 years ago)
Author:
melissa
Message:

Removed the "mustGroupFiles(String)" method, and replaced it with "int fileGroupOption(String)". This new method returns one of three values, indicating that we can, cannot, or must group the files in a dataset.

Location:
trunk/loci/formats
Files:
12 edited

Legend:

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

    r2755 r2757  
    483483  } 
    484484 
    485   /* @see IFormatReader#mustGroupFiles(String) */ 
    486   public boolean mustGroupFiles(String id) throws FormatException, IOException { 
    487     return readers[0].mustGroupFiles(id); 
     485  /* @see IFormatReader#fileGroupOption(String) */ 
     486  public int fileGroupOption(String id) throws FormatException, IOException { 
     487    return readers[0].fileGroupOption(id); 
    488488  } 
    489489 
  • trunk/loci/formats/FormatReader.java

    r2755 r2757  
    3939  /** Default thumbnail width and height. */ 
    4040  protected static final int THUMBNAIL_DIMENSION = 128; 
     41 
     42  /** File grouping options. */ 
     43  public static final int MUST_GROUP = 0; 
     44  public static final int CAN_GROUP = 1; 
     45  public static final int CANNOT_GROUP = 2; 
    4146 
    4247  // -- Fields -- 
     
    380385  } 
    381386 
    382   /* @see IFormatReader#mustGroupFiles(String) */ 
    383   public boolean mustGroupFiles(String id) throws FormatException, IOException { 
    384     return false;  
     387  /* @see IFormatReader#fileGroupOption(String) */ 
     388  public int fileGroupOption(String id)  
     389    throws FormatException, IOException  
     390  { 
     391    return FormatTools.CANNOT_GROUP;  
    385392  } 
    386393 
  • trunk/loci/formats/FormatTools.java

    r2708 r2757  
    9999   */ 
    100100  public static final String POLARIZATION = "Polarization"; 
     101 
     102  /** File grouping options. */ 
     103  public static final int MUST_GROUP = 0; 
     104  public static final int CAN_GROUP = 1; 
     105  public static final int CANNOT_GROUP = 2; 
    101106 
    102107  // -- Constructor -- 
  • trunk/loci/formats/IFormatReader.java

    r2755 r2757  
    201201 
    202202  /**  
    203    * Returns true if it we have to group the files  
    204    * in order to read the dataset.  
    205    */ 
    206   boolean mustGroupFiles(String id) throws FormatException, IOException; 
     203   * Returns an int indicating that we cannot, must, or might group the files 
     204   * in a given dataset. 
     205   */ 
     206  int fileGroupOption(String id) throws FormatException, IOException; 
    207207 
    208208  /** Returns an array of filenames needed to open this dataset. */ 
  • trunk/loci/formats/ImageReader.java

    r2755 r2757  
    395395  } 
    396396 
    397   /* @see IFormatReader#mustGroupFiles(String) */ 
    398   public boolean mustGroupFiles(String id) throws FormatException, IOException { 
    399     return getReader(id).mustGroupFiles(id); 
     397  /* @see IFormatReader#fileGroupOption(String) */ 
     398  public int fileGroupOption(String id) throws FormatException, IOException { 
     399    return getReader(id).fileGroupOption(id); 
    400400  } 
    401401 
  • trunk/loci/formats/ReaderWrapper.java

    r2755 r2757  
    202202  } 
    203203 
    204   public boolean mustGroupFiles(String id) throws FormatException, IOException { 
    205     return reader.mustGroupFiles(id); 
     204  public int fileGroupOption(String id) throws FormatException, IOException { 
     205    return reader.fileGroupOption(id); 
    206206  } 
    207207 
  • trunk/loci/formats/in/ICSReader.java

    r2755 r2757  
    9595  } 
    9696 
    97   /* @see loci.formats.IFormatReader#mustGroupFiles(String) */ 
    98   public boolean mustGroupFiles(String id) { 
    99     return true; 
     97  /* @see loci.formats.IFormatReader#fileGroupOption(String) */ 
     98  public int fileGroupOption(String id) throws FormatException, IOException { 
     99    return FormatTools.MUST_GROUP;  
    100100  } 
    101101 
  • trunk/loci/formats/in/LeicaReader.java

    r2755 r2757  
    107107  } 
    108108 
    109   /* @see loci.formats.IFormatReader#mustGroupFiles(String) */ 
    110   public boolean mustGroupFiles(String id) throws FormatException, IOException { 
    111     return id.toLowerCase().endsWith(".lei"); 
     109  /* @see loci.formats.IFormatReader#fileGroupOption(String) */ 
     110  public int fileGroupOption(String id) throws FormatException, IOException { 
     111    return id.toLowerCase().endsWith(".lei") ? FormatTools.MUST_GROUP :  
     112      FormatTools.CAN_GROUP; 
    112113  } 
    113114 
  • trunk/loci/formats/in/MetamorphReader.java

    r2755 r2757  
    110110  } 
    111111 
    112   /* @see loci.formats.IFormatReader#mustGroupFiles(String) */ 
    113   public boolean mustGroupFiles(String id) throws FormatException, IOException { 
    114     if (id.toLowerCase().endsWith(".nd")) return true; 
    115     return false;  
     112  /* @see loci.formats.IFormatReader#fileGroupOption(String) */ 
     113  public int fileGroupOption(String id) throws FormatException, IOException { 
     114    if (id.toLowerCase().endsWith(".nd")) return FormatTools.MUST_GROUP; 
     115 
     116    Location l = new Location(id).getAbsoluteFile(); 
     117    String[] files = l.getParentFile().list(); 
     118 
     119    for (int i=0; i<files.length; i++) { 
     120      String s = files[i].toLowerCase(); 
     121      if (s.endsWith(".nd") && id.startsWith(files[i].substring(0,  
     122        s.lastIndexOf(".")))) 
     123      { 
     124        return FormatTools.CAN_GROUP; 
     125      } 
     126    } 
     127 
     128    return FormatTools.CANNOT_GROUP;  
    116129  } 
    117130 
     
    203216    } 
    204217 
    205     if (ndfile.exists() && (mustGroupFiles(id) || isGroupFiles())) { 
     218    if (ndfile.exists() && (fileGroupOption(id) == FormatTools.MUST_GROUP ||  
     219      isGroupFiles()))  
     220    { 
    206221      RandomAccessStream ndStream =  
    207222        new RandomAccessStream(ndfile.getAbsolutePath()); 
  • trunk/loci/formats/in/OIFReader.java

    r2755 r2757  
    7373  } 
    7474 
    75   /* @see loci.formats.IFormatReader#mustGroupFiles(String) */ 
    76   public boolean mustGroupFiles(String id) throws FormatException, IOException { 
    77     return true; 
     75  /* @see loci.formats.IFormatReader#fileGroupOption(String) */ 
     76  public int fileGroupOption(String id) throws FormatException, IOException { 
     77    return FormatTools.MUST_GROUP; 
    7878  } 
    7979 
  • trunk/loci/formats/in/PerkinElmerReader.java

    r2755 r2757  
    6868  public boolean isThisType(byte[] block) { return false; } 
    6969 
    70   /* @see loci.formats.IFormatReader#mustGroupFiles(String) */ 
    71   public boolean mustGroupFiles(String id) throws FormatException, IOException { 
    72     return true; 
     70  /* @see loci.formats.IFormatReader#fileGroupOption(String) */ 
     71  public int fileGroupOption(String id) throws FormatException, IOException { 
     72    return FormatTools.MUST_GROUP; 
    7373  } 
    7474 
  • trunk/loci/formats/in/PrairieReader.java

    r2755 r2757  
    102102  } 
    103103 
    104   /* @see loci.formats.IFormatReader#mustGroupFiles(String) */ 
    105   public boolean mustGroupFiles(String id) throws FormatException, IOException { 
     104  /* @see loci.formats.IFormatReader#fileGroupOption(String) */ 
     105  public int fileGroupOption(String id) throws FormatException, IOException { 
    106106    id = id.toLowerCase(); 
    107     return id.endsWith(".cfg") || id.endsWith(".xml"); 
     107    return (id.endsWith(".cfg") || id.endsWith(".xml")) ?  
     108      FormatTools.MUST_GROUP : FormatTools.CAN_GROUP; 
    108109  } 
    109110 
Note: See TracChangeset for help on using the changeset viewer.