harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r447226 [3/3] - /incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/
Date Mon, 18 Sep 2006 04:12:14 GMT
Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/PackedColorModel.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/PackedColorModel.java?view=diff&rev=447226&r1=447225&r2=447226
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/PackedColorModel.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/PackedColorModel.java Sun Sep 17 21:12:12 2006
@@ -39,18 +39,21 @@
                 (alphaMask == 0 ? false : true), isAlphaPremultiplied, trans,
                 validateTransferType(transferType));
 
-        if (pixel_bits < 1 || pixel_bits > 32)
+        if (pixel_bits < 1 || pixel_bits > 32) {
             throw new IllegalArgumentException("The bits is less than 1 or " +
                     "greater than 32");
+        }
 
         componentMasks = new int[numComponents];
-        for (int i = 0; i < numColorComponents; i++)
+        for (int i = 0; i < numColorComponents; i++) {
             componentMasks[i] = colorMaskArray[i];
+        }
 
         if (hasAlpha) {
             componentMasks[numColorComponents] = alphaMask;
-            if (this.bits[numColorComponents] == 1)
+            if (this.bits[numColorComponents] == 1) {
                 transparency = Transparency.BITMASK;
+            }
         }
 
         parseComponents();
@@ -64,18 +67,21 @@
                 (amask == 0 ? false : true), isAlphaPremultiplied, trans,
                 validateTransferType(transferType));
 
-        if (pixel_bits < 1 || pixel_bits > 32)
+        if (pixel_bits < 1 || pixel_bits > 32) {
             throw new IllegalArgumentException("The bits is less than 1 or " +
                     "greater than 32");
+        }
 
-        if (cs.getType() != ColorSpace.TYPE_RGB)
+        if (cs.getType() != ColorSpace.TYPE_RGB) {
             throw new IllegalArgumentException("The space is not a TYPE_RGB " +
                     "space");
+        }
 
         for (int i = 0; i < numColorComponents; i++) {
-            if (cs.getMinValue(i) != 0.0f || cs.getMaxValue(i) != 1.0f)
+            if (cs.getMinValue(i) != 0.0f || cs.getMaxValue(i) != 1.0f) {
                 throw new IllegalArgumentException("The min/max normalized " +
                         "component values are not 0.0/1.0");
+            }
         }
         componentMasks = new int[numComponents];
         componentMasks[0] = rmask;
@@ -84,15 +90,19 @@
 
         if (hasAlpha) {
             componentMasks[3] = amask;
-            if (this.bits[3] == 1)
+            if (this.bits[3] == 1) {
                 transparency = Transparency.BITMASK;
+            }
         }
 
         parseComponents();
     }
 
+    @Override
     public WritableRaster getAlphaRaster(WritableRaster raster) {
-        if(!hasAlpha) return null;
+        if(!hasAlpha) {
+            return null;
+        }
 
         int x = raster.getMinX();
         int y = raster.getMinY();
@@ -103,11 +113,14 @@
         return raster.createWritableChild(x, y, w, h, x, y, band);
     }
 
+    @Override
     public boolean equals(Object obj) {
-        if (obj == null)
+        if (obj == null) {
             return false;
-        if (!(obj instanceof PackedColorModel))
+        }
+        if (!(obj instanceof PackedColorModel)) {
             return false;
+        }
         PackedColorModel cm = (PackedColorModel) obj;
 
         return (pixel_bits == cm.getPixelSize() &&
@@ -122,11 +135,14 @@
                 Arrays.equals(componentMasks, cm.getMasks()));
     }
 
+    @Override
     public boolean isCompatibleSampleModel(SampleModel sm) {
-        if (sm == null)
+        if (sm == null) {
             return false;
-        if (!(sm instanceof SinglePixelPackedSampleModel))
+        }
+        if (!(sm instanceof SinglePixelPackedSampleModel)) {
             return false;
+        }
         SinglePixelPackedSampleModel esm = (SinglePixelPackedSampleModel) sm;
 
         return ((esm.getNumBands() == numComponents) &&
@@ -134,6 +150,7 @@
                 Arrays.equals(esm.getBitMasks(), componentMasks));
     }
 
+    @Override
     public SampleModel createCompatibleSampleModel(int w, int h) {
         return new SinglePixelPackedSampleModel(transferType, w, h,
                 componentMasks);
@@ -144,32 +161,35 @@
     }
 
     public final int[] getMasks() {
-        return (int[]) (componentMasks.clone());
+        return (componentMasks.clone());
     }
 
     private static int[] createBits(int colorMaskArray[], int alphaMask) {
         int bits[];
         int numComp;
-        if (alphaMask == 0)
+        if (alphaMask == 0) {
             numComp = colorMaskArray.length;
-        else
+        } else {
             numComp = colorMaskArray.length + 1;
+        }
 
         bits = new int[numComp];
         int i = 0;
         for (; i < colorMaskArray.length; i++) {
             bits[i] = countCompBits(colorMaskArray[i]);
-            if (bits[i] < 0)
+            if (bits[i] < 0) {
                 throw new IllegalArgumentException("The mask of the " + i
                         + " component is not contiguous");
+            }
         }
 
         if (i < numComp) {
             bits[i] = countCompBits(alphaMask);
 
-            if (bits[i] < 0)
+            if (bits[i] < 0) {
                 throw new IllegalArgumentException("The mask of the alpha " +
                         "component is not contiguous");
+            }
         }
 
         return bits;
@@ -179,32 +199,37 @@
             int amask) {
 
         int numComp;
-        if (amask == 0)
+        if (amask == 0) {
             numComp = 3;
-        else
+        } else {
             numComp = 4;
+        }
         int bits[] = new int[numComp];
 
         bits[0] = countCompBits(rmask);
-        if (bits[0] < 0)
+        if (bits[0] < 0) {
             throw new IllegalArgumentException("The mask of the red " +
                     "component is not contiguous");
+        }
 
         bits[1] = countCompBits(gmask);
-        if (bits[1] < 0)
+        if (bits[1] < 0) {
             throw new IllegalArgumentException("The mask of the green " +
                     "component is not contiguous");
+        }
 
         bits[2] = countCompBits(bmask);
-        if (bits[2] < 0)
+        if (bits[2] < 0) {
             throw new IllegalArgumentException("The mask of the blue " +
                     "component is not contiguous");
+        }
 
         if (amask != 0) {
             bits[3] = countCompBits(amask);
-            if (bits[3] < 0)
+            if (bits[3] < 0) {
                 throw new IllegalArgumentException("The mask of the alpha " +
                         "component is not contiguous");
+            }
         }
 
         return bits;
@@ -224,8 +249,9 @@
             }
         }
 
-        if (compMask != 0)
+        if (compMask != 0) {
             return -1;
+        }
 
         return bits;
     }
@@ -233,10 +259,11 @@
     private static int validateTransferType(int transferType) {
         if (transferType != DataBuffer.TYPE_BYTE &&
                 transferType != DataBuffer.TYPE_USHORT &&
-                transferType != DataBuffer.TYPE_INT)
+                transferType != DataBuffer.TYPE_INT) {
             throw new IllegalArgumentException("The transferType is not " +
                     "one of DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT " +
                     "or DataBuffer.TYPE_INT");
+        }
         return transferType;
     }
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/PixelInterleavedSampleModel.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/PixelInterleavedSampleModel.java?view=diff&rev=447226&r1=447225&r2=447226
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/PixelInterleavedSampleModel.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/PixelInterleavedSampleModel.java Sun Sep 17 21:12:12 2006
@@ -29,49 +29,60 @@
         int maxOffset = bandOffsets[0];
         int minOffset = bandOffsets[0];
         for (int i = 1; i < bandOffsets.length; i++) {
-            if (bandOffsets[i] > maxOffset)
+            if (bandOffsets[i] > maxOffset) {
                 maxOffset = bandOffsets[i];
-            if (bandOffsets[i] < minOffset)
+            }
+            if (bandOffsets[i] < minOffset) {
                 minOffset = bandOffsets[i];
+            }
         }
 
         maxOffset -= minOffset;
 
