harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r447226 [1/3] - /incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/
Date Mon, 18 Sep 2006 04:12:14 GMT
Author: ndbeyer
Date: Sun Sep 17 21:12:12 2006
New Revision: 447226

URL: http://svn.apache.org/viewvc?view=rev&rev=447226
Log:
Remove compiler warnings, add braces, remove unused elements

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/AreaAveragingScaleFilter.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/AwtImageBackdoorAccessorImpl.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/BandedSampleModel.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/BufferedImage.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ByteLookupTable.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ColorConvertOp.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ColorModel.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ComponentColorModel.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ComponentSampleModel.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/CropImageFilter.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/DataBuffer.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/DataBufferByte.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/DataBufferDouble.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/DataBufferFloat.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/DataBufferInt.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/DataBufferShort.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/DataBufferUShort.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/DirectColorModel.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/FilteredImageSource.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/IndexColorModel.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/Kernel.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/MemoryImageSource.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/MultiPixelPackedSampleModel.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/PackedColorModel.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/PixelInterleavedSampleModel.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/RGBImageFilter.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/Raster.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ReplicateScaleFilter.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/SampleModel.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ShortLookupTable.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/SinglePixelPackedSampleModel.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/VolatileImage.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/AreaAveragingScaleFilter.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/AreaAveragingScaleFilter.java?view=diff&rev=447226&r1=447225&r2=447226
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/AreaAveragingScaleFilter.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/AreaAveragingScaleFilter.java Sun Sep 17 21:12:12 2006
@@ -49,16 +49,25 @@
         super(width, height);
     }
 
+    @Override
     public void setPixels(int x, int y, int w, int h, ColorModel model, int[] pixels, int off, int scansize) {
-        if(reset) super.setPixels(x, y, w, h, model, pixels, off, scansize);
-        else setFilteredPixels(x, y, w, h, model, pixels, off, scansize);
+        if(reset) {
+            super.setPixels(x, y, w, h, model, pixels, off, scansize);
+        } else {
+            setFilteredPixels(x, y, w, h, model, pixels, off, scansize);
+        }
     }
 
+    @Override
     public void setPixels(int x, int y, int w, int h, ColorModel model, byte[] pixels, int off, int scansize) {
-        if(reset) super.setPixels(x, y, w, h, model, pixels, off, scansize);
-        else setFilteredPixels(x, y, w, h, model, pixels, off, scansize);
+        if(reset) {
+            super.setPixels(x, y, w, h, model, pixels, off, scansize);
+        } else {
+            setFilteredPixels(x, y, w, h, model, pixels, off, scansize);
+        }
     }
 
+    @Override
     public void setHints(int hints) {
         super.setHints(hints);
         reset = ((hints & averagingFlags) != averagingFlags);
@@ -105,16 +114,22 @@
 
         int srcOff = off;
         while (srcY < y + h) {
-            if (svRest < dvRest) vDif = svRest;
-            else vDif = dvRest;
+            if (svRest < dvRest) {
+                vDif = svRest;
+            } else {
+                vDif = dvRest;
+            }
 
             srcX = 0;
             dx = 0;
             shRest = destWidth;
             dhRest = srcWidth;
             while (srcX < w) {
-                if (shRest < dhRest) hDif = shRest;
-                else hDif = dhRest;
+                if (shRest < dhRest) {
+                    hDif = shRest;
+                } else {
+                    hDif = dhRest;
+                }
                 int avg = hDif * vDif; // calculation of contribution factor
 
                 int rgb, pix;

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/AwtImageBackdoorAccessorImpl.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/AwtImageBackdoorAccessorImpl.java?view=diff&rev=447226&r1=447225&r2=447226
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/AwtImageBackdoorAccessorImpl.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/AwtImageBackdoorAccessorImpl.java Sun Sep 17 21:12:12 2006
@@ -45,6 +45,7 @@
         inst = new AwtImageBackdoorAccessorImpl();
     }
 
+    @Override
     public Surface getImageSurface(Image image) {
         if (image instanceof BufferedImage){
             return ((BufferedImage)image).getImageSurface();
@@ -54,10 +55,12 @@
         return null;
     }
 
+    @Override
     public boolean isGrayPallete(IndexColorModel icm){
         return icm.isGrayPallete();
     }
 
+    @Override
     public Object getData(DataBuffer db) {
         if (db instanceof DataBufferByte){
             return ((DataBufferByte)db).getData();
@@ -71,72 +74,77 @@
             return ((DataBufferFloat)db).getData();
         } else if (db instanceof DataBufferDouble){
             return ((DataBufferDouble)db).getData();
-        } else throw new IllegalArgumentException("Wrong Data Buffer type - " +
-                db.getClass());
+        } else {
+            throw new IllegalArgumentException("Wrong Data Buffer type - " +
+                    db.getClass());
+        }
     }
 
+    @Override
     public int[] getDataInt(DataBuffer db) {
         if (db instanceof DataBufferInt){
             return ((DataBufferInt)db).getData();
-        } else {
-            return null;
         }
+        return null;
     }
 
+    @Override
     public byte[] getDataByte(DataBuffer db) {
         if (db instanceof DataBufferByte){
             return ((DataBufferByte)db).getData();
-        } else {
-            return null;
         }
+        return null;
     }
 
+    @Override
     public short[] getDataShort(DataBuffer db) {
         if (db instanceof DataBufferShort){
             return ((DataBufferShort)db).getData();
-        } else {
-            return null;
         }
+        return null;
     }
 
+    @Override
     public short[] getDataUShort(DataBuffer db) {
         if (db instanceof DataBufferUShort){
             return ((DataBufferUShort)db).getData();
-        } else {
-            return null;
         }
+        return null;
     }
 
+    @Override
     public double[] getDataDouble(DataBuffer db) {
         if (db instanceof DataBufferDouble){
             return ((DataBufferDouble)db).getData();
-        } else {
-            return null;
         }
+        return null;
     }
 
+    @Override
     public float[] getDataFloat(DataBuffer db) {
         if (db instanceof DataBufferFloat){
             return ((DataBufferFloat)db).getData();
-        } else {
-            return null;
         }
+        return null;
     }
 
+    @Override
     public void addDataBufferListener(DataBuffer db, DataBufferListener listener) {
         db.addDataBufferListener(listener);
     }
 
+    @Override
     public void removeDataBufferListener(DataBuffer db) {
         db.removeDataBufferListener();
     }
 
+    @Override
     public void validate(DataBuffer db) {
         db.validate();
     }
 
+    @Override
     public void releaseData(DataBuffer db) {
         db.releaseData();
     }
-
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/BandedSampleModel.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/BandedSampleModel.java?view=diff&rev=447226&r1=447225&r2=447226
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/BandedSampleModel.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/BandedSampleModel.java Sun Sep 17 21:12:12 2006
@@ -23,15 +23,17 @@
 
     private static int[] createIndices(int numBands) {
         int indices[] = new int[numBands];
-        for (int i = 0; i < numBands; i++)
+        for (int i = 0; i < numBands; i++) {
             indices[i] = i;
+        }
         return indices;
     }
 
     private static int[] createOffsets(int numBands) {
         int offsets[] = new int[numBands];
-        for (int i = 0; i < numBands; i++)
+        for (int i = 0; i < numBands; i++) {
             offsets[i] = 0;
+        }
         return offsets;
     }
 
@@ -45,11 +47,13 @@
         super(dataType, w, h, 1, scanlineStride, bankIndices, bandOffsets);
     }
 
+    @Override
     public SampleModel createCompatibleSampleModel(int w, int h) {
         return new BandedSampleModel(dataType, w, h, w, bankIndices,
                 bandOffsets);
     }
 
+    @Override
     public DataBuffer createDataBuffer() {
         DataBuffer data = null;
         int size = scanlineStride * height;
@@ -77,11 +81,13 @@
 
     }
 
+    @Override
     public SampleModel createSubsetSampleModel(int[] bands) {
-        if (bands.length > numBands)
+        if (bands.length > numBands) {
             throw new RasterFormatException("The number of the bands" +
                     " in the subset is greater than the number of bands" +
                     " in the sample model");
+        }
 
         int indices[] = new int[bands.length];
         int offsets[] = new int[bands.length];
@@ -95,158 +101,189 @@
                 indices, offsets);
     }
 
