Changeset 2039


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

Style fixes.

Location:
trunk/loci/formats
Files:
19 edited

Legend:

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

    r2035 r2039  
    2424 
    2525package loci.formats; 
    26 // Used in main method test. 
    27 import loci.formats.BitWriter; 
    28 import java.util.Random; 
     26 
     27import java.util.Random; // used in main method test 
    2928 
    3029/** 
     
    9190          bitsToRead -= 8; 
    9291          currentByte++; 
    93         } else { 
     92        } 
     93        else { 
    9494          // otherwise, only read the appropriate number of bits off the back 
    9595          // side of the byte, in order to "finish" the current byte in the 
     
    102102          currentByte++; 
    103103        } 
    104       } else { 
     104      } 
     105      else { 
    105106        // We will be able to finish using the current byte. 
    106107        // read the appropriate number of bits off the front side of the byte, 
     
    124125 
    125126  /** 
    126    * Testing method 
     127   * Testing method. 
    127128   * @param args Ignored. 
    128129   */ 
    129  
    130   public static void main(String args[]) { 
     130  public static void main(String[] args) { 
    131131    int trials = 50000; 
    132132    int[] nums = new int[trials]; 
     
    146146      if(31 == i % 32) { 
    147147        nums[i] = r.nextInt(); 
    148       } else { 
     148      } 
     149      else { 
    149150        nums[i] = r.nextInt(1 << (i % 32)); 
    150151      } 
  • trunk/loci/formats/BitWriter.java

    r2035 r2039  
    2222Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
    2323*/ 
     24 
    2425package loci.formats; 
    2526 
     
    8384 
    8485  public void write(String bitString) { 
    85     for(int i = 0; i < bitString.length(); i++) { 
    86       if('1' == bitString.charAt(i)) { 
     86    for (int i = 0; i < bitString.length(); i++) { 
     87      if ('1' == bitString.charAt(i)) { 
    8788        int b = 1 << (7 - bit); 
    8889        buf[index] |= b; 
    89       } else if('0' != bitString.charAt(i)) { 
    90         throw new IllegalArgumentException(bitString.charAt(i) + "found at " 
    91             + "character " + i + "; 0 or 1 expected. Write only partially " 
    92             + "completed."); 
     90      } 
     91      else if ('0' != bitString.charAt(i)) { 
     92        throw new IllegalArgumentException(bitString.charAt(i) + 
     93          "found at character " + i + 
     94          "; 0 or 1 expected. Write only partially completed."); 
    9395      } 
    9496      bit++; 
     
    151153    System.out.println("Generating 5000 random bits for String test"); 
    152154    StringBuffer sb = new StringBuffer(5000); 
    153     for(int i = 0; i < 5000; i++) { 
     155    for (int i = 0; i < 5000; i++) { 
    154156      sb.append(r.nextInt(2)); 
    155157    } 
     
    159161    System.out.println("Reading values from byte array"); 
    160162    bb = new BitBuffer(out.toByteArray()); 
    161     for(int i = 0; i < 5000; i++) { 
     163    for (int i = 0; i < 5000; i++) { 
    162164      int value = bb.getBits(1); 
    163165      int expected = (sb.charAt(i) == '1') ? 1 : 0; 
    164       if(value != expected) { 
     166      if (value != expected) { 
    165167        System.out.println("Bit #" + i + " does not match (got " + value + 
    166168          "; expected " + expected + "."); 
  • trunk/loci/formats/ChannelSeparator.java

    r2003 r2039  
    8080    switch (getPixelType(id)) { 
    8181      case 0: 
    82       case 1: bytes = 1; break; 
     82      case 1: 
     83        bytes = 1; 
     84        break; 
    8385      case 2: 
    84       case 3: bytes = 2; break; 
     86      case 3: 
     87        bytes = 2; 
     88        break; 
    8589      case 4: 
    8690      case 5: 
    87       case 6: bytes = 4; break; 
    88       case 7: bytes = 8; break; 
    89     }; 
     91      case 6: 
     92        bytes = 4; 
     93        break; 
     94      case 7: 
     95        bytes = 8; 
     96        break; 
     97    } 
    9098 
    9199    byte[] b = openBytes(id, no); 
  • trunk/loci/formats/FileStitcher.java

    r2003 r2039  
    469469 
    470470  /* @see IFormatReader#swapDimensions(String, String) */ 
    471   public void swapDimensions(String id, String order) 
    472     throws FormatException, IOException 
    473   { 
    474     if (!id.equals(currentId)) initFile(id); 
    475     this.order[getSeries(id)] = order; 
     471  public void swapDimensions(String id, String dimOrder) 
     472    throws FormatException, IOException 
     473  { 
     474    if (!id.equals(currentId)) initFile(id); 
     475    order[getSeries(id)] = dimOrder; 
    476476    String f0 = files[0]; 
    477     reader.swapDimensions(f0, order); 
     477    reader.swapDimensions(f0, dimOrder); 
    478478    sizeZ[getSeries(id)] = reader.getSizeZ(f0); 
    479479    sizeC[getSeries(id)] = reader.getSizeC(f0); 
  • trunk/loci/formats/FormatReader.java

    r2003 r2039  
    8484 
    8585  /** Debugging flag. */ 
    86   public static boolean debug = false; 
     86  protected static boolean debug = false; 
    8787 
    8888  /** Debugging level. 1=basic, 2=extended, 3=everything. */ 
    89   public static int debugLevel = 1; 
     89  protected static int debugLevel = 1; 
    9090 
    9191  // -- Fields -- 
  • trunk/loci/formats/IFormatWriter.java

    r2001 r2039  
    3939    throws FormatException, IOException; 
    4040 
    41   /** Closes open files */ 
     41  /** Closes open files. */ 
    4242  void close() throws FormatException, IOException; 
    4343 
  • trunk/loci/formats/ImageTools.java

    r1989 r2039  
    598598 
    599599  /** Create a blank image with the given dimensions and transfer type. */ 
    600   public static BufferedImage blankImage(int w, int h, int c, int type) 
    601   { 
     600  public static BufferedImage blankImage(int w, int h, int c, int type) { 
    602601    int tt = 0; 
    603602    DataBuffer buffer = null; 
  • trunk/loci/formats/LZWTreeNode.java

    r1629 r2039  
    3838 
    3939  /** Code corresponding to this node. */ 
    40   protected int code; 
     40  protected int theCode; 
    4141 
    4242  // -- Constructor -- 
     
    4545  public LZWTreeNode(int code) { 
    4646    children = new LZWTreeNode[256]; 
    47     this.code = code; 
     47    theCode = code; 
    4848  } 
    4949 
     
    5757  /** Gets the code corresponding to this node. */ 
    5858  public int getCode() { 
    59     return code; 
     59    return theCode; 
    6060  } 
    6161 
     
    7575  public int codeFromString(ByteVector string) { 
    7676    LZWTreeNode node = nodeFromString(string); 
    77     return node == null ? -1 : node.code; 
     77    return node == null ? -1 : node.theCode; 
    7878  } 
    7979 
  • trunk/loci/formats/RAUrl.java

    r2035 r2039  
    6161  // -- Constructors -- 
    6262 
    63   public RAUrl(String url, String mode) 
    64     throws MalformedURLException, IOException 
    65   { 
     63  public RAUrl(String url, String mode) throws IOException { 
    6664    conn = (HttpURLConnection) (new URL(url)).openConnection(); 
    6765    if (mode.equals("r")) is = new DataInputStream(conn.getInputStream()); 
  • trunk/loci/formats/TiffTools.java

    r2035 r2039  
    288288   * @return an object representing the entry's fields. 
    289289   * @throws IOException when there is an error accessing the stream <i>in</i>. 
    290    * @throws UnknownTagException if the <i>tag</i> is not found or unknown. 
    291290   */ 
    292291  public static TiffIFDEntry getFirstIFDEntry(RandomAccessStream in, int tag) 
     
    322321      // Parse the entry's "ValueCount" 
    323322      int valueCount = in.readInt(); 
    324       if (valueCount < 0) 
    325         throw new RuntimeException( 
    326             "Count of '" + valueCount + "' unexpected."); 
     323      if (valueCount < 0) { 
     324        throw new RuntimeException("Count of '" + valueCount + "' unexpected."); 
     325      } 
    327326 
    328327      // Parse the entry's "ValueOffset" 
  • trunk/loci/formats/in/BaseTiffReader.java

    r2033 r2039  
    447447    int p = TiffTools.getIFDIntValue(ifd, TiffTools.PHOTOMETRIC_INTERPRETATION); 
    448448    if (!ignoreColorTable && 
    449       (p == TiffTools.RGB_PALETTE || p == TiffTools.CFA_ARRAY)) { 
     449      (p == TiffTools.RGB_PALETTE || p == TiffTools.CFA_ARRAY)) 
     450    { 
    450451      numC = 3; 
    451452      bps *= 3; 
     
    498499            pixelType[0] = FormatReader.INT32; 
    499500            break; 
    500           default: pixelType[0] = FormatReader.UINT8; 
     501          default: 
     502            pixelType[0] = FormatReader.UINT8; 
    501503        } 
    502504      } 
     
    512514            pixelType[0] = FormatReader.UINT32; 
    513515            break; 
    514           default: pixelType[0] = FormatReader.UINT8; 
     516          default: 
     517            pixelType[0] = FormatReader.UINT8; 
    515518        } 
    516519      } 
  • trunk/loci/formats/in/ImarisTiffReader.java

    r2010 r2039  
    176176    else if (bitFormat == 2) { 
    177177      switch (bitsPerSample) { 
    178         case 8: pixelType[0] = FormatReader.INT8; break; 
    179         case 16: pixelType[0] = FormatReader.INT16; break; 
    180         case 32: pixelType[0] = FormatReader.INT32; break; 
     178        case 8: 
     179          pixelType[0] = FormatReader.INT8; 
     180          break; 
     181        case 16: 
     182          pixelType[0] = FormatReader.INT16; 
     183          break; 
     184        case 32: 
     185          pixelType[0] = FormatReader.INT32; 
     186          break; 
    181187      } 
    182188    } 
    183189    else { 
    184190      switch (bitsPerSample) { 
    185         case 8: pixelType[0] = FormatReader.UINT8; break; 
    186         case 16: pixelType[0] = FormatReader.UINT16; break; 
    187         case 32: pixelType[0] = FormatReader.UINT32; break; 
     191        case 8: 
     192          pixelType[0] = FormatReader.UINT8; 
     193          break; 
     194        case 16: 
     195          pixelType[0] = FormatReader.UINT16; 
     196          break; 
     197        case 32: 
     198          pixelType[0] = FormatReader.UINT32; 
     199          break; 
    188200      } 
    189201    } 
  • trunk/loci/formats/in/LeicaReader.java

    r2033 r2039  
    2626 
    2727import java.awt.image.BufferedImage; 
     28import java.awt.image.ColorModel; 
    2829import java.io.*; 
    2930import java.util.*; 
     
    183184    BufferedImage b = 
    184185      tiff[series][no].openImage((String) files[series].get(no), 0); 
    185     b = ImageTools.makeBuffered(b, 
    186       ImageTools.makeColorModel(b.getRaster().getNumBands(), 
    187       b.getRaster().getTransferType(), validBits[series])); 
     186    ColorModel cm = ImageTools.makeColorModel(b.getRaster().getNumBands(), 
     187      b.getRaster().getTransferType(), validBits[series]); 
     188    b = ImageTools.makeBuffered(b, cm); 
    188189    tiff[series][no].close(); 
    189190    return b; 
  • trunk/loci/formats/in/MDBParser.java

    r2033 r2039  
    2828import loci.formats.*; 
    2929 
    30 /** Parse table structure for a specified MDB file */ 
    31 public class MDBParser { 
     30/** Utility class for parsing MDB database files. */ 
     31public final class MDBParser { 
    3232 
    3333  // -- Constants -- 
     
    6666  } 
    6767 
     68  // -- Constructor -- 
     69 
     70  private MDBParser() { } 
     71 
     72  // -- Utility methods -- 
     73 
     74  /** Parses table structure for a specified MDB file. */ 
    6875  public static void parseDatabase(String filename, Hashtable h) 
    6976    throws FormatException 
     
    168175    } 
    169176  } 
     177 
    170178} 
  • trunk/loci/formats/in/MRCReader.java

    r1947 r2039  
    150150    int mode = DataTools.bytesToInt(b, little); 
    151151    switch (mode) { 
    152       case 0: bpp = 1; pixelType[0] = FormatReader.UINT8; break; 
    153       case 1: bpp = 2; pixelType[0] = FormatReader.UINT16; break; 
    154       case 2: bpp = 4; isFloat = true; pixelType[0] = FormatReader.FLOAT; break; 
    155       case 3: bpp = 4; pixelType[0] = FormatReader.UINT32; break; 
    156       case 4: bpp = 8; isFloat = true; pixelType[0] = FormatReader.DOUBLE; 
    157               break; 
    158       case 6: bpp = 2; pixelType[0] = FormatReader.UINT16; break; 
    159       case 16: bpp = 2; sizeC[0] = 3; pixelType[0] = FormatReader.UINT16; break; 
     152      case 0: 
     153        bpp = 1; 
     154        pixelType[0] = FormatReader.UINT8; 
     155        break; 
     156      case 1: 
     157        bpp = 2; 
     158        pixelType[0] = FormatReader.UINT16; 
     159        break; 
     160      case 2: 
     161        bpp = 4; 
     162        isFloat = true; 
     163        pixelType[0] = FormatReader.FLOAT; 
     164        break; 
     165      case 3: 
     166        bpp = 4; 
     167        pixelType[0] = FormatReader.UINT32; 
     168        break; 
     169      case 4: 
     170        bpp = 8; 
     171        isFloat = true; 
     172        pixelType[0] = FormatReader.DOUBLE; 
     173        break; 
     174      case 6: 
     175        bpp = 2; 
     176        pixelType[0] = FormatReader.UINT16; 
     177        break; 
     178      case 16: 
     179        bpp = 2; 
     180        sizeC[0] = 3; 
     181        pixelType[0] = FormatReader.UINT16; 
     182        break; 
    160183    } 
    161184 
     
    245268    String type = ""; 
    246269    switch (idtype) { 
    247       case 0: type = "mono"; break; 
    248       case 1: type = "tilt"; break; 
    249       case 2: type = "tilts"; break; 
    250       case 3: type = "lina"; break; 
    251       case 4: type = "lins"; break; 
    252       default: type = "unknown"; 
     270      case 0: 
     271        type = "mono"; 
     272        break; 
     273      case 1: 
     274        type = "tilt"; 
     275        break; 
     276      case 2: 
     277        type = "tilts"; 
     278        break; 
     279      case 3: 
     280        type = "lina"; 
     281        break; 
     282      case 4: 
     283        type = "lins"; 
     284        break; 
     285      default: 
     286        type = "unknown"; 
    253287    } 
    254288 
  • trunk/loci/formats/in/ND2Reader.java

    r2035 r2039  
    343343    if (sizeX[0] == 0 || sizeY[0] == 0) { 
    344344      String s = (String) metadata.get("ReportObjects " + 
    345        "_DOCTYPE=\"ReportObjectsDocument\" _VERSION=\"1.100000\" " + 
    346        "Container page_size"); 
     345        "_DOCTYPE=\"ReportObjectsDocument\" _VERSION=\"1.100000\" " + 
     346        "Container page_size"); 
    347347      if (s != null) { 
    348348        String x = s.substring(1, s.indexOf(",")); 
     
    467467      while (bpp % 8 != 0) bpp++; 
    468468      switch (bpp) { 
    469         case 8: pixelType[0] = FormatReader.UINT8; break; 
    470         case 16: pixelType[0] = FormatReader.UINT16; break; 
    471         case 32: pixelType[0] = FormatReader.UINT32; break; 
     469        case 8: 
     470          pixelType[0] = FormatReader.UINT8; 
     471          break; 
     472        case 16: 
     473          pixelType[0] = FormatReader.UINT16; 
     474          break; 
     475        case 32: 
     476          pixelType[0] = FormatReader.UINT32; 
     477          break; 
    472478        default: 
    473           throw new FormatException("Unsupported bits per pixel : " + bpp); 
     479          throw new FormatException("Unsupported bits per pixel: " + bpp); 
    474480      } 
    475481 
  • trunk/loci/formats/in/OIFReader.java

    r2035 r2039  
    2626 
    2727import java.awt.image.BufferedImage; 
     28import java.awt.image.ColorModel; 
    2829import java.io.*; 
    2930import java.util.Hashtable; 
     
    158159    tiffReader[no].setColorTableIgnored(ignoreColorTable); 
    159160    BufferedImage b = tiffReader[no].openImage((String) tiffs.get(no), 0); 
    160     b = ImageTools.makeBuffered(b, 
    161       ImageTools.makeColorModel(b.getRaster().getNumBands(), 
    162       b.getRaster().getTransferType(), validBits)); 
     161    ColorModel cm = ImageTools.makeColorModel(b.getRaster().getNumBands(), 
     162      b.getRaster().getTransferType(), validBits); 
     163    b = ImageTools.makeBuffered(b, cm); 
    163164    tiffReader[no].close(); 
    164165    return b; 
  • trunk/loci/formats/in/PrairieReader.java

    r2035 r2039  
    254254              int eq = el.indexOf("="); 
    255255              String key = el.substring(0, eq); 
    256                 String value = el.substring(eq + 2, el.indexOf("\"", eq + 2)); 
     256              String value = el.substring(eq + 2, el.indexOf("\"", eq + 2)); 
    257257              if (prefix.equals("File")) { 
    258258                metadata.put(pastPrefix + " " + prefix + " " + fileIndex + 
  • trunk/loci/formats/out/AVIWriter.java

    r2035 r2039  
    3838 * (available at http://rsb.info.nih.gov/ij/). 
    3939 */ 
    40  
    4140public class AVIWriter extends FormatWriter { 
    4241 
     
    223222 
    224223        // Write the size of the first LIST subCHUNK not including the first 8 
    225         // bytes with LIST and size. Note that saveLIST1subSize = saveLIST1Size + 
    226         // 76, and that the length written to saveLIST1subSize is 76 less than 
     224        // bytes with LIST and size. Note that saveLIST1subSize = saveLIST1Size 
     225        // + 76, and that the length written to saveLIST1subSize is 76 less than 
    227226        // the length written to saveLIST1Size. The end of the first LIST 
    228227        // subCHUNK is followed by JUNK. 
     
    238237        // Write DIB for Microsoft Device Independent Bitmap. 
    239238        // Note: Unfortunately, at least 3 other four character codes are 
    240         // sometimes used for uncompressed AVI videos: 'RGB ', 'RAW ', 0x00000000 
     239        // sometimes used for uncompressed AVI videos: 'RGB ', 'RAW ', 
     240        // 0x00000000 
    241241        DataTools.writeString(raFile, "DIB "); 
    242242 
     
    250250 
    251251        // dwPriority - priority of a stream type. For example, in a file with 
    252         // multiple audio streams, the one with the highest priority might be the 
    253         // default one. 
     252        // multiple audio streams, the one with the highest priority might be 
     253        // the default one. 
    254254        DataTools.writeInt(raFile, 0, true); 
    255255 
    256256        // dwInitialFrames - Specifies how far audio data is skewed ahead of 
    257257        // video frames in interleaved files. Typically, this is about 0.75 
    258         // seconds. In interleaved files specify the number of frames in the file 
    259         // prior to the initial frame of the AVI sequence. 
     258        // seconds. In interleaved files specify the number of frames in the 
     259        // file prior to the initial frame of the AVI sequence. 
    260260        // Noninterleaved files should use zero. 
    261261        DataTools.writeInt(raFile, 0, true); 
     
    279279        DataTools.writeInt(raFile, 0, true); 
    280280 
    281         // dwQuality - encoding quality given by an integer between 0 and 10,000. 
    282         // If set to -1, drivers use the default quality value. 
     281        // dwQuality - encoding quality given by an integer between 0 and 
     282        // 10,000. If set to -1, drivers use the default quality value. 
    283283        DataTools.writeInt(raFile, -1, true); 
    284284 
    285285        // dwSampleSize # 
    286286        // 0 if the video frames may or may not vary in size 
    287         // If 0, each sample of data(such as a video frame) must be in a separate 
    288         // chunk. If nonzero, then multiple samples of data can be grouped into 
    289         // a single chunk within the file. 
     287        // If 0, each sample of data(such as a video frame) must be in a 
     288        // separate chunk. If nonzero, then multiple samples of data can be 
     289        // grouped into a single chunk within the file. 
    290290        DataTools.writeInt(raFile, 0, true); 
    291291 
     
    311311        DataTools.writeInt(raFile, (bytesPerPixel == 1) ? 1068 : 44, true); 
    312312 
    313         // Applications should use this size to determine which BITMAPINFO header 
    314         // structure is being used. This size includes this biSize field. 
     313        // Applications should use this size to determine which BITMAPINFO 
     314        // header structure is being used. This size includes this biSize field. 
    315315        // biSize- Write header size of BITMAPINFO header structure 
    316316 
     
    322322        // biHeight - image height in pixels. If height is positive, the bitmap 
    323323        // is a bottom up DIB and its origin is in the lower left corner. If 
    324         // height is negative, the bitmap is a top-down DIB and its origin is the 
    325         // upper left corner. This negative sign feature is supported by the 
     324        // height is negative, the bitmap is a top-down DIB and its origin is 
     325        // the upper left corner. This negative sign feature is supported by the 
    326326        // Windows Media Player, but it is not supported by PowerPoint. 
    327327        DataTools.writeInt(raFile, yDim, true); 
     
    348348 
    349349        // biClrImportant - specifies that the first x colors of the color table 
    350         // are important to the DIB. If the rest of the colors are not available, 
    351         // the image still retains its meaning in an acceptable manner. When this 
    352         // field is set to zero, all the colors are important, or, rather, their 
    353         // relative importance has not been computed. 
     350        // are important to the DIB. If the rest of the colors are not 
     351        // available, the image still retains its meaning in an acceptable 
     352        // manner. When this field is set to zero, all the colors are important, 
     353        // or, rather, their relative importance has not been computed. 
    354354        DataTools.writeInt(raFile, 0, true); 
    355355 
     
    528528    new AVIWriter().testConvert(args); 
    529529  } 
     530 
    530531} 
Note: See TracChangeset for help on using the changeset viewer.