-        if (maxOffset > scanlineStride)
+        if (maxOffset > scanlineStride) {
             throw new IllegalArgumentException("Any offset between bands " +
                     "is greater than the Scanline stride");
+        }
 
-        if (maxOffset > pixelStride)
+        if (maxOffset > pixelStride) {
             throw new IllegalArgumentException("Pixel stride is less than " +
                     "any offset between bands");
+        }
 
-        if (pixelStride * w > scanlineStride)
+        if (pixelStride * w > scanlineStride) {
             throw new IllegalArgumentException("Product of Pixel stride and " +
                     "w is greater than Scanline stride ");
+        }
 
     }
 
+    @Override
     public SampleModel createSubsetSampleModel(int bands[]) {
         int newOffsets[] = new int[bands.length];
-        for (int i = 0; i < bands.length; i++)
+        for (int i = 0; i < bands.length; i++) {
             newOffsets[i] = bandOffsets[bands[i]];
+        }
 
         return new PixelInterleavedSampleModel(dataType, width, height,
                 pixelStride, scanlineStride, newOffsets);
     }
 
+    @Override
     public SampleModel createCompatibleSampleModel(int w, int h) {
         int newOffsets[];
         int minOffset = bandOffsets[0];
 
-        for (int i = 1; i < numBands; i++)
-            if (bandOffsets[i] < minOffset)
+        for (int i = 1; i < numBands; i++) {
+            if (bandOffsets[i] < minOffset) {
                 minOffset = bandOffsets[i];
+            }
+        }
 
         if (minOffset > 0) {
             newOffsets = new int[numBands];
-            for (int i = 0; i < numBands; i++)
+            for (int i = 0; i < numBands; i++) {
                 newOffsets[i] = bandOffsets[i] - minOffset;
+            }
         } else {
             newOffsets = bandOffsets;
         }
@@ -80,6 +91,7 @@
                 pixelStride * w, newOffsets);
     }
 
+    @Override
     public int hashCode() {
         int hash = super.hashCode();
         int tmp = hash >>> 8;

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/RGBImageFilter.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/RGBImageFilter.java?view=diff&rev=447226&r1=447225&r2=447226
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/RGBImageFilter.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/RGBImageFilter.java Sun Sep 17 21:12:12 2006
@@ -43,8 +43,12 @@
             filteredColorMap[i] = filterRGB(-1, -1, colorMap[i]);
             int alpha = filteredColorMap[i] >>> 24;
             if(alpha != 0xff){
-                if(!hasAlpha) hasAlpha = true;
-                if(alpha == 0 && trans < 0) trans = i;
+                if(!hasAlpha) {
+                    hasAlpha = true;
+                }
+                if(alpha == 0 && trans < 0) {
+                    trans = i;
+                }
             }
         }
 
@@ -57,6 +61,7 @@
         newmodel = newcm;
     }
 
+    @Override
     public void setColorModel(ColorModel model) {
         if(model instanceof IndexColorModel &&
                 canFilterIndexColorModel){
@@ -69,6 +74,7 @@
         }
     }
 
+    @Override
     public void setPixels(int x, int y, int w, int h, ColorModel model, 
             int[] pixels, int off, int scansize) {
         
@@ -87,6 +93,7 @@
         }
     }
 
+    @Override
     public void setPixels(int x, int y, int w, int h, ColorModel model, 
             byte[] pixels, int off, int scansize) {
         

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/Raster.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/Raster.java?view=diff&rev=447226&r1=447225&r2=447226
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/Raster.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/Raster.java Sun Sep 17 21:12:12 2006
@@ -53,32 +53,38 @@
             int w, int h, int scanlineStride, int bankIndices[],
             int bandOffsets[], Point location) {
 
-        if (w <= 0 || h <= 0)
+        if (w <= 0 || h <= 0) {
             throw new RasterFormatException("w or h is less than or "
                     + "equal to zero");
+        }
 
-        if (location == null)
+        if (location == null) {
             location = new Point(0, 0);
+        }
 
         if ((long) location.x + w > Integer.MAX_VALUE
-                || (long) location.y + h > Integer.MAX_VALUE)
+                || (long) location.y + h > Integer.MAX_VALUE) {
             throw new RasterFormatException("location.x + w or "
                     + "location.y + h results in integer overflow");
+        }
 
-        if (bankIndices == null || bandOffsets == null)
+        if (bankIndices == null || bandOffsets == null) {
             throw new ArrayIndexOutOfBoundsException("bankIndices or "
                     + "bandOffsets is null");
+        }
 
-        if (dataBuffer == null)
+        if (dataBuffer == null) {
             throw new NullPointerException("dataBuffer is null");
+        }
 
         int dataType = dataBuffer.getDataType();
 
         if (dataType != DataBuffer.TYPE_BYTE
                 && dataType != DataBuffer.TYPE_USHORT
-                && dataType != DataBuffer.TYPE_INT)
+                && dataType != DataBuffer.TYPE_INT) {
             throw new IllegalArgumentException("dataType is not one "
                     + "of the supported data types");
+        }
 
         BandedSampleModel sampleModel = new BandedSampleModel(dataType, w, h,
                 scanlineStride, bankIndices, bandOffsets);
@@ -90,36 +96,43 @@
             int scanlineStride, int bankIndices[], int bandOffsets[],
             Point location) {
 
-        if (w <= 0 || h <= 0)
+        if (w <= 0 || h <= 0) {
             throw new RasterFormatException("w or h is less than or "
                     + "equal to zero");
+        }
 
-        if (location == null)
+        if (location == null) {
             location = new Point(0, 0);
+        }
 
         if ((long) location.x + w > Integer.MAX_VALUE
-                || (long) location.y + h > Integer.MAX_VALUE)
+                || (long) location.y + h > Integer.MAX_VALUE) {
             throw new RasterFormatException("location.x + w or location.y + "
                     + "h results in integer overflow");
+        }
 
-        if (bankIndices == null || bandOffsets == null)
+        if (bankIndices == null || bandOffsets == null) {
             throw new ArrayIndexOutOfBoundsException("bankIndices or "
                     + "bandOffsets is null");
+        }
 
         if (dataType != DataBuffer.TYPE_BYTE
                 && dataType != DataBuffer.TYPE_USHORT
-                && dataType != DataBuffer.TYPE_INT)
+                && dataType != DataBuffer.TYPE_INT) {
             throw new IllegalArgumentException("dataType is not one of "
                     + "the supported data types");
+        }
 
         int maxOffset = bandOffsets[0];
         int maxBank = bankIndices[0];
 
         for (int i = 0; i < bankIndices.length; i++) {
-            if (bandOffsets[i] > maxOffset)
+            if (bandOffsets[i] > maxOffset) {
                 maxOffset = bandOffsets[i];
-            if (bankIndices[i] > maxBank)
+            }
+            if (bankIndices[i] > maxBank) {
                 maxBank = bankIndices[i];
+            }
         }
 
         int numBanks = maxBank + 1;