+    @Override
     public Object getDataElements(int x, int y, Object obj, DataBuffer data) {
         switch (dataType) {
-        case DataBuffer.TYPE_BYTE:
+        case DataBuffer.TYPE_BYTE: {
             byte bdata[];
 
-            if (obj == null)
+            if (obj == null) {
                 bdata = new byte[numBands];
-            else
+            } else {
                 bdata = (byte[]) obj;
+            }
 
-            for (int i = 0; i < numBands; i++)
+            for (int i = 0; i < numBands; i++) {
                 bdata[i] = (byte) getSample(x, y, i, data);
+            }
 
-            obj = (Object) bdata;
+            obj = bdata;
             break;
-
+        }
         case DataBuffer.TYPE_SHORT:
-        case DataBuffer.TYPE_USHORT:
+        case DataBuffer.TYPE_USHORT: {
             short sdata[];
 
-            if (obj == null)
+            if (obj == null) {
                 sdata = new short[numBands];
-            else
+            } else {
                 sdata = (short[]) obj;
+            }
 
-            for (int i = 0; i < numBands; i++)
+            for (int i = 0; i < numBands; i++) {
                 sdata[i] = (short) getSample(x, y, i, data);
+            }
 
-            obj = (Object) sdata;
+            obj = sdata;
             break;
-
-        case DataBuffer.TYPE_INT:
+        }
+        case DataBuffer.TYPE_INT: {
             int idata[];
 
-            if (obj == null)
+            if (obj == null) {
                 idata = new int[numBands];
-            else
+            } else {
                 idata = (int[]) obj;
+            }
 
-            for (int i = 0; i < numBands; i++)
+            for (int i = 0; i < numBands; i++) {
                 idata[i] = getSample(x, y, i, data);
+            }
 
-            obj = (Object) idata;
+            obj = idata;
             break;
-
-        case DataBuffer.TYPE_FLOAT:
+        }
+        case DataBuffer.TYPE_FLOAT: {
             float fdata[];
 
-            if (obj == null)
+            if (obj == null) {
                 fdata = new float[numBands];
-            else
+            } else {
                 fdata = (float[]) obj;
+            }
 
-            for (int i = 0; i < numBands; i++)
+            for (int i = 0; i < numBands; i++) {
                 fdata[i] = getSampleFloat(x, y, i, data);
+            }
 
-            obj = (Object) fdata;
+            obj = fdata;
             break;
-
-        case DataBuffer.TYPE_DOUBLE:
+        }
+        case DataBuffer.TYPE_DOUBLE: {
             double ddata[];
 
-            if (obj == null)
+            if (obj == null) {
                 ddata = new double[numBands];
-            else
+            } else {
                 ddata = (double[]) obj;
+            }
 
-            for (int i = 0; i < numBands; i++)
+            for (int i = 0; i < numBands; i++) {
                 ddata[i] = getSampleDouble(x, y, i, data);
+            }
 
-            obj = (Object) ddata;
+            obj = ddata;
             break;
         }
+        }
 
         return obj;
     }
 
+    @Override
     public int[] getPixel(int x, int y, int iArray[], DataBuffer data) {
         int pixel[];
-        if (iArray == null)
+        if (iArray == null) {
             pixel = new int[numBands];
-        else
+        } else {
             pixel = iArray;
+        }
 
-        for (int i = 0; i < numBands; i++)
+        for (int i = 0; i < numBands; i++) {
             pixel[i] = getSample(x, y, i, data);
+        }
 
         return pixel;
     }
 
+    @Override
     public int[] getPixels(int x, int y, int w, int h, int iArray[],
             DataBuffer data) {
         int pixels[];
         int idx = 0;
 
-        if (iArray == null)
+        if (iArray == null) {
             pixels = new int[w * h * numBands];
-        else
+        } else {
             pixels = iArray;
+        }
 
-        for (int i = y; i < y + h; i++)
-            for (int j = x; j < x + w; j++)
-                for (int n = 0; n < numBands; n++)
+        for (int i = y; i < y + h; i++) {
+            for (int j = x; j < x + w; j++) {
+                for (int n = 0; n < numBands; n++) {
                     pixels[idx++] = getSample(j, i, n, data);
+                }
+            }
+        }
 
         return pixels;
     }
 
+    @Override
     public int getSample(int x, int y, int b, DataBuffer data) {
-        if (x < 0 || y < 0 || x >= this.width || y >= this.height)
+        if (x < 0 || y < 0 || x >= this.width || y >= this.height) {
             throw new ArrayIndexOutOfBoundsException(
                     "Coordinates are not in bounds");
+        }
 
         return data.getElem(bankIndices[b], y * scanlineStride + x +
                bandOffsets[b]);
     }
 
+    @Override
     public double getSampleDouble(int x, int y, int b, DataBuffer data) {
-        if (x < 0 || y < 0 || x >= this.width || y >= this.height)
+        if (x < 0 || y < 0 || x >= this.width || y >= this.height) {
             throw new ArrayIndexOutOfBoundsException("Coordinates are" +
                     " not in bounds");
+        }
 
         return data.getElemDouble(bankIndices[b], y * scanlineStride + x +
                bandOffsets[b]);
     }
 
+    @Override
     public float getSampleFloat(int x, int y, int b, DataBuffer data) {
-        if (x < 0 || y < 0 || x >= this.width || y >= this.height)
+        if (x < 0 || y < 0 || x >= this.width || y >= this.height) {
             throw new ArrayIndexOutOfBoundsException("Coordinates are" +
                     " not in bounds");
+        }
 
         return data.getElemFloat(bankIndices[b], y * scanlineStride + x +
                bandOffsets[b]);
     }
 
+    @Override
     public int[] getSamples(int x, int y, int w, int h, int b, int iArray[],
             DataBuffer data) {
         int samples[];
         int idx = 0;
 
-        if (iArray == null)
+        if (iArray == null) {
             samples = new int[w * h];
-        else
+        } else {
             samples = iArray;
+        }
 
-        for (int i = y; i < y + h; i++)
-            for (int j = x; j < x + w; j++)
+        for (int i = y; i < y + h; i++) {
+            for (int j = x; j < x + w; j++) {
                 samples[idx++] = getSample(j, i, b, data);
+            }
+        }
 
         return samples;
     }
 
+    @Override
     public int hashCode() {
         int hash = super.hashCode();
         int tmp = hash >>> 8;
@@ -256,90 +293,111 @@
         return hash ^ 0x55;
     }
 
+    @Override
     public void setDataElements(int x, int y, Object obj, DataBuffer data) {
         switch (dataType) {
         case DataBuffer.TYPE_BYTE:
             byte bdata[] = (byte[]) obj;
-            for (int i = 0; i < numBands; i++)
+            for (int i = 0; i < numBands; i++) {
                 setSample(x, y, i, bdata[i] & 0xff, data);
+            }
             break;
 
         case DataBuffer.TYPE_SHORT:
         case DataBuffer.TYPE_USHORT:
             short sdata[] = (short[]) obj;
-            for (int i = 0; i < numBands; i++)
+            for (int i = 0; i < numBands; i++) {
                 setSample(x, y, i, sdata[i] & 0xffff, data);
+            }
             break;
 
         case DataBuffer.TYPE_INT:
             int idata[] = (int[]) obj;
-            for (int i = 0; i < numBands; i++)
+            for (int i = 0; i < numBands; i++) {
                 setSample(x, y, i, idata[i], data);
+            }
             break;
 
         case DataBuffer.TYPE_FLOAT:
             float fdata[] = (float[]) obj;
-            for (int i = 0; i < numBands; i++)
+            for (int i = 0; i < numBands; i++) {
                 setSample(x, y, i, fdata[i], data);
+            }
             break;
 
         case DataBuffer.TYPE_DOUBLE:
             double ddata[] = (double[]) obj;
-            for (int i = 0; i < numBands; i++)
+            for (int i = 0; i < numBands; i++) {
                 setSample(x, y, i, ddata[i], data);
+            }
             break;
         }
     }
 
+    @Override
     public void setPixel(int x, int y, int iArray[], DataBuffer data) {
-        for (int i = 0; i < numBands; i++)
+        for (int i = 0; i < numBands; i++) {
             setSample(x, y, i, iArray[i], data);
+        }
     }
 
+    @Override
     public void setPixels(int x, int y, int w, int h, int iArray[],
             DataBuffer data) {
         int idx = 0;
 
-        for (int i = y; i < y + h; i++)
-            for (int j = x; j < x + w; j++)
-                for (int n = 0; n < numBands; n++)
+        for (int i = y; i < y + h; i++) {
+            for (int j = x; j < x + w; j++) {
+                for (int n = 0; n < numBands; n++) {
                     setSample(j, i, n, iArray[idx++], data);
+                }
+            }
+        }
     }
 
+    @Override
     public void setSample(int x, int y, int b, double s, DataBuffer data) {
-        if (x < 0 || y < 0 || x >= this.width || y >= this.height)
+        if (x < 0 || y < 0 || x >= this.width || y >= this.height) {
             throw new ArrayIndexOutOfBoundsException("Coordinates are" +
                     " not in bounds");
+        }
 
         data.setElemDouble(bankIndices[b], y * scanlineStride + x +
                bandOffsets[b], s);
     }
 
+    @Override
     public void setSample(int x, int y, int b, float s, DataBuffer data) {
-        if (x < 0 || y < 0 || x >= this.width || y >= this.height)
+        if (x < 0 || y < 0 || x >= this.width || y >= this.height) {
             throw new ArrayIndexOutOfBoundsException("Coordinates are" +
                     " not in bounds");
+        }
 
         data.setElemFloat(bankIndices[b], y * scanlineStride + x +
                bandOffsets[b], s);
     }
 