@@ -145,20 +158,24 @@
     public static WritableRaster createBandedRaster(int dataType, int w, int h,
             int bands, Point location) {
 
-        if (w <= 0 || h <= 0)
+        if (w <= 0 || h <= 0) {
             throw new RasterFormatException("w or h is less than "
                     + "or equal to zero");
+        }
 
-        if (location == null)
+        if (location == null) {
             location = new Point(0, 0);
+        }
 
         if ((long) location.x + w > Integer.MAX_VALUE
-                || (long) location.y + h > Integer.MAX_VALUE)
+                || (long) location.y + h > Integer.MAX_VALUE) {
             throw new RasterFormatException("location.x + w or location.y + "
                     + "h results in integer overflow");
+        }
 
-        if (bands < 1)
+        if (bands < 1) {
             throw new ArrayIndexOutOfBoundsException("bands is less than 1");
+        }
 
         int bandOffsets[] = new int[bands];
         int bankIndices[] = new int[bands];
@@ -175,33 +192,40 @@
             int w, int h, int scanlineStride, int pixelStride,
             int bandOffsets[], Point location) {
 
-        if (w <= 0 || h <= 0)
+        if (w <= 0 || h <= 0) {
             throw new RasterFormatException("w or h is less than or "
                     + "equal to zero");
+        }
 
-        if (location == null)
+        if (location == null) {
             location = new Point(0, 0);
+        }
 
         if ((long) location.x + w > Integer.MAX_VALUE
-                || (long) location.y + h > Integer.MAX_VALUE)
+                || (long) location.y + h > Integer.MAX_VALUE) {
             throw new RasterFormatException("location.x + w or location.y "
                     + "+ h results in integer overflow");
+        }
 
-        if (dataBuffer == null)
+        if (dataBuffer == null) {
             throw new NullPointerException("dataBuffer is null");
+        }
 
         int dataType = dataBuffer.getDataType();
         if (dataType != DataBuffer.TYPE_BYTE
-                && dataType != DataBuffer.TYPE_USHORT)
+                && dataType != DataBuffer.TYPE_USHORT) {
             throw new IllegalArgumentException("dataType is not one of "
                     + "the supported data types");
+        }
 
-        if (dataBuffer.getNumBanks() > 1)
+        if (dataBuffer.getNumBanks() > 1) {
             throw new RasterFormatException("dataBuffer has more "
                     + "than one bank");
+        }
 
-        if (bandOffsets == null)
+        if (bandOffsets == null) {
             throw new NullPointerException("bandOffsets is null");
+        }
 
         PixelInterleavedSampleModel sampleModel = 
             new PixelInterleavedSampleModel(dataType, w, h, 
@@ -214,30 +238,37 @@
             int h, int scanlineStride, int pixelStride, int bandOffsets[],
             Point location) {
 
-        if (w <= 0 || h <= 0)
+        if (w <= 0 || h <= 0) {
             throw new RasterFormatException("w or h is less than or "
                     + "equal to zero");
+        }
 
-        if (location == null)
+        if (location == null) {
             location = new Point(0, 0);
+        }
 
         if ((long) location.x + w > Integer.MAX_VALUE
-                || (long) location.y + h > Integer.MAX_VALUE)
+                || (long) location.y + h > Integer.MAX_VALUE) {
             throw new RasterFormatException("location.x + w or location.y + "
                     + "h results in integer overflow");
+        }
 
         if (dataType != DataBuffer.TYPE_BYTE
-                && dataType != DataBuffer.TYPE_USHORT)
+                && dataType != DataBuffer.TYPE_USHORT) {
             throw new IllegalArgumentException("dataType is not one of "
                     + "the supported data types");
+        }
 
-        if (bandOffsets == null)
+        if (bandOffsets == null) {
             throw new NullPointerException("bandOffsets is null");
+        }
 
         int minOffset = bandOffsets[0];
-        for (int i = 1; i < bandOffsets.length; i++)
-            if (bandOffsets[i] < minOffset)
+        for (int i = 1; i < bandOffsets.length; i++) {
+            if (bandOffsets[i] < minOffset) {
                 minOffset = bandOffsets[i];
+            }
+        }
         int size = (h - 1) * scanlineStride + w * pixelStride + minOffset;
         DataBuffer data = null;
 
@@ -257,26 +288,31 @@
     public static WritableRaster createInterleavedRaster(int dataType, int w,
             int h, int bands, Point location) {
 
-        if (w <= 0 || h <= 0)
+        if (w <= 0 || h <= 0) {
             throw new RasterFormatException("w or h is less than or "
                     + "equal to zero");
+        }
 
-        if (location == null)
+        if (location == null) {
             location = new Point(0, 0);
+        }
 
         if ((long) location.x + w > Integer.MAX_VALUE
-                || (long) location.y + h > Integer.MAX_VALUE)
+                || (long) location.y + h > Integer.MAX_VALUE) {
             throw new RasterFormatException("location.x + w or location.y + "
                     + "h results in integer overflow");
+        }
 
         if (dataType != DataBuffer.TYPE_BYTE
-                && dataType != DataBuffer.TYPE_USHORT)
+                && dataType != DataBuffer.TYPE_USHORT) {
             throw new IllegalArgumentException("dataType is not one of "
                     + "the supported data types");
+        }
 
         int bandOffsets[] = new int[bands];
-        for (int i = 0; i < bands; i++)
+        for (int i = 0; i < bands; i++) {
             bandOffsets[i] = i;
+        }
 
         return createInterleavedRaster(dataType, w, h, w * bands, bands,
                 bandOffsets, location);
@@ -285,33 +321,40 @@
     public static WritableRaster createPackedRaster(DataBuffer dataBuffer,
             int w, int h, int scanlineStride, int bandMasks[], Point location) {
 
-        if (w <= 0 || h <= 0)
+        if (w <= 0 || h <= 0) {
             throw new RasterFormatException("w or h is less than or "
                     + "equal to zero");
+        }
 
-        if (location == null)
+        if (location == null) {
             location = new Point(0, 0);
+        }
 
         if ((long) location.x + w > Integer.MAX_VALUE
-                || (long) location.y + h > Integer.MAX_VALUE)
+                || (long) location.y + h > Integer.MAX_VALUE) {
             throw new RasterFormatException("location.x + w or location.y + "
                     + "h results in integer overflow");
+        }
 
-        if (bandMasks == null)
+        if (bandMasks == null) {
             throw new RasterFormatException("bandMasks is null");
+        }
 
-        if (dataBuffer == null)
+        if (dataBuffer == null) {
             throw new NullPointerException("dataBuffer is null");
+        }
 
-        if (dataBuffer.getNumBanks() > 1)
+        if (dataBuffer.getNumBanks() > 1) {
             throw new RasterFormatException("dataBuffer has more than one bank");
+        }
 
         int dataType = dataBuffer.getDataType();
         if (dataType != DataBuffer.TYPE_BYTE
                 && dataType != DataBuffer.TYPE_USHORT
-                && dataType != DataBuffer.TYPE_INT)
+                && dataType != DataBuffer.TYPE_INT) {
             throw new IllegalArgumentException("dataType is not one of "
                     + "the supported data types");
+        }
 
         SinglePixelPackedSampleModel sampleModel = 
             new SinglePixelPackedSampleModel(dataType, w, h, 
@@ -323,30 +366,36 @@
     public static WritableRaster createPackedRaster(DataBuffer dataBuffer,
             int w, int h, int bitsPerPixel, Point location) {
 
-        if (w <= 0 || h <= 0)
+        if (w <= 0 || h <= 0) {
             throw new RasterFormatException("w or h is less than or "
                     + "equal to zero");
+        }
 
-        if (location == null)
+        if (location == null) {
             location = new Point(0, 0);
+        }
 
         if ((long) location.x + w > Integer.MAX_VALUE
-                || (long) location.y + h > Integer.MAX_VALUE)
+                || (long) location.y + h > Integer.MAX_VALUE) {
             throw new RasterFormatException("location.x + w or location.y "
                     + "+ h results in integer overflow");
+        }
 
-        if (dataBuffer == null)
+        if (dataBuffer == null) {
             throw new NullPointerException("dataBuffer is null");
+        }
 
-        if (dataBuffer.getNumBanks() > 1)
+        if (dataBuffer.getNumBanks() > 1) {
             throw new RasterFormatException("dataBuffer has more than one bank");
+        }
 
         int dataType = dataBuffer.getDataType();
         if (dataType != DataBuffer.TYPE_BYTE
                 && dataType != DataBuffer.TYPE_USHORT
-                && dataType != DataBuffer.TYPE_INT)
+                && dataType != DataBuffer.TYPE_INT) {
             throw new IllegalArgumentException("dataType is not one of "
                     + "the supported data types");
+        }
 
         MultiPixelPackedSampleModel sampleModel = 
             new MultiPixelPackedSampleModel(dataType, w, h, bitsPerPixel);
@@ -357,32 +406,38 @@
     public static WritableRaster createPackedRaster(int dataType, int w, int h,
             int bands, int bitsPerBand, Point location) {
 
-        if (w <= 0 || h <= 0)
+        if (w <= 0 || h <= 0) {
             throw new RasterFormatException("w or h is less than or "
                     + "equal to zero");
+        }
 
-        if (location == null)
+        if (location == null) {
             location = new Point(0, 0);
+        }
 
         if ((long) location.x + w > Integer.MAX_VALUE
-                || (long) location.y + h > Integer.MAX_VALUE)
+                || (long) location.y + h > Integer.MAX_VALUE) {
             throw new RasterFormatException("location.x + w or location.y + "
                     + "h results in integer overflow");
+        }
 
-        if (bands < 1 || bitsPerBand < 1)
+        if (bands < 1 || bitsPerBand < 1) {
             throw new IllegalArgumentException("bitsPerBand or bands is "
                     + "not greater than zero");
+        }
 
         if (dataType != DataBuffer.TYPE_BYTE
                 && dataType != DataBuffer.TYPE_USHORT
-                && dataType != DataBuffer.TYPE_INT)
+                && dataType != DataBuffer.TYPE_INT) {
             throw new IllegalArgumentException("dataType is not one of "
                     + "the supported data types");
+        }
 
-        if (bitsPerBand * bands > DataBuffer.getDataTypeSize(dataType))
+        if (bitsPerBand * bands > DataBuffer.getDataTypeSize(dataType)) {
             throw new IllegalArgumentException("The product of bitsPerBand "
                     + "and bands is greater than the number of bits held by "
                     + "dataType ");
+        }
 
         if (bands > 1) {
 
@@ -394,51 +449,54 @@
             }
 
             return createPackedRaster(dataType, w, h, bandMasks, location);
-        } else {
+        }
+        DataBuffer data = null;
+        int size = ((bitsPerBand * w + 
+                DataBuffer.getDataTypeSize(dataType) - 1) / 
+                DataBuffer.getDataTypeSize(dataType)) * h;
 
-            DataBuffer data = null;
-            int size = ((bitsPerBand * w + 
-                    DataBuffer.getDataTypeSize(dataType) - 1) / 
-                    DataBuffer.getDataTypeSize(dataType)) * h;
-
-            switch (dataType) {
-            case DataBuffer.TYPE_BYTE:
-                data = new DataBufferByte(size);
-                break;
-            case DataBuffer.TYPE_USHORT:
-                data = new DataBufferUShort(size);
-                break;
-            case DataBuffer.TYPE_INT:
-                data = new DataBufferInt(size);
-                break;
-            }
-            return createPackedRaster(data, w, h, bitsPerBand, location);
+        switch (dataType) {
+        case DataBuffer.TYPE_BYTE:
+            data = new DataBufferByte(size);
+            break;
+        case DataBuffer.TYPE_USHORT:
+            data = new DataBufferUShort(size);
+            break;
+        case DataBuffer.TYPE_INT:
+            data = new DataBufferInt(size);
+            break;
         }
+        return createPackedRaster(data, w, h, bitsPerBand, location);
     }
 
     public static WritableRaster createPackedRaster(int dataType, int w, int h,
             int bandMasks[], Point location) {
 
-        if (w <= 0 || h <= 0)
+        if (w <= 0 || h <= 0) {
             throw new RasterFormatException("w or h is less than or "
                     + "equal to zero");
+        }
 
-        if (location == null)
+        if (location == null) {
             location = new Point(0, 0);
+        }
 
         if ((long) location.x + w > Integer.MAX_VALUE
-                || (long) location.y + h > Integer.MAX_VALUE)
+                || (long) location.y + h > Integer.MAX_VALUE) {
             throw new RasterFormatException("location.x + w or location.y + "
                     + "h results in integer overflow");
+        }
 
-        if (bandMasks == null)
+        if (bandMasks == null) {
             throw new RasterFormatException("bandMasks is null");
+        }
 
         if (dataType != DataBuffer.TYPE_BYTE
                 && dataType != DataBuffer.TYPE_USHORT
-                && dataType != DataBuffer.TYPE_INT)
+                && dataType != DataBuffer.TYPE_INT) {
             throw new IllegalArgumentException("dataType is not one of "
                     + "the supported data types");
+        }
 
         DataBuffer data = null;
 
@@ -460,11 +518,13 @@
     public static Raster createRaster(SampleModel sm, DataBuffer db,
             Point location) {
 
-        if (sm == null || db == null)
+        if (sm == null || db == null) {
             throw new NullPointerException("SampleModel or DataBuffer is null");
+        }
 
-        if (location == null)
+        if (location == null) {
             location = new Point(0, 0);
+        }
 
         return new Raster(sm, db, location);
     }
@@ -472,11 +532,13 @@
     public static WritableRaster createWritableRaster(SampleModel sm,
             DataBuffer db, Point location) {
 
-        if (sm == null || db == null)
+        if (sm == null || db == null) {
             throw new NullPointerException("SampleModel or DataBuffer is null");
+        }
 
-        if (location == null)
+        if (location == null) {
             location = new Point(0, 0);
+        }
 
         return new OrdinaryWritableRaster(sm, db, location);
     }
@@ -484,11 +546,13 @@
     public static WritableRaster createWritableRaster(SampleModel sm,
             Point location) {
 
-        if (sm == null)
+        if (sm == null) {
             throw new NullPointerException("SampleModel is null");
+        }
 
-        if (location == null)
+        if (location == null) {
             location = new Point(0, 0);
+        }
 
         return createWritableRaster(sm, sm.createDataBuffer(), location);
     }
@@ -504,19 +568,23 @@
             Rectangle aRegion, Point sampleModelTranslate, Raster parent) {
 
         if (sampleModel == null || dataBuffer == null || aRegion == null
-                || sampleModelTranslate == null)
+                || sampleModelTranslate == null) {
             throw new NullPointerException("sampleModel, dataBuffer, "
                     + "aRegion or sampleModelTranslate is null");
+        }
 
-        if (aRegion.width <= 0 || aRegion.height <= 0)
+        if (aRegion.width <= 0 || aRegion.height <= 0) {
             throw new RasterFormatException("aRegion has width or height "
                     + "less than or equal to zero");
+        }
 
-        if ((long) aRegion.x + (long) aRegion.width > (long) Integer.MAX_VALUE)
+        if ((long) aRegion.x + (long) aRegion.width > Integer.MAX_VALUE) {
             throw new RasterFormatException("Overflow X coordinate of Raster");
+        }
 