+    @Override
     public void setSample(int x, int y, int b, int s, DataBuffer data) {
-        if (x < 0 || y < 0 || x >= this.width || y >= this.height)
+        if (x < 0 || y < 0 || x >= this.width || y >= this.height) {
             throw new ArrayIndexOutOfBoundsException("Coordinates are" +
                     " not in bounds");
+        }
 
         data.setElem(bankIndices[b], y * scanlineStride + x +
                        bandOffsets[b], s);
     }
 
+    @Override
     public void setSamples(int x, int y, int w, int h, int b, int iArray[],
             DataBuffer data) {
         int idx = 0;
 
-        for (int i = y; i < y + h; i++)
-            for (int j = x; j < x + w; j++)
+        for (int i = y; i < y + h; i++) {
+            for (int j = x; j < x + w; j++) {
                 setSample(j, i, b, iArray[idx++], data);
+            }
+        }
 
     }
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/BufferedImage.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/BufferedImage.java?view=diff&rev=447226&r1=447225&r2=447226
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/BufferedImage.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/BufferedImage.java Sun Sep 17 21:12:12 2006
@@ -103,7 +103,7 @@
 
     private final int imageType;
 
-    private Hashtable properties;
+    private Hashtable<?, ?> properties;
 
     // Surface of the Buffered Image - used for blitting one Buffered Image 
     // on the other one or on the Component
@@ -111,13 +111,15 @@
 
     public BufferedImage(ColorModel cm, WritableRaster raster,
             boolean isRasterPremultiplied, Hashtable<?, ?> properties) {
-        if (!cm.isCompatibleRaster(raster))
+        if (!cm.isCompatibleRaster(raster)) {
             throw new IllegalArgumentException("The raster is" +
                     " incompatible with this ColorModel");
+        }
 
-        if (raster.getMinX() != 0 || raster.getMinY() != 0)
+        if (raster.getMinX() != 0 || raster.getMinY() != 0) {
             throw new IllegalArgumentException("minX or minY of" +
                     " this raster not equal to zero");
+        }
 
         this.cm  = cm;
         this.raster = raster;
@@ -134,21 +136,23 @@
             IndexColorModel cm) {
         switch (imageType) {
         case TYPE_BYTE_BINARY:
-            if (cm.hasAlpha())
+            if (cm.hasAlpha()) {
                 throw new IllegalArgumentException("This image type" +
                         " can't have alpha");
+            }
             int pixel_bits = 0;
             int mapSize = cm.getMapSize();
-            if (mapSize <= 2)
+            if (mapSize <= 2) {
                 pixel_bits = 1;
-            else if (mapSize <= 4)
+            } else if (mapSize <= 4) {
                 pixel_bits = 2;
-            else if (mapSize <= 16)
+            } else if (mapSize <= 16) {
                 pixel_bits = 4;
-            else
+            } else {
                 throw new IllegalArgumentException("The imageType is" +
                         " TYPE_BYTE_BINARY and the color map has more" +
                         " than 16 entries");
+            }
 
             raster = Raster.createPackedRaster(DataBuffer.TYPE_BYTE, width,
                     height, 1, pixel_bits, null);
@@ -165,9 +169,10 @@
 
         }
 
-        if (!cm.isCompatibleRaster(raster))
+        if (!cm.isCompatibleRaster(raster)) {
             throw new IllegalArgumentException("The imageType is" +
                     " not compatible with ColorModel");
+        }
 
         this.cm = cm;
         this.imageType = imageType;
@@ -353,18 +358,22 @@
         imageSurf = createImageSurface(imageType);
     }
 
+    @Override
     public Object getProperty(String name, ImageObserver observer) {
         return getProperty(name);
     }
 
     public Object getProperty(String name) {
-        if(name == null)
+        if(name == null) {
             throw new NullPointerException("Property name is null");
-        if (properties == null)
+        }
+        if (properties == null) {
             return null;
+        }
         Object property = properties.get(name);
-        if (property == null)
+        if (property == null) {
             property = Image.UndefinedProperty;
+        }
         return property;
     }
 
@@ -410,10 +419,11 @@
     }
 
     public String[] getPropertyNames() {
-        if (properties == null)
+        if (properties == null) {
             return null;
-        Vector v = new Vector();
-        for (Enumeration e = properties.keys(); e.hasMoreElements();) {
+        }
+        Vector<String> v = new Vector<String>();
+        for (Enumeration<?> e = properties.keys(); e.hasMoreElements();) {
             try {
                 v.add((String) e.nextElement());
             } catch (ClassCastException ex) {
@@ -423,21 +433,23 @@
         if (size > 0) {
             String names[] = new String[size];
             for (int i = 0; i < size; i++) {
-                names[i] = (String) v.elementAt(i);
+                names[i] = v.elementAt(i);
             }
             return names;
         }
         return null;
     }
 
+    @Override
     public String toString() {
         return "BufferedImage@" + Integer.toHexString(hashCode()) +
             ": type = " + imageType + " " + cm + " " + raster;
     }
 
     public WritableRaster getWritableTile(int tileX, int tileY) {
-        if (tileX == 0 && tileY == 0)
+        if (tileX == 0 && tileY == 0) {
             return raster;
+        }
         throw new ArrayIndexOutOfBoundsException("Both tileX and" +
                 " tileY are not equal to 0");
     }
@@ -478,8 +490,9 @@
     }
 
     public Raster getTile(int tileX, int tileY) {
-        if (tileX == 0 && tileY == 0)
+        if (tileX == 0 && tileY == 0) {
             return raster;
+        }
         throw new ArrayIndexOutOfBoundsException("Both tileX and" +
                 " tileY are not equal to 0");
     }
@@ -503,14 +516,17 @@
         return outr;
     }
 
+    @Override
     public ImageProducer getSource() {
         return new BufferedImageSource(this, properties);
     }
 
+    @Override
     public int getWidth(ImageObserver observer) {
         return raster.getWidth();
     }
 
+    @Override
     public int getHeight(ImageObserver observer) {
         return raster.getHeight();
     }
@@ -536,6 +552,7 @@
         return ge.createGraphics(this);
     }
 
+    @Override
     public Graphics getGraphics() {
         return createGraphics();
     }
@@ -549,8 +566,9 @@
 
     public int[] getRGB(int startX, int startY, int w, int h, int[] rgbArray,
             int offset, int scansize) {
-        if (rgbArray == null)
+        if (rgbArray == null) {
             rgbArray = new int[offset + h * scansize];
+        }
 
         int off = offset;
         for (int y = startY; y < startY + h; y++, off += scansize) {
@@ -579,8 +597,9 @@
     }
 
     public boolean isTileWritable(int tileX, int tileY) {
-        if (tileX == 0 && tileY == 0)
+        if (tileX == 0 && tileY == 0) {
             return true;
+        }
         throw new ArrayIndexOutOfBoundsException("Both tileX and tileY" +
                 " are not equal to 0");
     }
@@ -600,6 +619,7 @@
         return true;
     }
 
+    @Override
     public void flush() {
         imageSurf.dispose();
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ByteLookupTable.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ByteLookupTable.java?view=diff&rev=447226&r1=447225&r2=447226
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ByteLookupTable.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ByteLookupTable.java Sun Sep 17 21:12:12 2006
@@ -45,9 +45,11 @@
         return data;
     }
 