-        if ((long) aRegion.y + (long) aRegion.height > (long) Integer.MAX_VALUE)
+        if ((long) aRegion.y + (long) aRegion.height > Integer.MAX_VALUE) {
             throw new RasterFormatException("Overflow Y coordinate of Raster");
+        }
 
         this.sampleModel = sampleModel;
         this.dataBuffer = dataBuffer;
@@ -540,38 +608,46 @@
 
     public Raster createChild(int parentX, int parentY, int width, int height,
             int childMinX, int childMinY, int bandList[]) {
-        if (width <= 0 || height <= 0)
+        if (width <= 0 || height <= 0) {
             throw new RasterFormatException("Width or Height of child "
                     + "Raster is less than or equal to zero");
+        }
 
-        if (parentX < this.minX || parentX + width > this.minX + this.width)
+        if (parentX < this.minX || parentX + width > this.minX + this.width) {
             throw new RasterFormatException("parentX disposes outside Raster");
+        }
 
-        if (parentY < this.minY || parentY + height > this.minY + this.height)
+        if (parentY < this.minY || parentY + height > this.minY + this.height) {
             throw new RasterFormatException("parentY disposes outside Raster");
+        }
 
-        if ((long) parentX + width > Integer.MAX_VALUE)
+        if ((long) parentX + width > Integer.MAX_VALUE) {
             throw new RasterFormatException("parentX + width results in "
                     + "integer overflow");
+        }
 
-        if ((long) parentY + height > Integer.MAX_VALUE)
+        if ((long) parentY + height > Integer.MAX_VALUE) {
             throw new RasterFormatException("parentY + height results in "
                     + "integer overflow");
+        }
 
-        if ((long) childMinX + width > Integer.MAX_VALUE)
+        if ((long) childMinX + width > Integer.MAX_VALUE) {
             throw new RasterFormatException("childMinX + width results in "
                     + "integer overflow");
+        }
 
-        if ((long) childMinY + height > Integer.MAX_VALUE)
+        if ((long) childMinY + height > Integer.MAX_VALUE) {
             throw new RasterFormatException("childMinY + height results in "
                     + "integer overflow");
+        }
 
         SampleModel childModel;
 
-        if (bandList == null)
+        if (bandList == null) {
             childModel = sampleModel;
-        else
+        } else {
             childModel = sampleModel.createSubsetSampleModel(bandList);
+        }
 
         int childTranslateX = childMinX - parentX;
         int childTranslateY = childMinY - parentY;
@@ -601,8 +677,9 @@
     }
 
     public WritableRaster createCompatibleWritableRaster(Rectangle rect) {
-        if (rect == null)
+        if (rect == null) {
             throw new NullPointerException("Rect is null");
+        }
 
         return createCompatibleWritableRaster(rect.x, rect.y, rect.width,
                 rect.height);

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ReplicateScaleFilter.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ReplicateScaleFilter.java?view=diff&rev=447226&r1=447225&r2=447226
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ReplicateScaleFilter.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ReplicateScaleFilter.java Sun Sep 17 21:12:12 2006
@@ -38,17 +38,23 @@
     protected Object outpixbuf;
 
     public ReplicateScaleFilter(int width, int height) {
-        if(width == 0 || height == 0)
+        if(width == 0 || height == 0) {
             throw new IllegalArgumentException("Width or Height equals zero");
+        }
 
         this.destWidth = width;
         this.destHeight = height;
     }
 
-    public void setProperties(Hashtable props) {
-        Hashtable fprops;
-        if(props == null) fprops = new Hashtable();
-        else fprops = (Hashtable) props.clone();
+    @SuppressWarnings("unchecked")
+    @Override
+    public void setProperties(Hashtable<?, ?> props) {
+        Hashtable<Object, Object> fprops;
+        if(props == null) {
+            fprops = new Hashtable<Object, Object>();
+        } else {
+            fprops = (Hashtable<Object, Object>) props.clone();
+        }
         String propName = "Rescale Filters";
         String prop = "destWidth=" + destWidth + "; " + 
         "destHeight=" + destHeight;
@@ -65,10 +71,13 @@
      }
 
     // setPixels methods produce pixels according to Java API Spacification
+    @Override
     public void setPixels(int x, int y, int w, int h, 
             ColorModel model, int[] pixels, int off, int scansize) {
         
-        if(srccols == null) initArrays();
+        if(srccols == null) {
+            initArrays();
+        }
         int buff[];
         if(outpixbuf == null || !(outpixbuf instanceof int[])){
             buff = new int[destWidth];
@@ -98,10 +107,13 @@
         }
     }
 
+    @Override
     public void setPixels(int x, int y, int w, int h, 
             ColorModel model, byte[] pixels, int off, int scansize) {
         
-        if(srccols == null) initArrays();
+        if(srccols == null) {
+            initArrays();
+        }
         byte buff[];
         if(outpixbuf == null || !(outpixbuf instanceof byte[])){
             buff = new byte[destWidth];
@@ -131,6 +143,7 @@
         }
     }
 
+    @Override
     public void setDimensions(int w, int h) {
         srcWidth = w;
         srcHeight = h;

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/SampleModel.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/SampleModel.java?view=diff&rev=447226&r1=447225&r2=447226
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/SampleModel.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/SampleModel.java Sun Sep 17 21:12:12 2006
@@ -30,24 +30,28 @@
     protected int dataType;
 
     public SampleModel(int dataType, int w, int h, int numBands) {
-        if (w <= 0 || h <= 0)
+        if (w <= 0 || h <= 0) {
             throw new IllegalArgumentException("Width or Height is not " +
                     "greater than 0");
+        }
 
         double squre = ((double) w) * ((double) h);
-        if (squre >= Integer.MAX_VALUE)
+        if (squre >= Integer.MAX_VALUE) {
             throw new IllegalArgumentException("The product of w and h is " +
                     "greater than Integer.MAX_VALUE ");
+        }
 
         if (dataType < DataBuffer.TYPE_BYTE ||
                 dataType > DataBuffer.TYPE_DOUBLE &&
-                dataType != DataBuffer.TYPE_UNDEFINED)
+                dataType != DataBuffer.TYPE_UNDEFINED) {
             throw new IllegalArgumentException("dataType is not one " +
                     "of the supported data types");
+        }
 
-        if (numBands < 1)
+        if (numBands < 1) {
             throw new IllegalArgumentException("Number of bands must " +
                     "be more then 0");
+        }
 
         this.dataType = dataType;
         this.width = w;
@@ -69,18 +73,21 @@
             byte bdata[];
             byte bbuf[] = null;
 
-            if (obj == null)
+            if (obj == null) {
                 bdata = new byte[numDataElements * w * h];
-            else
+            } else {
                 bdata = (byte[]) obj;
+            }
 
-            for (int i = y; i < y + h; i++)
+            for (int i = y; i < y + h; i++) {
                 for (int j = x; j < x + w; j++) {
                     bbuf = (byte[]) getDataElements(j, i, bbuf, data);
-                    for (int n = 0; n < numDataElements; n++)
+                    for (int n = 0; n < numDataElements; n++) {
                         bdata[idx++] = bbuf[n];
+                    }
                 }
-            obj = (Object) bdata;
+            }
+            obj = bdata;
             break;
 
         case DataBuffer.TYPE_SHORT:
@@ -88,72 +95,84 @@
             short sdata[];
             short sbuf[] = null;
 
-            if (obj == null)
+            if (obj == null) {
                 sdata = new short[numDataElements * w * h];
-            else
+            } else {
                 sdata = (short[]) obj;
+            }
 
-            for (int i = y; i < y + h; i++)
+            for (int i = y; i < y + h; i++) {
                 for (int j = x; j < x + w; j++) {
                     sbuf = (short[]) getDataElements(j, i, sbuf, data);
-                    for (int n = 0; n < numDataElements; n++)
+                    for (int n = 0; n < numDataElements; n++) {
                         sdata[idx++] = sbuf[n];
+                    }
                 }
-            obj = (Object) sdata;
+            }
+            obj = sdata;
             break;
 
         case DataBuffer.TYPE_INT:
             int idata[];
             int ibuf[] = null;
 
-            if (obj == null)
+            if (obj == null) {
                 idata = new int[numDataElements * w * h];
-            else
+            } else {
                 idata = (int[]) obj;
+            }
 
-            for (int i = y; i < y + h; i++)
+            for (int i = y; i < y + h; i++) {
                 for (int j = x; j < x + w; j++) {
                     ibuf = (int[]) getDataElements(j, i, ibuf, data);
-                    for (int n = 0; n < numDataElements; n++)
+                    for (int n = 0; n < numDataElements; n++) {
                         idata[idx++] = ibuf[n];
+                    }
                 }
-            obj = (Object) idata;
+            }
+            obj = idata;
             break;
 
         case DataBuffer.TYPE_FLOAT:
             float fdata[];
             float fbuf[] = null;
 
-            if (obj == null)
+            if (obj == null) {
                 fdata = new float[numDataElements * w * h];
-            else
+            } else {
                 fdata = (float[]) obj;
+            }
 
-            for (int i = y; i < y + h; i++)
+            for (int i = y; i < y + h; i++) {
                 for (int j = x; j < x + w; j++) {
                     fbuf = (float[]) getDataElements(j, i, fbuf, data);
-                    for (int n = 0; n < numDataElements; n++)
+                    for (int n = 0; n < numDataElements; n++) {
                         fdata[idx++] = fbuf[n];
+                    }
                 }
-            obj = (Object) fdata;
+            }
+            obj = fdata;
             break;
 
         case DataBuffer.TYPE_DOUBLE:
             double ddata[];
             double dbuf[] = null;
 
-            if (obj == null)
+            if (obj == null) {
                 ddata = new double[numDataElements * w * h];
-            else
+            } else {
                 ddata = (double[]) obj;
+            }
 
-            for (int i = y; i < y + h; i++)
+            for (int i = y; i < y + h; i++) {
                 for (int j = x; j < x + w; j++) {
                     dbuf = (double[]) getDataElements(j, i, dbuf, data);
-                    for (int n = 0; n < numDataElements; n++)
+                    for (int n = 0; n < numDataElements; n++) {
                         ddata[idx++] = dbuf[n];
+                    }
                 }
-            obj = (Object) ddata;
+            }
+            obj = ddata;
             break;
 
         }
@@ -172,59 +191,64 @@
         switch (getTransferType()) {
         case DataBuffer.TYPE_BYTE:
             byte bbuf[] = new byte[numDataElements];
-            for (int i = y; i < y + h; i++)
+            for (int i = y; i < y + h; i++) {
                 for (int j = x; j < x + w; j++) {
                     for (int n = 0; n < numDataElements; n++) {
                         bbuf[n] = ((byte[]) obj)[idx++];
                     }
                     setDataElements(j, i, bbuf, data);
                 }
+            }
 
             break;
 
         case DataBuffer.TYPE_SHORT:
         case DataBuffer.TYPE_USHORT:
             short sbuf[] = new short[numDataElements];
-            for (int i = y; i < y + h; i++)
+            for (int i = y; i < y + h; i++) {
                 for (int j = x; j < x + w; j++) {
                     for (int n = 0; n < numDataElements; n++) {
                         sbuf[n] = ((short[]) obj)[idx++];
                     }
                     setDataElements(j, i, sbuf, data);
                 }
+            }
             break;
 
         case DataBuffer.TYPE_INT:
             int ibuf[] = new int[numDataElements];
-            for (int i = y; i < y + h; i++)
+            for (int i = y; i < y + h; i++) {
                 for (int j = x; j < x + w; j++) {
                     for (int n = 0; n < numDataElements; n++) {
                         ibuf[n] = ((int[]) obj)[idx++];
                     }
                     setDataElements(j, i, ibuf, data);
                 }
+            }
             break;
 
         case DataBuffer.TYPE_FLOAT:
             float fbuf[] = new float[numDataElements];
-            for (int i = y; i < y + h; i++)
+            for (int i = y; i < y + h; i++) {
                 for (int j = x; j < x + w; j++) {
                     for (int n = 0; n < numDataElements; n++) {
                         fbuf[n] = ((float[]) obj)[idx++];
                     }
                     setDataElements(j, i, fbuf, data);
                 }
+            }
             break;
 
         case DataBuffer.TYPE_DOUBLE:
             double dbuf[] = new double[numDataElements];
-            for (int i = y; i < y + h; i++)
+            for (int i = y; i < y + h; i++) {
                 for (int j = x; j < x + w; j++) {
                     for (int n = 0; n < numDataElements; n++) {
                         dbuf[n] = ((double[]) obj)[idx++];
                     }
                     setDataElements(j, i, dbuf, data);
                 }
+            }
             break;
 
         }
@@ -235,184 +259,226 @@
     public abstract SampleModel createCompatibleSampleModel(int a0, int a1);
 
     public int[] getPixel(int x, int y, int iArray[], 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");
+        }
         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;
     }
 
     public void setPixel(int x, int y, int iArray[], 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");
-        for (int i = 0; i < numBands; i++)
+        }
+        for (int i = 0; i < numBands; i++) {
             setSample(x, y, i, iArray[i], data);
+        }
     }
 
     public float[] getPixel(int x, int y, float fArray[], 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");
+        }
         float pixel[];
 