+    @Override
     public int[] lookupPixel(int[] src, int[] dst) {
-        if (dst == null)
+        if (dst == null) {
             dst = new int[src.length];
+        }
 
         int offset = getOffset();
         if (getNumComponents() == 1) {
@@ -64,8 +66,9 @@
     }
 
     public byte[] lookupPixel(byte[] src, byte[] dst) {
-        if (dst == null)
+        if (dst == null) {
             dst = new byte[src.length];
+        }
 
         int offset = getOffset();
         if (getNumComponents() == 1) {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ColorConvertOp.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ColorConvertOp.java?view=diff&rev=447226&r1=447225&r2=447226
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ColorConvertOp.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ColorConvertOp.java Sun Sep 17 21:12:12 2006
@@ -36,23 +36,23 @@
 
 public class ColorConvertOp implements BufferedImageOp, RasterOp {
     // Unused but required by interfaces
-    RenderingHints renderingHints = null;
+    RenderingHints renderingHints;
         
     // Sequence consisting of ColorSpace and ICC_Profile elements
     Object conversionSequence[] = new ICC_Profile[0]; // To eliminate checks for null
     
     // Not null if ColorConvertOp is constructed from the array of ICC profiles
-    private ICC_Profile midProfiles[] = null;   
+    private ICC_Profile midProfiles[];   
 
-    private ColorConverter cc = new ColorConverter();
-    private ICC_TransfomCreator tCreator = new ICC_TransfomCreator();
+    private final ColorConverter cc = new ColorConverter();
+    private final ICC_TransfomCreator tCreator = new ICC_TransfomCreator();
     private boolean isICC = true;
     
     
     // Cached ICC_Transform
     private class ICC_TransfomCreator {
-        private ICC_Transform transform = null;
-        private int maxComponents = 0;
+        private ICC_Transform transform;
+        private int maxComponents;
         
         /**
          * For the full ICC case
@@ -64,19 +64,22 @@
         public ICC_Transform getTransform(ICC_Profile src, ICC_Profile dst, ICC_Profile convSeq[]) {
             if (transform != null &&
                src == transform.getSrc() && 
-               dst == transform.getDst()) // Cached value is up-to-date
+               dst == transform.getDst()) {
                 return transform;
+            }
             
             int length = convSeq.length;
             int srcFlg = 0, dstFlg = 0;
             
             if (length == 0 || src != convSeq[0]) {
-                if (src != null)
+                if (src != null) {
                     srcFlg = 1; // need src profile
+                }
             }
             if (length == 0 || dst != convSeq[length-1]) {
-                if (dst != null)
+                if (dst != null) {
                     dstFlg = 1; // need dst profile
+                }
             }
             
             ICC_Profile profiles[];
@@ -86,13 +89,15 @@
             } else {
                 profiles = new ICC_Profile[nProfiles];
                 int pos = 0;
-                if (srcFlg != 0)
+                if (srcFlg != 0) {
                     profiles[pos++] = src;
+                }
                 for (int i=0; i<length; i++) {
                     profiles[pos++] = convSeq[i];
                 }
-                if (dstFlg != 0)
+                if (dstFlg != 0) {
                     profiles[pos++] = dst;
+                }
             }
             
             return transform = new ICC_Transform(profiles);
@@ -107,8 +112,8 @@
          * @return
          */
         public Object[] getSequence(Object src, Object dst) {
-            ArrayList profiles = new ArrayList(10);
-            ArrayList sequence = new ArrayList(10);         
+            ArrayList<Object> profiles = new ArrayList<Object>(10);
+            ArrayList<Object> sequence = new ArrayList<Object>(10);         
 
             // We need this profile anyway
             ICC_Profile xyzProfile = ICC_Profile.getInstance(ColorSpace.CS_CIEXYZ);
@@ -155,9 +160,7 @@
                     // If only one profile left we skip the transform -
                     // it can be only CIEXYZ
                     if (profiles.size() > 1) {
-                        sequence.add(new ICC_Transform(
-                                (ICC_Profile[])profiles.toArray(new ICC_Profile[0])
-                        ));
+                        sequence.add(new ICC_Transform(profiles.toArray(new ICC_Profile[0])));
 
                         // Add non-ICC color space to the sequence
                         sequence.add(conversionSequence[i]);
@@ -183,11 +186,10 @@
             }
             
             if (iccSequenceStarted) { // Make last transform if needed
-                sequence.add(
-                        new ICC_Transform((ICC_Profile[])profiles.toArray(new ICC_Profile[0]))
-                );
+                sequence.add(new ICC_Transform(profiles.toArray(new ICC_Profile[0])));
                 if (dst != null && !(dst instanceof ICC_Profile)) {
-                    sequence.add(dst); // Add last non-ICC color space to the sequence
+                    sequence.add(dst); // Add last non-ICC color space to the
+                                        // sequence
                 }
             }
 
@@ -392,8 +394,9 @@
         
         int nSpaces = conversionSequence.length;
         
-        if (nSpaces < 1)
+        if (nSpaces < 1) {
             throw new IllegalArgumentException("Destination color space is undefined");
+        }
         
         // Get destination color space
         Object destination = conversionSequence[nSpaces-1];
@@ -416,8 +419,9 @@
     }
 
     public final BufferedImage filter(BufferedImage src, BufferedImage dst) {
-        if (dst == null && conversionSequence.length < 1)
+        if (dst == null && conversionSequence.length < 1) {
             throw new IllegalArgumentException("Destionation color space should be defined");
+        }
 
         ColorModel srcCM = src.getColorModel();
         // First handle index color model
@@ -540,7 +544,6 @@
         
         int numPixels = tmpData.length;
         
-        ColorScaler scaler = new ColorScaler();
         // First transform...
         if (sequence[0] instanceof ICC_Transform) { // ICC
             ICC_Transform t = (ICC_Transform)sequence[0];
@@ -552,12 +555,12 @@
             cc.loadScalingData(xyzCS); // prepare for scaling XYZ
         }
         
-        for (int i=1, length=sequence.length; i<length-1; i++) {
-            if (sequence[i] instanceof ICC_Transform) {
-                ICC_Transform t = (ICC_Transform)sequence[i];
+        for (Object element : sequence) {
+            if (element instanceof ICC_Transform) {
+                ICC_Transform t = (ICC_Transform)element;
                 cc.translateColor(t, tmpData, null, null, numPixels);
             } else {
-                ColorSpace cs = (ColorSpace) sequence[i];
+                ColorSpace cs = (ColorSpace) element;
                 for (int k=0; k<numPixels; k++) {
                     tmpData[k] = cs.fromCIEXYZ(tmpData[k]);
                     tmpData[k] = cs.toCIEXYZ(tmpData[k]); 
@@ -580,16 +583,17 @@
         if (dstPt != null) {
             dstPt.setLocation(srcPt);
             return dstPt;
-        } else 
-            return new Point2D.Float((float) srcPt.getX(), (float) srcPt.getY());
+        }
+        return new Point2D.Float((float) srcPt.getX(), (float) srcPt.getY());
     }
 
     public WritableRaster createCompatibleDestRaster(Raster src) {
         int nComps = 0;
         int nSpaces = conversionSequence.length;
         
-        if (nSpaces < 2)
+        if (nSpaces < 2) {
             throw new IllegalArgumentException("Destination color space is undefined");
+        }
         
         Object lastCS = conversionSequence[nSpaces-1];
         if (lastCS instanceof ColorSpace) {
@@ -623,14 +627,13 @@
     }
 
     public final ICC_Profile[] getICC_Profiles() {
-        if (midProfiles != null)
+        if (midProfiles != null) {
             return midProfiles;
-        else
-            return null;
+        }
+        return null;
     }
 
     public final RenderingHints getRenderingHints() {
         return renderingHints;
     }    
 }
-

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ColorModel.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ColorModel.java?view=diff&rev=447226&r1=447225&r2=447226
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ColorModel.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ColorModel.java Sun Sep 17 21:12:12 2006
@@ -54,42 +54,49 @@
             boolean hasAlpha, boolean isAlphaPremultiplied, int transparency,
             int transferType) {
 
-        if (pixel_bits < 1)
+        if (pixel_bits < 1) {
             throw new IllegalArgumentException("The number of bits" +
                     " in the pixel values is less than 1");
+        }
 
-        if (bits == null)
+        if (bits == null) {
             throw new NullPointerException("bits is null");
+        }
 
         int sum = 0;
-        for (int i = 0; i < bits.length; i++) {
-            if (bits[i] < 0)
+        for (int element : bits) {
+            if (element < 0) {
                 throw new IllegalArgumentException("The elements in" +
                         " bits is less than 0");
-            sum += bits[i];
+            }
+            sum += element;
         }
 
-        if (sum < 1)
+        if (sum < 1) {
             throw new NullPointerException("The sum of the number" +
                     " of bits in bits is less than 1");
+        }
 
-        if (cspace == null)
+        if (cspace == null) {
             throw new IllegalArgumentException("The cspace is null");
+        }
 
         if (transparency < Transparency.OPAQUE ||
-               transparency > Transparency.TRANSLUCENT)
+               transparency > Transparency.TRANSLUCENT) {
             throw new IllegalArgumentException("The transparency " +
                     "is not a valid value");
+        }
 
         this.pixel_bits = pixel_bits;
-        this.bits = (int[]) bits.clone();
+        this.bits = bits.clone();
 
         maxValues = new int[bits.length];
         maxBitLength = 0;
         for (int i = 0; i < maxValues.length; i++) {
             maxValues[i] = (1 << bits[i]) - 1;
-            if (bits[i] > maxBitLength)
+            if (bits[i] > maxBitLength) {
                 maxBitLength = bits[i];
+            }
         }
 
         cs = cspace;
@@ -97,10 +104,11 @@
         this.isAlphaPremultiplied = isAlphaPremultiplied;
         numColorComponents = cs.getNumComponents();
 
-        if (hasAlpha)
+        if (hasAlpha) {
             numComponents = numColorComponents + 1;
-        else
+        } else {
             numComponents = numColorComponents;
+        }
 
         this.transparency = transparency;
         this.transferType = transferType;
@@ -109,9 +117,10 @@
 
     public ColorModel(int bits) {
 
-        if (bits < 1)
+        if (bits < 1) {
             throw new IllegalArgumentException("The number of " +
                     "bits in bits is less than 1");
+        }
 
         pixel_bits = bits;
         transferType = getTransferType(bits);
@@ -153,6 +162,7 @@
                 "supported by this ColorModel");
     }
 
+    @Override
     public String toString() {
         // The output format based on 1.5 release behaviour. 
         // It could be reveled such way:
@@ -179,9 +189,11 @@
                 normOffset);
     }
 
+    @Override
     public boolean equals(Object obj) {
-        if (!(obj instanceof ColorModel))
+        if (!(obj instanceof ColorModel)) {
             return false;
+        }
         ColorModel cm = (ColorModel) obj;
 
         return (pixel_bits == cm.getPixelSize() &&
@@ -242,20 +254,23 @@
 
     public float[] getNormalizedComponents(int[] components, int offset,
             float normComponents[], int normOffset) {
-        if (bits == null)
+        if (bits == null) {
             throw new UnsupportedOperationException("The bits is null");
+        }
 
-        if (components.length - offset < numComponents)
+        if (components.length - offset < numComponents) {
             throw new IllegalArgumentException("The length of components " +
                     "minus offset is less than numComponents ");
+        }
 
         if (normComponents == null) {
             normComponents = new float[numComponents + offset];
         } else {
-            if (normComponents.length - normOffset < numComponents)
+            if (normComponents.length - normOffset < numComponents) {
                 throw new IllegalArgumentException("The length of " +
                         "normComponents minus normOffset is " +
                         "less than numComponents ");
+            }
         }
 
         if (hasAlpha && isAlphaPremultiplied) {
@@ -265,7 +280,7 @@
             if (normAlpha != 0.0f) {
                 for (int i = 0; i < numColorComponents; i++) {
                     normComponents[normOffset + i] =
-                        (float) components[offset + i] /
+                        components[offset + i] /
                             (normAlpha * maxValues[i]);
                 }
                 normComponents[normOffset + numColorComponents] = normAlpha;
@@ -293,19 +308,22 @@
     public int[] getUnnormalizedComponents(float normComponents[],
             int normOffset, int components[], int offset) {
 
-        if (bits == null)
+        if (bits == null) {
             throw new UnsupportedOperationException("The bits is null");
+        }
 
-        if (normComponents.length - normOffset < numComponents)
+        if (normComponents.length - normOffset < numComponents) {
             throw new IllegalArgumentException("The length of normComponents " +
                     "minus normOffset is less than numComponents ");
+        }
 
         if (components == null) {
             components = new int[numComponents + offset];
         } else {
-            if (components.length - offset < numComponents)
+            if (components.length - offset < numComponents) {
                 throw new IllegalArgumentException("The length of components " +
                         "minus offset is less than numComponents ");
+            }
         }
 
         if (hasAlpha && isAlphaPremultiplied) {
@@ -349,13 +367,15 @@
     public abstract int getGreen(int pixel);
 
     public int getComponentSize(int componentIdx) {
-        if (bits == null)
+        if (bits == null) {
             throw new NullPointerException("The number of bits array is null");
+        }
 
-        if (componentIdx < 0 || componentIdx >= bits.length)
+        if (componentIdx < 0 || componentIdx >= bits.length) {
             throw new ArrayIndexOutOfBoundsException(
                     "componentIdx is greater than the number of components " +
                     "or less than zero");
+        }
 
         return bits[componentIdx];
     }
@@ -365,10 +385,10 @@
     public abstract int getAlpha(int pixel);
 
     public int[] getComponentSize() {
-        if (bits != null)
-            return (int[]) bits.clone();
-        else
-            return null;
+        if (bits != null) {
+            return bits.clone();
+        }
+        return null;
     }
 
     public final boolean isAlphaPremultiplied() {
@@ -379,9 +399,7 @@
         return hasAlpha;
     }
 
-    public void finalize() {
-    }
-
+    @Override
     public int hashCode() {
         int hash = 0;
         int tmp;
@@ -422,9 +440,9 @@
 
         if (bits != null) {
 
-            for (int i = 0; i < bits.length; i++) {
+            for (int element : bits) {
                 tmp = hash >>> 24;
-                hash ^= bits[i];
+                hash ^= element;
                 hash <<= 8;
                 hash |= tmp;
             }
@@ -455,9 +473,10 @@
     }
 
     public static ColorModel getRGBdefault() {
-        if (RGBdefault == null)
+        if (RGBdefault == null) {
             RGBdefault = new DirectColorModel(32, 0x00ff0000, 0x0000ff00,
                     0x000000ff, 0xff000000);
+        }
         return RGBdefault;
     }
 
@@ -474,25 +493,28 @@
 
         case DataBuffer.TYPE_BYTE:
             byte[] bPixel = (byte[]) obj;
-            if(bPixel.length > 1)
+            if(bPixel.length > 1) {
                 throw new UnsupportedOperationException("This pixel " +
                         "representation is not suuported by tis Color Model");
+            }
             pixel = bPixel[0] & 0xff;
             break;
 
         case DataBuffer.TYPE_USHORT:
             short[] sPixel = (short[]) obj;
-            if(sPixel.length > 1)
+            if(sPixel.length > 1) {
                 throw new UnsupportedOperationException("This pixel " +
                     "representation is not suuported by tis Color Model");
+            }
             pixel = sPixel[0] & 0xffff;
             break;
 
         case DataBuffer.TYPE_INT:
             int[] iPixel = (int[]) obj;
-            if(iPixel.length > 1)
+            if(iPixel.length > 1) {
                 throw new UnsupportedOperationException("This pixel " +
                     "representation is not suuported by tis Color Model");
+            }
             pixel = iPixel[0];
             break;
 
@@ -505,16 +527,14 @@
     }
 
     static int getTransferType(int bits) {
-        if (bits <= 8)
+        if (bits <= 8) {
             return DataBuffer.TYPE_BYTE;
-        else if (bits <= 16)
+        } else if (bits <= 16) {
             return DataBuffer.TYPE_USHORT;
-        else if (bits <= 32)
+        } else if (bits <= 32) {
             return DataBuffer.TYPE_INT;
-        else
+        } else {
             return DataBuffer.TYPE_UNDEFINED;
-
+        }
     }
-
 }
-

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ComponentColorModel.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ComponentColorModel.java?view=diff&rev=447226&r1=447225&r2=447226
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ComponentColorModel.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ComponentColorModel.java Sun Sep 17 21:12:12 2006
@@ -77,9 +77,6 @@
     private boolean is_LINEAR_RGB;       // Color Model has Linear RGB Color 
                                          // Space 
 
-    private boolean is_LINEAR_GRAY;      // Color Model has Linear Gray Color
-                                         // Space
-
     public ComponentColorModel(ColorSpace colorSpace, int bits[],
             boolean hasAlpha, boolean isAlphaPremultiplied, int transparency,
             int transferType) {
@@ -99,8 +96,9 @@
             scaleFactors = new float[numComponents];
             for (int i = 0; i < numColorComponents; i++) {
                 scaleFactors[i] = 1.0f / maxValues[i];
-                if (cs.getMinValue(i) != 0.0f || cs.getMaxValue(i) != 1.0f)
+                if (cs.getMinValue(i) != 0.0f || cs.getMaxValue(i) != 1.0f) {
                     donotSupportUnnormalized = true;
+                }
             }
             if (hasAlpha) {
                 maxValues[numColorComponents] =
@@ -117,8 +115,9 @@
             for (int i = 0; i < numComponents; i++) {
                 maxValues[i] = Short.MAX_VALUE;
                 scaleFactors[i] = 1.0f / maxValues[i];
-                if (cs.getMinValue(i) != 0.0f || cs.getMaxValue(i) != 1.0f)
+                if (cs.getMinValue(i) != 0.0f || cs.getMaxValue(i) != 1.0f) {
                     needScale = true;
+                }
             }
             if (needScale) {
                 minVals = new float[numColorComponents];
@@ -159,12 +158,14 @@
 
     private static int[] validateBits(int bits[], ColorSpace colorSpace,
             boolean hasAlpha, int transferType) {
-        if (bits != null)
+        if (bits != null) {
             return bits;
+        }
 
         int numComponents = colorSpace.getNumComponents();
-        if (hasAlpha)
+        if (hasAlpha) {
             numComponents++;
+        }
         bits = new int[numComponents];
 
         int componentLength = DataBuffer.getDataTypeSize(transferType);
@@ -179,8 +180,9 @@
     private static int createPixelBits(ColorSpace colorSpace, boolean hasAlpha,
             int transferType) {
         int numComponents = colorSpace.getNumComponents();
-        if (hasAlpha)
+        if (hasAlpha) {
             numComponents++;
+        }
         int componentLength = DataBuffer.getDataTypeSize(transferType);
         return numComponents * componentLength;
     }
@@ -189,8 +191,9 @@
             boolean hasAlpha, int transferType) {
         
         int numComponents = colorSpace.getNumComponents();
-        if (hasAlpha)
+        if (hasAlpha) {
             numComponents++;
+        }
 
         int bits[] = new int[numComponents];
         for(int i = 0; i < numComponents; i++){
@@ -199,42 +202,48 @@
         return bits;
     }
 
+    @Override
     public Object getDataElements(int components[], int offset, Object obj) {
-        if (donotSupportUnnormalized)
+        if (donotSupportUnnormalized) {
             throw new IllegalArgumentException("This ComponentColorModel " +
                     "does not support the unnormalized form");
+        }
 
-        if (offset + numComponents > components.length)
+        if (offset + numComponents > components.length) {
             throw new IllegalArgumentException("The components array is not " +
                     "large enough to hold all the color and alpha components ");
+        }
 
         switch (transferType) {
         case DataBuffer.TYPE_BYTE:
             byte ba[];
-            if (obj == null)
+            if (obj == null) {
                 ba = new byte[numComponents];
-            else
+            } else {
                 ba = (byte[]) obj;
+            }
             for (int i = 0, idx = offset; i < numComponents; i++, idx++) {
                 ba[i] = (byte) components[idx];
             }
             return ba;
         case DataBuffer.TYPE_USHORT:
             short sa[];
-            if (obj == null)
+            if (obj == null) {
                 sa = new short[numComponents];
-            else
+            } else {
                 sa = (short[]) obj;
+            }
             for (int i = 0, idx = offset; i < numComponents; i++, idx++) {
                 sa[i] = (short) components[idx];
             }
             return sa;
         case DataBuffer.TYPE_INT:
             int ia[];
-            if (obj == null)
+            if (obj == null) {
                 ia = new int[numComponents];
-            else
+            } else {
                 ia = (int[]) obj;
+            }
             for (int i = 0, idx = offset; i < numComponents; i++, idx++) {
                 ia[i] = components[idx];
             }
@@ -248,6 +257,7 @@
         }
     }
 
+    @Override
     public Object getDataElements(float normComponents[], int normOffset,
             Object obj) {
         if (needScale) {
@@ -260,10 +270,11 @@
         switch (transferType) {
         case DataBuffer.TYPE_BYTE:
             byte ba[];
-            if (obj == null)
+            if (obj == null) {
                 ba = new byte[numComponents];
-            else
+            } else {
                 ba = (byte[]) obj;
+            }
 
             if (needAlphaDivide) {
                 float alpha = normComponents[normOffset + numColorComponents];
@@ -286,10 +297,11 @@
 
         case DataBuffer.TYPE_USHORT:
             short usa[];
-            if (obj == null)
+            if (obj == null) {
                 usa = new short[numComponents];
-            else
+            } else {
                 usa = (short[]) obj;
+            }
 
             if (needAlphaDivide) {
                 float alpha = normComponents[normOffset + numColorComponents];
@@ -310,10 +322,11 @@
 
         case DataBuffer.TYPE_INT:
             int ia[];
-            if (obj == null)
+            if (obj == null) {
                 ia = new int[numComponents];
-            else
+            } else {
                 ia = (int[]) obj;
+            }
 
             if (needAlphaDivide) {
                 float alpha = normComponents[normOffset + numColorComponents];
@@ -333,10 +346,11 @@
 
         case DataBuffer.TYPE_SHORT:
             short sa[];
-            if (obj == null)
+            if (obj == null) {
                 sa = new short[numComponents];
-            else
+            } else {
                 sa = (short[]) obj;
+            }
 
             if (needAlphaDivide) {
                 float alpha = normComponents[normOffset + numColorComponents];
@@ -357,10 +371,11 @@
 
         case DataBuffer.TYPE_FLOAT:
             float fa[];
-            if (obj == null)
+            if (obj == null) {
                 fa = new float[numComponents];
-            else
+            } else {
                 fa = (float[]) obj;
+            }
 
             if (needAlphaDivide) {
                 float alpha = normComponents[normOffset + numColorComponents];
@@ -378,10 +393,11 @@
 
         case DataBuffer.TYPE_DOUBLE:
             double da[];
-            if (obj == null)
+            if (obj == null) {
                 da = new double[numComponents];
-            else
+            } else {
                 da = (double[]) obj;
+            }
 
             if (needAlphaDivide) {
                 double alpha = normComponents[normOffset + numColorComponents];
@@ -392,7 +408,7 @@
             } else {
                 for (int i = 0, idx = normOffset; i < numComponents;
                     i++, idx++) {
-                    da[i] = (double) normComponents[idx];
+                    da[i] = normComponents[idx];
                 }
             }
             return da;
@@ -404,6 +420,7 @@
         }
     }
 
+    @Override
     public Object getDataElements(int rgb, Object pixel) {
         float normComp[];
         float comp[];
@@ -426,13 +443,13 @@
                     blue = to_LINEAR_16RGB_LUT[blue] & 0xffff;
                 }
             }
-            comp[0] = (float) red / fFactor;
-            comp[1] = (float) green / fFactor;
-            comp[2] = (float) blue / fFactor;
-            if (!hasAlpha)
+            comp[0] = red / fFactor;
+            comp[1] = green / fFactor;
+            comp[2] = blue / fFactor;
+            if (!hasAlpha) {
                 normComp = comp;
-            else {
-                float normAlpha = (float) alpha / 255.0f;
+            } else {
+                float normAlpha = alpha / 255.0f;
                 normComp = new float[numComponents];
                 for (int i = 0; i < numColorComponents; i++) {
                     normComp[i] = comp[i];
@@ -440,14 +457,14 @@
                 normComp[numColorComponents] = normAlpha;
             }
         } else {
-            comp[0] = (float) red / fFactor;
-            comp[1] = (float) green / fFactor;
-            comp[2] = (float) blue / fFactor;
+            comp[0] = red / fFactor;
+            comp[1] = green / fFactor;
+            comp[2] = blue / fFactor;
             float[] defComp = cs.fromRGB(comp);
-            if (!hasAlpha)
+            if (!hasAlpha) {
                 normComp = defComp;
-            else {
-                float normAlpha = (float) alpha / 255.0f;
+            } else {
+                float normAlpha = alpha / 255.0f;
                 normComp = new float[numComponents];
                 for (int i = 0; i < numColorComponents; i++) {
                     normComp[i] = defComp[i];
@@ -464,8 +481,11 @@
         return getDataElements(normComp, 0, pixel);
     }
 
+    @Override
     public WritableRaster getAlphaRaster(WritableRaster raster) {
-        if(!hasAlpha) return null;
+        if(!hasAlpha) {
+            return null;
+        }
 
         int x = raster.getMinX();
         int y = raster.getMinY();
@@ -476,10 +496,12 @@
                 raster.getHeight(), x, y, bandList);
     }
 
+    @Override
     public ColorModel coerceData(WritableRaster raster,
             boolean isAlphaPremultiplied) {
-        if (!hasAlpha || this.isAlphaPremultiplied == isAlphaPremultiplied)
+        if (!hasAlpha || this.isAlphaPremultiplied == isAlphaPremultiplied) {
             return this;
+        }
 
         int minX = raster.getMinX();
         int minY = raster.getMinY();
@@ -491,18 +513,18 @@
             case DataBuffer.TYPE_BYTE:
             case DataBuffer.TYPE_USHORT:
             case DataBuffer.TYPE_INT:
-                float alphaFactor = (float) maxValues[numColorComponents];
+                float alphaFactor = maxValues[numColorComponents];
                 int iComponents[] = null;
                 int iTransparentComponents[] = new int[numComponents];
                 for (int i = 0; i < h; i++, minY++) {
                     for (int j = 0, x = minX; j < w; j++, x++) {
-                        iComponents = (int[]) raster.getPixel(x, minY,
+                        iComponents = raster.getPixel(x, minY,
                                 iComponents);
                         if (iComponents[numColorComponents] == 0) {
                             raster.setPixel(x, minY, iTransparentComponents);
                         } else {
                             float alpha =
-                                (float) iComponents[numColorComponents] /
+                                iComponents[numColorComponents] /
                                     alphaFactor;
                             for (int n = 0; n < numColorComponents; n++) {
                                 iComponents[n] =
@@ -516,7 +538,7 @@
                 break;
 
             case DataBuffer.TYPE_SHORT:
-                float sAlphaFactor = (float) maxValues[numColorComponents];
+                float sAlphaFactor = maxValues[numColorComponents];
                 short sComponents[] = null;
                 short sTransparentComponents[] = new short[numComponents];
                 for (int i = 0; i < h; i++, minY++) {
@@ -528,7 +550,7 @@
                                     sTransparentComponents);
                         } else {
                             float alpha =
-                                (float) sComponents[numColorComponents] /
+                                sComponents[numColorComponents] /
                                 sAlphaFactor;
                             for (int n = 0; n < numColorComponents; n++) {
                                 sComponents[n] =
@@ -591,22 +613,22 @@
             case DataBuffer.TYPE_BYTE:
             case DataBuffer.TYPE_USHORT:
             case DataBuffer.TYPE_INT:
-                float alphaFactor = (float) maxValues[numColorComponents];
+                float alphaFactor = maxValues[numColorComponents];
                 int iComponents[] = null;
                 int iTransparentComponents[] = new int[numComponents];
                 for (int i = 0; i < h; i++, minY++) {
                     for (int j = 0, x = minX; j < w; j++, x++) {
-                        iComponents = (int[]) raster.getPixel(x, minY,
+                        iComponents = raster.getPixel(x, minY,
                                 iComponents);
                         if (iComponents[numColorComponents] == 0) {
                             raster.setPixel(x, minY, iTransparentComponents);
                         } else {
                             float alpha =
-                                (float) iComponents[numColorComponents] /
+                                iComponents[numColorComponents] /
                                     alphaFactor;
                             for (int n = 0; n < numColorComponents; n++) {
                                 iComponents[n] =
-                                    (int) ((float) iComponents[n] /
+                                    (int) (iComponents[n] /
                                             alpha + 0.5f);
                             }
                             raster.setPixel(x, minY, iComponents);
@@ -617,7 +639,7 @@
                 break;
 
             case DataBuffer.TYPE_SHORT:
-                float sAlphaFactor = (float) maxValues[numColorComponents];
+                float sAlphaFactor = maxValues[numColorComponents];
                 short sComponents[] = null;
                 short sTransparentComponents[] = new short[numComponents];
                 for (int i = 0; i < h; i++, minY++) {
@@ -629,11 +651,11 @@
                                     sTransparentComponents);
                         } else {
                             float alpha =
-                                (float) sComponents[numColorComponents] /
+                                sComponents[numColorComponents] /
                                     sAlphaFactor;
                             for (int n = 0; n < numColorComponents; n++) {
                                 sComponents[n] =
-                                    (byte) ((float) sComponents[n] /
+                                    (byte) (sComponents[n] /
                                             alpha + 0.5f);
                             }
                             raster.setDataElements(x, minY, sComponents);
@@ -689,24 +711,28 @@
             }
         }
 
-        if (!signed)
+        if (!signed) {
             return new ComponentColorModel(cs, bits, hasAlpha,
                     isAlphaPremultiplied, transparency, transferType);
+        }
 
         return new ComponentColorModel(cs, null, hasAlpha,
                 isAlphaPremultiplied, transparency, transferType);
     }
 
+    @Override
     public int[] getComponents(Object pixel, int[] components, int offset) {
-        if (donotSupportUnnormalized)
+        if (donotSupportUnnormalized) {
             throw new IllegalArgumentException("This ComponentColorModel " +
                     "does not support the unnormalized form");
+        }
 
-        if (components == null)
+        if (components == null) {
             components = new int[offset + numComponents];
-        else if (offset + numComponents > components.length)
+        } else if (offset + numComponents > components.length) {
             throw new IllegalArgumentException("The components array is not " +
                     "large enough to hold all the color and alpha components ");
+        }
 
         switch (transferType) {
         case DataBuffer.TYPE_BYTE:
@@ -740,24 +766,26 @@
 
     }
 
+    @Override
     public float[] getNormalizedComponents(Object pixel,
             float normComponents[], int normOffset) {
 
-        if (normComponents == null)
+        if (normComponents == null) {
             normComponents = new float[numComponents + normOffset];
+        }
 
         switch (transferType) {
         case DataBuffer.TYPE_BYTE:
             byte ba[] = (byte[]) pixel;
             for (int i = 0, idx = normOffset; i < numComponents; i++, idx++) {
-                normComponents[idx] = (float) (ba[i] & 0xff) * scaleFactors[i];
+                normComponents[idx] = (ba[i] & 0xff) * scaleFactors[i];
             }
             break;
 
         case DataBuffer.TYPE_USHORT:
             short usa[] = (short[]) pixel;
             for (int i = 0, idx = normOffset; i < numComponents; i++, idx++) {
-                normComponents[idx] = (float) (usa[i] & 0xffff)
+                normComponents[idx] = (usa[i] & 0xffff)
                         * scaleFactors[i];
             }
             break;
@@ -765,14 +793,14 @@
         case DataBuffer.TYPE_INT:
             int ia[] = (int[]) pixel;
             for (int i = 0, idx = normOffset; i < numComponents; i++, idx++) {
-                normComponents[idx] = (float) ia[i] * scaleFactors[i];
+                normComponents[idx] = ia[i] * scaleFactors[i];
             }
             break;
 
         case DataBuffer.TYPE_SHORT:
             short sa[] = (short[]) pixel;
             for (int i = 0, idx = normOffset; i < numComponents; i++, idx++) {
-                normComponents[idx] = (float) sa[i] * scaleFactors[i];
+                normComponents[idx] = sa[i] * scaleFactors[i];
             }
             break;
 
@@ -813,16 +841,20 @@
         return normComponents;
     }
 
+    @Override
     public boolean equals(Object obj) {
-        if (!(obj instanceof ComponentColorModel))
+        if (!(obj instanceof ComponentColorModel)) {
             return false;
+        }
         return super.equals(obj);
     }
 
+    @Override
     public int getRed(Object inData) {
         return getRGBComponent(inData, 0);
     }
 
+    @Override
     public int getRGB(Object inData) {
         int alpha = getAlpha(inData);
         if (cs.getType() == ColorSpace.TYPE_GRAY) {
@@ -833,82 +865,93 @@
                 getBlue(inData));
     }
 
+    @Override
     public int getGreen(Object inData) {
         return getRGBComponent(inData, 1);
     }
 
+    @Override
     public int getBlue(Object inData) {
         return getRGBComponent(inData, 2);
     }
 
+    @Override
     public int getAlpha(Object inData) {
-        if (!hasAlpha)
+        if (!hasAlpha) {
             return 255;
+        }
         int alpha = 0;
 
         switch (transferType) {
-        case DataBuffer.TYPE_BYTE:
+        case DataBuffer.TYPE_BYTE: {
             byte ba[] = (byte[]) inData;
             alpha = ba[numColorComponents] & 0xff;
-            if (bits[numColorComponents] != 8)
+            if (bits[numColorComponents] != 8) {
                 return alphaLUT[alpha] & 0xff;
-            else
-                return alpha;
-
-        case DataBuffer.TYPE_USHORT:
+            }
+            return alpha;
+        }
+        case DataBuffer.TYPE_USHORT: {
             short usa[] = (short[]) inData;
             alpha = usa[numColorComponents] & 0xffff;
-            if (bits[numColorComponents] != 8)
+            if (bits[numColorComponents] != 8) {
                 return alphaLUT[alpha] & 0xff;
-            else
-                return alpha;
-
-        case DataBuffer.TYPE_INT:
+            }
+            return alpha;
+        }
+        case DataBuffer.TYPE_INT: {
             int ia[] = (int[]) inData;
             alpha = ia[numColorComponents];
-            if (bits[numColorComponents] != 8)
+            if (bits[numColorComponents] != 8) {
                 return alphaLUT[alpha] & 0xff;
-            else
-                return alpha;
-
-        case DataBuffer.TYPE_SHORT:
+            }
+            return alpha;
+        }
+        case DataBuffer.TYPE_SHORT: {
             short sa[] = (short[]) inData;
             alpha = sa[numColorComponents];
-            if (bits[numColorComponents] != 8)
+            if (bits[numColorComponents] != 8) {
                 return alphaLUT[alpha] & 0xff;
-            else
-                return alpha;
-
-        case DataBuffer.TYPE_FLOAT:
+            }
+            return alpha;
+        }
+        case DataBuffer.TYPE_FLOAT: {
             float fa[] = (float[]) inData;
             return (int) (fa[numColorComponents] * 255.0f + 0.5f);
-
-        case DataBuffer.TYPE_DOUBLE:
+        }
+        case DataBuffer.TYPE_DOUBLE: {
             double da[] = (double[]) inData;
             return (int) (da[numColorComponents] * 255.0 + 0.5);
-
-        default:
+        }
+        default: {
             throw new UnsupportedOperationException("This Color Model " +
                     "doesn't support this transferType");
         }
+        }
     }
 
+    @Override
     public WritableRaster createCompatibleWritableRaster(int w, int h) {
         SampleModel sm = createCompatibleSampleModel(w, h);
         DataBuffer db = sm.createDataBuffer();
         return Raster.createWritableRaster(sm, db, null);
     }
 
+    @Override
     public boolean isCompatibleSampleModel(SampleModel sm) {
-        if (!(sm instanceof ComponentSampleModel))
+        if (!(sm instanceof ComponentSampleModel)) {
             return false;
-        if (numComponents != sm.getNumBands())
+        }
+        if (numComponents != sm.getNumBands()) {
             return false;
-        if (transferType != sm.getTransferType())
+        }
+        if (transferType != sm.getTransferType()) {
             return false;
+        }
         return true;
     }
 
+    @Override
     public SampleModel createCompatibleSampleModel(int w, int h) {
         int bandOffsets[] = new int[numComponents];
         for (int i = 0; i < numComponents; i++) {
@@ -927,67 +970,83 @@
         }
     }
 
+    @Override
     public boolean isCompatibleRaster(Raster raster) {
         SampleModel sm = raster.getSampleModel();
-        if (!(sm instanceof ComponentSampleModel))
+        if (!(sm instanceof ComponentSampleModel)) {
             return false;
+        }
 
-        if (sm.getNumBands() != numComponents)
+        if (sm.getNumBands() != numComponents) {
             return false;
-        if (raster.getTransferType() != transferType)
+        }
+        if (raster.getTransferType() != transferType) {
             return false;
+        }
 
         int sampleSizes[] = sm.getSampleSize();
         for (int i = 0; i < numComponents; i++) {
-            if (bits[i] != sampleSizes[i])
+            if (bits[i] != sampleSizes[i]) {
                 return false;
+            }
         }
         return true;
     }
 
+    @Override
     public float[] getNormalizedComponents(int components[], int offset,
             float normComponents[], int normOffset) {
-        if (donotSupportUnnormalized)
+        if (donotSupportUnnormalized) {
             throw new IllegalArgumentException("This ComponentColorModel " +
                     "does not support the unnormalized form");
+        }
 
         return super.getNormalizedComponents(components, offset,
                 normComponents, normOffset);
     }
 
+    @Override
     public int getDataElement(int[] components, int offset) {
-        if (numComponents > 1)
+        if (numComponents > 1) {
             throw new IllegalArgumentException("There is more than one " +
                     "component in this ColorModel");
-        if (donotSupportUnnormalized)
+        }
+        if (donotSupportUnnormalized) {
             throw new IllegalArgumentException("This ComponentColorModel " +
                     "does not support the unnormalized form");
+        }
         return components[offset];
     }
 
+    @Override
     public int[] getUnnormalizedComponents(float[] normComponents,
             int normOffset, int[] components, int offset) {
 
-        if (donotSupportUnnormalized)
+        if (donotSupportUnnormalized) {
             throw new IllegalArgumentException("This ComponentColorModel " +
                     "does not support the unnormalized form ");
+        }
 
-        if (normComponents.length - normOffset < numComponents)
+        if (normComponents.length - normOffset < numComponents) {
             throw new IllegalArgumentException("The length of " +
                     "normComponents minus normOffset is less than" + 
                     " numComponents");
+        }
 
         return super.getUnnormalizedComponents(normComponents, normOffset,
                 components, offset);
     }
 
+    @Override
     public int getDataElement(float normComponents[], int normOffset) {
-        if (numComponents > 1)
+        if (numComponents > 1) {
             throw new IllegalArgumentException("There is more than one " +
                     "component in this ColorModel");
-        if (signed)
+        }
+        if (signed) {
             throw new IllegalArgumentException("The component value for " +
                     "this ColorModel is signed");
+        }
 
         Object pixel = getDataElements(normComponents, normOffset, null);
 
@@ -1008,52 +1067,63 @@
         }
     }
 
+    @Override
     public int[] getComponents(int pixel, int components[], int offset) {
-        if (numComponents > 1)
+        if (numComponents > 1) {
             throw new IllegalArgumentException("There is more than one " +
                     "component in this ColorModel");
-        if (donotSupportUnnormalized)
+        }
+        if (donotSupportUnnormalized) {
             throw new IllegalArgumentException("This ComponentColorModel " +
                     "does not support the unnormalized form");
+        }
 
-        if (components == null)
+        if (components == null) {
             components = new int[offset + 1];
+        }
 
         components[offset] = pixel & maxValues[0];
         return components;
     }
 
+    @Override
     public int getRed(int pixel) {
         float rgb[] = toRGB(pixel);
         return (int) (rgb[0] * 255.0f + 0.5f);
     }
 
+    @Override
     public int getRGB(int pixel) {
         return (getAlpha(pixel) << 24) | (getRed(pixel) << 16) |
                (getGreen(pixel) << 8) | getBlue(pixel);
     }
 
+    @Override
     public int getGreen(int pixel) {
         float rgb[] = toRGB(pixel);
         return (int) (rgb[1] * 255.0f + 0.5f);
     }
 
+    @Override
     public int getBlue(int pixel) {
         float rgb[] = toRGB(pixel);
         return (int) (rgb[2] * 255.0f + 0.5f);
     }
 
+    @Override
     public int getAlpha(int pixel) {
 
         // This method throw IllegalArgumentException according to 
         // Java API Spacification
-        if (signed)
+        if (signed) {
             throw new IllegalArgumentException("The component value " +
                     "for this ColorModel is signed");
+        }
 
-        if (numComponents > 1)
+        if (numComponents > 1) {
             throw new IllegalArgumentException("There is more than one " +
                     "component in this ColorModel");
+        }
 
         return 255;
     }
@@ -1065,8 +1135,6 @@
         is_sRGB = cs.isCS_sRGB();
         is_LINEAR_RGB = (cs == LUTColorConverter.LINEAR_RGB_CS);
 
-        boolean needDivide = hasAlpha && isAlphaPremultiplied;
-
         if (hasAlpha && bits[numColorComponents] != 8 && integral) {
             alphaLUT = new byte[maxValues[numColorComponents] + 1];
             for (int i = 0; i <= maxValues[numColorComponents]; i++) {
@@ -1089,7 +1157,7 @@
                 to_LINEAR_8RGB_LUT =
                     LUTColorConverter.getFromsRGBto8lRGB_LUT();
             }
-            fFactor = (float) ((1 << LINEAR_RGB_Length) - 1);
+            fFactor = ((1 << LINEAR_RGB_Length) - 1);
         } else {
             fFactor = 255.0f;
         }
@@ -1151,13 +1219,15 @@
         
         // This method throw IllegalArgumentException according to 
         // Java API Spacification
-        if (signed)
+        if (signed) {
             throw new IllegalArgumentException("The component value " +
                     "for this ColorModel is signed");
+        }
 
-        if (numComponents > 1)
+        if (numComponents > 1) {
             throw new IllegalArgumentException("There is more than " +
                     "one component in this ColorModel");
+        }
 
         Object obj = null;
 
@@ -1176,7 +1246,7 @@
 
         case DataBuffer.TYPE_INT:
             int ia[] = new int[1];
-            ia[0] = (int) pixel;
+            ia[0] = pixel;
             obj = ia;
             break;
 
@@ -1193,16 +1263,16 @@
     private int getRGBComponent(Object pixel, int idx) {
         if (is_sRGB) {
             int comp = getDefComponent(pixel, idx);
-            if (calcValue || bits[idx] == 8)
+            if (calcValue || bits[idx] == 8) {
                 return comp;
-            else
-                return colorLUTs[idx][comp] & 0xff;
+            }
+            return colorLUTs[idx][comp] & 0xff;
         } else if (is_LINEAR_RGB) {
             int comp = getDefComponent(pixel, idx);
-            if (calcValue || bits[idx] == LINEAR_RGB_Length)
+            if (calcValue || bits[idx] == LINEAR_RGB_Length) {
                 return from_LINEAR_RGB_LUT[comp] & 0xff;
-            else
-                return colorLUTs[idx][comp] & 0xff;
+            }
+            return colorLUTs[idx][comp] & 0xff;
         }
 
         float normComp[] = getNormalizedComponents(pixel, null, 0);
@@ -1229,7 +1299,7 @@
                     comp = 0;
                 } else {
                     float normAlpha = scaleFactors[numColorComponents] * alpha;
-                    comp = (int) ((float) comp * fFactor / normAlpha + 0.5f);
+                    comp = (int) (comp * fFactor / normAlpha + 0.5f);
                 }
                 calcValue = true;
             }
@@ -1244,7 +1314,7 @@
                     comp = 0;
                 } else {
                     float normAlpha = scaleFactors[numColorComponents] * alpha;
-                    comp = (int) ((float) comp * fFactor / normAlpha + 0.5f);
+                    comp = (int) (comp * fFactor / normAlpha + 0.5f);
                 }
                 calcValue = true;
             }
@@ -1259,7 +1329,7 @@
                     comp = 0;
                 } else {
                     float normAlpha = scaleFactors[numColorComponents] * alpha;
-                    comp = (int) ((float) comp * fFactor / normAlpha + 0.5f);
+                    comp = (int) (comp * fFactor / normAlpha + 0.5f);
                 }
                 calcValue = true;
             }
@@ -1274,7 +1344,7 @@
                     comp = 0;
                 } else {
                     float normAlpha = scaleFactors[numColorComponents] * alpha;
-                    comp = (int) ((float) comp * fFactor / normAlpha + 0.5f);
+                    comp = (int) (comp * fFactor / normAlpha + 0.5f);
                 }
                 calcValue = true;
             }



Mime
View raw message