-        if (fArray == null)
+        if (fArray == null) {
             pixel = new float[numBands];
-        else
+        } else {
             pixel = fArray;
+        }
 
-        for (int i = 0; i < numBands; i++)
+        for (int i = 0; i < numBands; i++) {
             pixel[i] = getSampleFloat(x, y, i, data);
+        }
 
         return pixel;
     }
 
     public void setPixel(int x, int y, float fArray[], 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");
-        for (int i = 0; i < numBands; i++)
+        }
+        for (int i = 0; i < numBands; i++) {
             setSample(x, y, i, fArray[i], data);
+        }
     }
 
     public double[] getPixel(int x, int y, double dArray[], 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");
+        }
         double pixel[];
 
-        if (dArray == null)
+        if (dArray == null) {
             pixel = new double[numBands];
-        else
+        } else {
             pixel = dArray;
+        }
 
-        for (int i = 0; i < numBands; i++)
+        for (int i = 0; i < numBands; i++) {
             pixel[i] = getSampleDouble(x, y, i, data);
+        }
 
         return pixel;
     }
 
     public void setPixel(int x, int y, double dArray[], 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");
-        for (int i = 0; i < numBands; i++)
+        }
+        for (int i = 0; i < numBands; i++) {
             setSample(x, y, i, dArray[i], data);
+        }
     }
 
     public abstract int getSample(int x, int y, int b, DataBuffer data);
 
     public float getSampleFloat(int x, int y, int b, DataBuffer data) {
-        return (float) getSample(x, y, b, data);
+        return getSample(x, y, b, data);
     }
 
     public double getSampleDouble(int x, int y, int b, DataBuffer data) {
-        return (double) getSample(x, y, b, data);
+        return getSample(x, y, b, data);
     }
 
     public int[] getPixels(int x, int y, int w, int h, int iArray[],
             DataBuffer data) {
-        if (x < 0 || y < 0 || x + w > this.width || y + h > this.height)
+        if (x < 0 || y < 0 || x + w > this.width || y + h > this.height) {
             throw new ArrayIndexOutOfBoundsException("Coordinates are " +
                     "not in bounds");
+        }
         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;
     }
 
     public void setPixels(int x, int y, int w, int h, int iArray[],
             DataBuffer data) {
-        if (x < 0 || y < 0 || x + w > this.width || y + h > this.height)
+        if (x < 0 || y < 0 || x + w > this.width || y + h > this.height) {
             throw new ArrayIndexOutOfBoundsException("Coordinates are " +
                     "not in bounds");
+        }
         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);
+                }
+            }
+        }
     }
 
     public float[] getPixels(int x, int y, int w, int h, float fArray[],
             DataBuffer data) {
-        if (x < 0 || y < 0 || x + w > this.width || y + h > this.height)
+        if (x < 0 || y < 0 || x + w > this.width || y + h > this.height) {
             throw new ArrayIndexOutOfBoundsException("Coordinates are " +
                     "not in bounds");
+        }
         float pixels[];
         int idx = 0;
 
-        if (fArray == null)
+        if (fArray == null) {
             pixels = new float[w * h * numBands];
-        else
+        } else {
             pixels = fArray;
+        }
 
-        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++] = getSampleFloat(j, i, n, data);
+                }
+            }
+        }
         return pixels;
     }
 
     public void setPixels(int x, int y, int w, int h, float fArray[],
             DataBuffer data) {
-        if (x < 0 || y < 0 || x + w > this.width || y + h > this.height)
+        if (x < 0 || y < 0 || x + w > this.width || y + h > this.height) {
             throw new ArrayIndexOutOfBoundsException("Coordinates are " +
                     "not in bounds");
+        }
         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, fArray[idx++], data);
+                }
+            }
+        }
     }
 
     public double[] getPixels(int x, int y, int w, int h, double dArray[],
             DataBuffer data) {
-        if (x < 0 || y < 0 || x + w > this.width || y + h > this.height)
+        if (x < 0 || y < 0 || x + w > this.width || y + h > this.height) {
             throw new ArrayIndexOutOfBoundsException("Coordinates are " +
                     "not in bounds");
+        }
         double pixels[];
         int idx = 0;
 
-        if (dArray == null)
+        if (dArray == null) {
             pixels = new double[w * h * numBands];
-        else
+        } else {
             pixels = dArray;
+        }
 
-        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++] = getSampleDouble(j, i, n, data);
+                }
+            }
+        }
         return pixels;
     }
 
     public void setPixels(int x, int y, int w, int h, double dArray[],
             DataBuffer data) {
-        if (x < 0 || y < 0 || x + w > this.width || y + h > this.height)
+        if (x < 0 || y < 0 || x + w > this.width || y + h > this.height) {
             throw new ArrayIndexOutOfBoundsException("Coordinates are " +
                     "not in bounds");
+        }
         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, dArray[idx++], data);
+                }
+            }
+        }
     }
 
     public abstract void setSample(int x, int y, int b, int s, DataBuffer data);
@@ -422,14 +488,17 @@
         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;
     }
@@ -437,9 +506,11 @@
     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);
+            }
+        }
     }
 
     public float[] getSamples(int x, int y, int w, int h, int b,
@@ -447,14 +518,17 @@
         float samples[];
         int idx = 0;
 
-        if (fArray == null)
+        if (fArray == null) {
             samples = new float[w * h];
-        else
+        } else {
             samples = fArray;
+        }
 
-        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++] = getSampleFloat(j, i, b, data);
+            }
+        }
 
         return samples;
     }
@@ -462,9 +536,11 @@
     public void setSamples(int x, int y, int w, int h, int b, float fArray[],
             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, fArray[idx++], data);
+            }
+        }
     }
 
     public double[] getSamples(int x, int y, int w, int h, int b,
@@ -472,14 +548,17 @@
         double samples[];
         int idx = 0;
 
-        if (dArray == null)
+        if (dArray == null) {
             samples = new double[w * h];
-        else
+        } else {
             samples = dArray;
+        }
 
-        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++] = getSampleDouble(j, i, b, data);
+            }
+        }
 
         return samples;
     }
@@ -487,9 +566,11 @@
     public void setSamples(int x, int y, int w, int h, int b, double dArray[],
             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, dArray[idx++], data);
+            }
+        }
     }
 
     public void setSample(int x, int y, int b, float s, DataBuffer data) {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ShortLookupTable.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ShortLookupTable.java?view=diff&rev=447226&r1=447225&r2=447226
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ShortLookupTable.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ShortLookupTable.java Sun Sep 17 21:12:12 2006
@@ -46,8 +46,9 @@
     }
 
     public short[] lookupPixel(short[] src, short[] dst) {
-        if (dst == null)
+        if (dst == null) {
             dst = new short[src.length];
+        }
 
         int offset = getOffset();
         if (getNumComponents() == 1) {
@@ -63,9 +64,11 @@
         return dst;
     }
 
+    @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) {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/SinglePixelPackedSampleModel.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/SinglePixelPackedSampleModel.java?view=diff&rev=447226&r1=447225&r2=447226
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/SinglePixelPackedSampleModel.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/SinglePixelPackedSampleModel.java Sun Sep 17 21:12:12 2006
@@ -45,12 +45,13 @@
 
         if (dataType != DataBuffer.TYPE_BYTE &&
                 dataType != DataBuffer.TYPE_USHORT &&
-                dataType != DataBuffer.TYPE_INT)
+                dataType != DataBuffer.TYPE_INT) {
             throw new IllegalArgumentException("Unsupported data type:"
                     + dataType);
+        }
 
         this.scanlineStride = scanlineStride;
-        this.bitMasks = (int[]) bitMasks.clone();
+        this.bitMasks = bitMasks.clone();
         this.bitOffsets = new int[this.numBands];
         this.bitSizes = new int[this.numBands];
 
@@ -72,64 +73,73 @@
                     size++;
                 }
 
-                if (mask != 0)
+                if (mask != 0) {
                     throw new IllegalArgumentException("Wrong mask :"
                             + bitMasks[i]);
+                }
             }
 
             this.bitOffsets[i] = offset;
             this.bitSizes[i] = size;
 
-            if (this.maxBitSize < size)
+            if (this.maxBitSize < size) {
                 this.maxBitSize = size;
+            }
 
         }
 
     }
 
+    @Override
     public Object getDataElements(int x, int y, Object obj, 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");
+        }
         switch (getTransferType()) {
         case DataBuffer.TYPE_BYTE:
             byte bdata[];
-            if (obj == null)
+            if (obj == null) {
                 bdata = new byte[1];
-            else
+            } else {
                 bdata = (byte[]) obj;
+            }
 
             bdata[0] = (byte) data.getElem(y * scanlineStride + x);
-            obj = (Object) bdata;
+            obj = bdata;
             break;
         case DataBuffer.TYPE_USHORT:
             short sdata[];
-            if (obj == null)
+            if (obj == null) {
                 sdata = new short[1];
-            else
+            } else {
                 sdata = (short[]) obj;
+            }
 
             sdata[0] = (short) data.getElem(y * scanlineStride + x);
-            obj = (Object) sdata;
+            obj = sdata;
             break;
         case DataBuffer.TYPE_INT:
             int idata[];
-            if (obj == null)
+            if (obj == null) {
                 idata = new int[1];
-            else
+            } else {
                 idata = (int[]) obj;
+            }
 
             idata[0] = data.getElem(y * scanlineStride + x);
-            obj = (Object) idata;
+            obj = idata;
             break;
         }
         return obj;
     }
 
+    @Override
     public void setDataElements(int x, int y, Object obj, 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");
+        }
         switch (getTransferType()) {
         case DataBuffer.TYPE_BYTE:
             data.setElem(y * scanlineStride + x, ((byte[]) obj)[0] & 0xff);
@@ -143,9 +153,11 @@
         }
     }
 
+    @Override
     public boolean equals(Object o) {
-        if ((o == null) || !(o instanceof SinglePixelPackedSampleModel))
+        if ((o == null) || !(o instanceof SinglePixelPackedSampleModel)) {
             return false;
+        }
 
         SinglePixelPackedSampleModel model = (SinglePixelPackedSampleModel) o;
         return this.width == model.width &&
@@ -158,137 +170,171 @@
                 this.scanlineStride == model.scanlineStride;
     }
 
+    @Override
     public SampleModel createSubsetSampleModel(int bands[]) {
-        if (bands.length > this.numBands)
+        if (bands.length > this.numBands) {
             throw new RasterFormatException("The number of the bands " +
                     "in the subset is greater than the number of bands " +
                     "in the sample model");
+        }
 
         int masks[] = new int[bands.length];
-        for (int i = 0; i < bands.length; i++)
+        for (int i = 0; i < bands.length; i++) {
             masks[i] = this.bitMasks[bands[i]];
+        }
         return new SinglePixelPackedSampleModel(this.dataType, this.width,
                 this.height, this.scanlineStride, masks);
     }
 
+    @Override
     public SampleModel createCompatibleSampleModel(int w, int h) {
         return new SinglePixelPackedSampleModel(this.dataType, w, h,
                 this.bitMasks);
     }
 
+    @Override
     public int[] getPixel(int x, int y, int iArray[], 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");
+        }
         int pixel[];
-        if (iArray == null)
+        if (iArray == null) {
             pixel = new int[this.numBands];
-        else
+        } else {
             pixel = iArray;
+        }
 
-        for (int i = 0; i < this.numBands; i++)
+        for (int i = 0; i < this.numBands; i++) {
             pixel[i] = getSample(x, y, i, data);
+        }
 
         return pixel;
     }
 
+    @Override
     public void setPixel(int x, int y, int iArray[], 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");
-        for (int i = 0; i < this.numBands; i++)
+        }
+        for (int i = 0; i < this.numBands; i++) {
             setSample(x, y, i, iArray[i], data);
+        }
     }
 
+    @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");
+        }
         int sample = data.getElem(y * scanlineStride + x);
         return ((sample & this.bitMasks[b]) >>> this.bitOffsets[b]);
     }
 
+    @Override
     public int[] getPixels(int x, int y, int w, int h, int iArray[],
             DataBuffer data) {
-        if (x < 0 || y < 0 || x + w > this.width || y + h > this.height)
+        if (x < 0 || y < 0 || x + w > this.width || y + h > this.height) {
             throw new ArrayIndexOutOfBoundsException("Coordinates are " +
                     "not in bounds");
+        }
 
         int pixels[];
 
-        if (iArray == null)
+        if (iArray == null) {
             pixels = new int[w * h * this.numBands];
-        else
+        } else {
             pixels = iArray;
+        }
 
         int idx = 0;
 
         for (int i = y; i < y + h; i++) {
-            for (int j = x; j < x + w; j++)
-                for (int n = 0; n < this.numBands; n++)
+            for (int j = x; j < x + w; j++) {
+                for (int n = 0; n < this.numBands; n++) {
                     pixels[idx++] = getSample(j, i, n, data);
+                }
+            }
         }
         return pixels;
     }
 
+    @Override
     public void setPixels(int x, int y, int w, int h, int iArray[],
             DataBuffer data) {
-        if (x < 0 || y < 0 || x + w > this.width || y + h > this.height)
+        if (x < 0 || y < 0 || x + w > this.width || y + h > this.height) {
             throw new ArrayIndexOutOfBoundsException("Coordinates are " +
                     "not in bounds");
+        }
 
         int idx = 0;
 
         for (int i = y; i < y + h; i++) {
-            for (int j = x; j < x + w; j++)
-                for (int n = 0; n < this.numBands; n++)
+            for (int j = x; j < x + w; j++) {
+                for (int n = 0; n < this.numBands; n++) {
                     setSample(j, i, n, iArray[idx++], data);
+                }
+            }
         }
     }
 
+    @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");
+        }
         int tmp = data.getElem(y * scanlineStride + x);
         tmp &= ~this.bitMasks[b];
         tmp |= (s << this.bitOffsets[b]) & this.bitMasks[b];
         data.setElem(y * scanlineStride + x, tmp);
     }
 
+    @Override
     public int[] getSamples(int x, int y, int w, int h, int b, int iArray[],
             DataBuffer data) {
-        if (x < 0 || y < 0 || x + w > this.width || y + h > this.height)
+        if (x < 0 || y < 0 || x + w > this.width || y + h > this.height) {
             throw new ArrayIndexOutOfBoundsException("Coordinates are " +
                     "not in bounds");
+        }
 
         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 void setSamples(int x, int y, int w, int h, int b, int iArray[],
             DataBuffer data) {
-        if (x < 0 || y < 0 || x + w > this.width || y + h > this.height)
+        if (x < 0 || y < 0 || x + w > this.width || y + h > this.height) {
             throw new ArrayIndexOutOfBoundsException("Coordinates are " +
                     "not in bounds");
+        }
 
         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(x + j, y + i, b, iArray[idx++], data);
+            }
+        }
     }
 
+    @Override
     public DataBuffer createDataBuffer() {
         DataBuffer data = null;
         int size = (this.height - 1) * scanlineStride + width;
@@ -311,22 +357,25 @@
         return (y * scanlineStride + x);
     }
 
+    @Override
     public int getSampleSize(int band) {
         return bitSizes[band];
     }
 
+    @Override
     public int[] getSampleSize() {
-        return (int[]) bitSizes.clone();
+        return bitSizes.clone();
     }
 
     public int[] getBitOffsets() {
-        return (int[]) bitOffsets.clone();
+        return bitOffsets.clone();
     }
 
     public int[] getBitMasks() {
-        return (int[]) bitMasks.clone();
+        return bitMasks.clone();
     }
 
+    @Override
     public int hashCode() {
         int hash = 0;
         int tmp = 0;
@@ -347,20 +396,20 @@
         tmp = hash >>> 24;
         hash <<= 8;
         hash |= tmp;
-        for (int i = 0; i < bitMasks.length; i++) {
-            hash ^= bitMasks[i];
+        for (int element : bitMasks) {
+            hash ^= element;
             tmp = hash >>> 24;
             hash <<= 8;
             hash |= tmp;
         }
-        for (int i = 0; i < bitOffsets.length; i++) {
-            hash ^= bitOffsets[i];
+        for (int element : bitOffsets) {
+            hash ^= element;
             tmp = hash >>> 24;
             hash <<= 8;
             hash |= tmp;
         }
-        for (int i = 0; i < bitSizes.length; i++) {
-            hash ^= bitSizes[i];
+        for (int element : bitSizes) {
+            hash ^= element;
             tmp = hash >>> 24;
             hash <<= 8;
             hash |= tmp;
@@ -373,6 +422,7 @@
         return this.scanlineStride;
     }
 
+    @Override
     public int getNumDataElements() {
         return 1;
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/VolatileImage.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/VolatileImage.java?view=diff&rev=447226&r1=447225&r2=447226
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/VolatileImage.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/VolatileImage.java Sun Sep 17 21:12:12 2006
@@ -91,13 +91,16 @@
     *
     ***************************************************************************/
 
+    @Override
     public void flush() {
     }
 
+    @Override
     public Graphics getGraphics() {
         return createGraphics();
     }
 
+    @Override
     public ImageProducer getSource() {
         return getSnapshot().getSource();
     }



Mime
View raw message