harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r447226 [2/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/ComponentSampleModel.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ComponentSampleModel.java?view=diff&rev=447226&r1=447225&r2=447226
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ComponentSampleModel.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/ComponentSampleModel.java Sun Sep 17 21:12:12 2006
@@ -40,29 +40,34 @@
 
         super(dataType, w, h, bandOffsets.length);
 
-        if (pixelStride < 0)
+        if (pixelStride < 0) {
             throw new IllegalArgumentException("Pixel stride must be >= 0");
+        }
 
-        if (scanlineStride < 0)
+        if (scanlineStride < 0) {
             throw new IllegalArgumentException("Scanline stride must be >= 0");
+        }
 
-        if (bankIndices.length != bandOffsets.length)
+        if (bankIndices.length != bandOffsets.length) {
             throw new IllegalArgumentException("Bank Indices length must be " +
                     "equal Bank Offsets length");
+        }
 
         this.pixelStride = pixelStride;
         this.scanlineStride = scanlineStride;
-        this.bandOffsets = (int[]) bandOffsets.clone();
-        this.bankIndices = (int[]) bankIndices.clone();
+        this.bandOffsets = bandOffsets.clone();
+        this.bankIndices = bankIndices.clone();
         this.numBands = bandOffsets.length;
 
         int maxBank = 0;
         for (int i = 0; i < bankIndices.length; i++) {
-            if (bankIndices[i] < 0)
+            if (bankIndices[i] < 0) {
                 throw new IllegalArgumentException("Index of " + i
                         + "bank must be >= 0");
-            if (bankIndices[i] > maxBank)
+            }
+            if (bankIndices[i] > maxBank) {
                 maxBank = bankIndices[i];
+            }
         }
         this.numBanks = maxBank + 1;
 
@@ -72,133 +77,155 @@
             int scanlineStride, int bandOffsets[]) {
 
         super(dataType, w, h, bandOffsets.length);
-        if (pixelStride < 0)
+        if (pixelStride < 0) {
             throw new IllegalArgumentException("Pixel stride must be >= 0");
+        }
 
-        if (scanlineStride < 0)
+        if (scanlineStride < 0) {
             throw new IllegalArgumentException("Scanline stride must be >= 0");
+        }
 
         this.pixelStride = pixelStride;
         this.scanlineStride = scanlineStride;
-        this.bandOffsets = (int[]) bandOffsets.clone();
+        this.bandOffsets = bandOffsets.clone();
         this.numBands = bandOffsets.length;
         this.numBanks = 1;
 
         this.bankIndices = new int[numBands];
-        for (int i = 0; i < numBands; i++)
+        for (int i = 0; i < numBands; i++) {
             bankIndices[i] = 0;
+        }
     }
 
+    @Override
     public Object getDataElements(int x, int y, Object obj, DataBuffer data) {
         switch (dataType) {
         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:
             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:
             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:
             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:
             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 void setDataElements(int x, int y, Object obj, DataBuffer data) {
         switch (dataType) {
         case DataBuffer.TYPE_BYTE:
             byte barr[] = (byte[]) obj;
-            for (int i = 0; i < numBands; i++)
+            for (int i = 0; i < numBands; i++) {
                 setSample(x, y, i, barr[i] & 0xff, data);
+            }
             break;
 
         case DataBuffer.TYPE_SHORT:
         case DataBuffer.TYPE_USHORT:
             short sarr[] = (short[]) obj;
-            for (int i = 0; i < numBands; i++)
+            for (int i = 0; i < numBands; i++) {
                 setSample(x, y, i, sarr[i] & 0xffff, data);
+            }
             break;
 
         case DataBuffer.TYPE_INT:
             int iarr[] = (int[]) obj;
-            for (int i = 0; i < numBands; i++)
+            for (int i = 0; i < numBands; i++) {
                 setSample(x, y, i, iarr[i], data);
+            }
             break;
 
         case DataBuffer.TYPE_FLOAT:
             float farr[] = (float[]) obj;
-            for (int i = 0; i < numBands; i++)
+            for (int i = 0; i < numBands; i++) {
                 setSample(x, y, i, farr[i], data);
+            }
             break;
 
         case DataBuffer.TYPE_DOUBLE:
             double darr[] = (double[]) obj;
-            for (int i = 0; i < numBands; i++)
+            for (int i = 0; i < numBands; i++) {
                 setSample(x, y, i, darr[i], data);
+            }
             break;
         }
     }
 
+    @Override
     public boolean equals(Object o) {
-        if ((o == null) || !(o instanceof ComponentSampleModel))
+        if ((o == null) || !(o instanceof ComponentSampleModel)) {
             return false;
+        }
         ComponentSampleModel model = (ComponentSampleModel) o;
         return this.width == model.width && this.height == model.height &&
                this.numBands == model.numBands &&
@@ -211,11 +238,13 @@
                this.pixelStride == model.pixelStride;
     }
 
+    @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 indices[] = new int[bands.length];
         int offsets[] = new int[bands.length];
@@ -230,155 +259,196 @@
 
     }
 
+    @Override
     public SampleModel createCompatibleSampleModel(int w, int h) {
         return new ComponentSampleModel(dataType, w, h, pixelStride,
                 pixelStride * w, bankIndices, bandOffsets);
     }
 
+    @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 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 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 * pixelStride + 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 * pixelStride + 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 * pixelStride + bandOffsets[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[] = null;
         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 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);
+                }
+            }
+        }
     }
 
+    @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 * pixelStride
                 + bandOffsets[b], s);
     }
 
+    @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(j, i, b, iArray[idx++], data);
+            }
+        }
     }
 
+    @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 * pixelStride + bandOffsets[b], s);
     }
 
+    @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 * pixelStride + bandOffsets[b], s);
     }
 
+    @Override
     public DataBuffer createDataBuffer() {
         DataBuffer data = null;
 
         int maxOffset = bandOffsets[0];
-        for (int i = 1; i < bandOffsets.length; i++)
-            if (bandOffsets[i] > maxOffset)
+        for (int i = 1; i < bandOffsets.length; i++) {
+            if (bandOffsets[i] > maxOffset) {
                 maxOffset = bandOffsets[i];
+            }
+        }
         int size = (height - 1) * scanlineStride +
         (width - 1) * pixelStride + maxOffset + 1;
 
@@ -415,27 +485,31 @@
         return y * scanlineStride + x * pixelStride + bandOffsets[0];
     }
 
+    @Override
     public final int getSampleSize(int band) {
         return DataBuffer.getDataTypeSize(dataType);
     }
 
+    @Override
     public final int[] getSampleSize() {
         int sampleSizes[] = new int[numBands];
         int size = DataBuffer.getDataTypeSize(dataType);
 
-        for (int i = 0; i < numBands; i++)
+        for (int i = 0; i < numBands; i++) {
             sampleSizes[i] = size;
+        }
         return sampleSizes;
     }
 
     public final int[] getBankIndices() {
-        return (int[]) bankIndices.clone();
+        return bankIndices.clone();
     }
 
     public final int[] getBandOffsets() {
-        return (int[]) bandOffsets.clone();
+        return bandOffsets.clone();
     }
 
+    @Override
     public int hashCode() {
         int hash = 0;
         int tmp = 0;
@@ -456,14 +530,14 @@
         tmp = hash >>> 24;
         hash <<= 8;
         hash |= tmp;
-        for (int i = 0; i < bandOffsets.length; i++) {
-            hash ^= bandOffsets[i];
+        for (int element : bandOffsets) {
+            hash ^= element;
             tmp = hash >>> 24;
             hash <<= 8;
             hash |= tmp;
         }
-        for (int i = 0; i < bankIndices.length; i++) {
-            hash ^= bankIndices[i];
+        for (int element : bankIndices) {
+            hash ^= element;
             tmp = hash >>> 24;
             hash <<= 8;
             hash |= tmp;
@@ -485,6 +559,7 @@
         return pixelStride;
     }
 
+    @Override
     public final int getNumDataElements() {
         return numBands;
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/CropImageFilter.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/CropImageFilter.java?view=diff&rev=447226&r1=447225&r2=447226
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/CropImageFilter.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/CropImageFilter.java Sun Sep 17 21:12:12 2006
@@ -32,10 +32,15 @@
         HEIGHT = h;
     }
 
-    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 = "Crop Filters";
         String prop = "x=" + X + "; y=" + Y + "; width=" +
         WIDTH + "; height=" + HEIGHT;
@@ -51,10 +56,13 @@
         consumer.setProperties(fprops);
     }
 
+    @Override
     public void setPixels(int x, int y, int w, int h, ColorModel model, int[] pixels, int off, int scansize) {
 
         if(x + w < X || X + WIDTH < x ||
-                y + h < Y || Y + HEIGHT < y) return;
+                y + h < Y || Y + HEIGHT < y) {
+            return;
+        }
 
         int destX, destY, destWidth, destHeight, endX, endY,
         srcEndX, srcEndY;
@@ -104,10 +112,13 @@
         consumer.setPixels(destX, destY, destWidth, destHeight, model, pixels, newOffset, scansize);
     }
 
+    @Override
     public void setPixels(int x, int y, int w, int h, ColorModel model, byte[] pixels, int off, int scansize) {
 
         if(x + w < X || X + WIDTH < x ||
-                y + h < Y || Y + HEIGHT < y) return;
+                y + h < Y || Y + HEIGHT < y) {
+            return;
+        }
 
         int destX, destY, destWidth, destHeight, endX, endY,
         srcEndX, srcEndY;
@@ -157,6 +168,7 @@
         consumer.setPixels(destX, destY, destWidth, destHeight, model, pixels, newOffset, scansize);
     }
 
+    @Override
     public void setDimensions(int w, int h) {
         consumer.setDimensions(WIDTH, HEIGHT);
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/DataBuffer.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/DataBuffer.java?view=diff&rev=447226&r1=447225&r2=447226
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/DataBuffer.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/DataBuffer.java Sun Sep 17 21:12:12 2006
@@ -59,7 +59,7 @@
         this.dataType = dataType;
         this.size = size;
         this.banks = numBanks;
-        this.offsets = (int[]) offsets.clone();
+        this.offsets = offsets.clone();
         this.offset = offsets[0];
     }
 
@@ -108,11 +108,11 @@
     public abstract int getElem(int bank, int i);
 
     public float getElemFloat(int bank, int i) {
-        return (float) getElem(bank, i);
+        return getElem(bank, i);
     }
 
     public double getElemDouble(int bank, int i) {
-        return (double) getElem(bank, i);
+        return getElem(bank, i);
     }
 
     public void setElemFloat(int i, float val) {
@@ -128,11 +128,11 @@
     }
 
     public float getElemFloat(int i) {
-        return (float) getElem(0, i);
+        return getElem(0, i);
     }
 
     public double getElemDouble(int i) {
-        return (double) getElem(i);
+        return getElem(i);
     }
 
     public int[] getOffsets() {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/DataBufferByte.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/DataBufferByte.java?view=diff&rev=447226&r1=447225&r2=447226
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/DataBufferByte.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/DataBufferByte.java Sun Sep 17 21:12:12 2006
@@ -25,12 +25,12 @@
 
     public DataBufferByte(byte dataArrays[][], int size, int offsets[]) {
         super(TYPE_BYTE, size, dataArrays.length, offsets);
-        data = (byte[][]) dataArrays.clone();
+        data = dataArrays.clone();
     }
 
     public DataBufferByte(byte dataArrays[][], int size) {
         super(TYPE_BYTE, size, dataArrays.length);
-        data = (byte[][]) dataArrays.clone();
+        data = dataArrays.clone();
     }
 
     public DataBufferByte(byte dataArray[], int size, int offset) {
@@ -60,18 +60,21 @@
         data[0] = new byte[size];
     }
 
+    @Override
     public void setElem(int bank, int i, int val) {
         data[bank][offsets[bank] + i] = (byte) val;
         notifyChanged();
     }
 
+    @Override
     public void setElem(int i, int val) {
         data[0][offset + i] = (byte) val;
         notifyChanged();
     }
 
+    @Override
     public int getElem(int bank, int i) {
-        return (int) (data[bank][offsets[bank] + i]) & 0xff;
+        return (data[bank][offsets[bank] + i]) & 0xff;
     }
 
     public byte[] getData(int bank) {
@@ -79,13 +82,14 @@
         return data[bank];
     }
 
+    @Override
     public int getElem(int i) {
-        return (int) (data[0][offset + i]) & 0xff;
+        return (data[0][offset + i]) & 0xff;
     }
 
     public byte[][] getBankData() {
         notifyTaken();
-        return (byte[][]) data.clone();
+        return data.clone();
     }
 
     public byte[] getData() {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/DataBufferDouble.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/DataBufferDouble.java?view=diff&rev=447226&r1=447225&r2=447226
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/DataBufferDouble.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/DataBufferDouble.java Sun Sep 17 21:12:12 2006
@@ -25,12 +25,12 @@
 
     public DataBufferDouble(double dataArrays[][], int size, int offsets[]) {
         super(TYPE_DOUBLE, size, dataArrays.length, offsets);
-        data = (double[][]) dataArrays.clone();
+        data = dataArrays.clone();
     }
 
     public DataBufferDouble(double dataArrays[][], int size) {
         super(TYPE_DOUBLE, size, dataArrays.length);
-        data = (double[][]) dataArrays.clone();
+        data = dataArrays.clone();
     }
 
     public DataBufferDouble(double dataArray[], int size, int offset) {
@@ -60,43 +60,52 @@
         data[0] = new double[size];
     }
 
+    @Override
     public void setElem(int bank, int i, int val) {
-        data[bank][offsets[bank] + i] = (double) val;
+        data[bank][offsets[bank] + i] = val;
         notifyChanged();
     }
 
+    @Override
     public void setElemFloat(int bank, int i, float val) {
-        data[bank][offsets[bank] + i] = (double) val;
+        data[bank][offsets[bank] + i] = val;
         notifyChanged();
     }
 
+    @Override
     public void setElemDouble(int bank, int i, double val) {
         data[bank][offsets[bank] + i] = val;
         notifyChanged();
     }
 
+    @Override
     public void setElem(int i, int val) {
-        data[0][offset + i] = (double) val;
+        data[0][offset + i] = val;
         notifyChanged();
     }
 
+    @Override
     public int getElem(int bank, int i) {
         return (int) (data[bank][offsets[bank] + i]);
     }
 
+    @Override
     public float getElemFloat(int bank, int i) {
         return (float) (data[bank][offsets[bank] + i]);
     }
 
+    @Override
     public double getElemDouble(int bank, int i) {
         return data[bank][offsets[bank] + i];
     }
 
+    @Override
     public void setElemFloat(int i, float val) {
-        data[0][offset + i] = (double) val;
+        data[0][offset + i] = val;
         notifyChanged();
     }
 
+    @Override
     public void setElemDouble(int i, double val) {
         data[0][offset + i] = val;
         notifyChanged();
@@ -107,21 +116,24 @@
         return data[bank];
     }
 
+    @Override
     public int getElem(int i) {
         return (int) (data[0][offset + i]);
     }
 
+    @Override
     public float getElemFloat(int i) {
         return (float) (data[0][offset + i]);
     }
 
+    @Override
     public double getElemDouble(int i) {
         return data[0][offset + i];
     }
 
     public double[][] getBankData() {
         notifyTaken();
-        return (double[][]) data.clone();
+        return data.clone();
     }
 
     public double[] getData() {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/DataBufferFloat.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/DataBufferFloat.java?view=diff&rev=447226&r1=447225&r2=447226
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/DataBufferFloat.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/DataBufferFloat.java Sun Sep 17 21:12:12 2006
@@ -25,12 +25,12 @@
 
     public DataBufferFloat(float dataArrays[][], int size, int offsets[]) {
         super(TYPE_FLOAT, size, dataArrays.length, offsets);
-        data = (float[][]) dataArrays.clone();
+        data = dataArrays.clone();
     }
 
     public DataBufferFloat(float dataArrays[][], int size) {
         super(TYPE_FLOAT, size, dataArrays.length);
-        data = (float[][]) dataArrays.clone();
+        data = dataArrays.clone();
     }
 
     public DataBufferFloat(float dataArray[], int size, int offset) {
@@ -60,43 +60,52 @@
         data[0] = new float[size];
     }
 
+    @Override
     public void setElem(int bank, int i, int val) {
-        data[bank][offsets[bank] + i] = (float) val;
+        data[bank][offsets[bank] + i] = val;
         notifyChanged();
     }
 
+    @Override
     public void setElemFloat(int bank, int i, float val) {
         data[bank][offsets[bank] + i] = val;
         notifyChanged();
     }
 
+    @Override
     public void setElemDouble(int bank, int i, double val) {
         data[bank][offsets[bank] + i] = (float) val;
         notifyChanged();
     }
 
+    @Override
     public void setElem(int i, int val) {
-        data[0][offset + i] = (float) val;
+        data[0][offset + i] = val;
         notifyChanged();
     }
 
+    @Override
     public int getElem(int bank, int i) {
         return (int) (data[bank][offsets[bank] + i]);
     }
 
+    @Override
     public float getElemFloat(int bank, int i) {
         return data[bank][offsets[bank] + i];
     }
 
+    @Override
     public double getElemDouble(int bank, int i) {
-        return (double) data[bank][offsets[bank] + i];
+        return data[bank][offsets[bank] + i];
     }
 
+    @Override
     public void setElemFloat(int i, float val) {
         data[0][offset + i] = val;
         notifyChanged();
     }
 
+    @Override
     public void setElemDouble(int i, double val) {
         data[0][offset + i] = (float) val;
         notifyChanged();
@@ -107,21 +116,24 @@
         return data[bank];
     }
 
+    @Override
     public int getElem(int i) {
         return (int) (data[0][offset + i]);
     }
 
+    @Override
     public float getElemFloat(int i) {
         return data[0][offset + i];
     }
 
+    @Override
     public double getElemDouble(int i) {
-        return (double) data[0][offset + i];
+        return data[0][offset + i];
     }
 
     public float[][] getBankData() {
         notifyTaken();
-        return (float[][]) data.clone();
+        return data.clone();
     }
 
     public float[] getData() {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/DataBufferInt.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/DataBufferInt.java?view=diff&rev=447226&r1=447225&r2=447226
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/DataBufferInt.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/DataBufferInt.java Sun Sep 17 21:12:12 2006
@@ -25,12 +25,12 @@
 
     public DataBufferInt(int dataArrays[][], int size, int offsets[]) {
         super(TYPE_INT, size, dataArrays.length, offsets);
-        data = (int[][]) dataArrays.clone();
+        data = dataArrays.clone();
     }
 
     public DataBufferInt(int dataArrays[][], int size) {
         super(TYPE_INT, size, dataArrays.length);
-        data = (int[][]) dataArrays.clone();
+        data = dataArrays.clone();
     }
 
     public DataBufferInt(int dataArray[], int size, int offset) {
@@ -60,16 +60,19 @@
         data[0] = new int[size];
     }
 
+    @Override
     public void setElem(int bank, int i, int val) {
         data[bank][offsets[bank] + i] = val;
         notifyChanged();
     }
 
+    @Override
     public void setElem(int i, int val) {
         data[0][offset + i] = val;
         notifyChanged();
     }
 
+    @Override
     public int getElem(int bank, int i) {
         return data[bank][offsets[bank] + i];
     }
@@ -79,13 +82,14 @@
         return data[bank];
     }
 
+    @Override
     public int getElem(int i) {
         return data[0][offset + i];
     }
 
     public int[][] getBankData() {
         notifyTaken();
-        return (int[][]) data.clone();
+        return data.clone();
     }
 
     public int[] getData() {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/DataBufferShort.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/DataBufferShort.java?view=diff&rev=447226&r1=447225&r2=447226
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/DataBufferShort.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/DataBufferShort.java Sun Sep 17 21:12:12 2006
@@ -25,12 +25,12 @@
 
     public DataBufferShort(short dataArrays[][], int size, int offsets[]) {
         super(TYPE_SHORT, size, dataArrays.length, offsets);
-        data = (short[][]) dataArrays.clone();
+        data = dataArrays.clone();
     }
 
     public DataBufferShort(short dataArrays[][], int size) {
         super(TYPE_SHORT, size, dataArrays.length);
-        data = (short[][]) dataArrays.clone();
+        data = dataArrays.clone();
     }
 
     public DataBufferShort(short dataArray[], int size, int offset) {
@@ -60,18 +60,21 @@
         data[0] = new short[size];
     }
 
+    @Override
     public void setElem(int bank, int i, int val) {
         data[bank][offsets[bank] + i] = (short) val;
         notifyChanged();
     }
 
+    @Override
     public void setElem(int i, int val) {
         data[0][offset + i] = (short) val;
         notifyChanged();
     }
 
+    @Override
     public int getElem(int bank, int i) {
-        return (int) (data[bank][offsets[bank] + i]);
+        return (data[bank][offsets[bank] + i]);
     }
 
     public short[] getData(int bank) {
@@ -79,13 +82,14 @@
         return data[bank];
     }
 
+    @Override
     public int getElem(int i) {
-        return (int) (data[0][offset + i]);
+        return (data[0][offset + i]);
     }
 
     public short[][] getBankData() {
         notifyTaken();
-        return (short[][]) data.clone();
+        return data.clone();
     }
 
     public short[] getData() {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/DataBufferUShort.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/DataBufferUShort.java?view=diff&rev=447226&r1=447225&r2=447226
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/DataBufferUShort.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/DataBufferUShort.java Sun Sep 17 21:12:12 2006
@@ -26,12 +26,12 @@
 
     public DataBufferUShort(short dataArrays[][], int size, int offsets[]) {
         super(TYPE_USHORT, size, dataArrays.length, offsets);
-        data = (short[][])dataArrays.clone();
+        data = dataArrays.clone();
     }
 
     public DataBufferUShort(short dataArrays[][], int size) {
         super(TYPE_USHORT, size, dataArrays.length);
-        data = (short[][])dataArrays.clone();
+        data = dataArrays.clone();
     }
 
     public DataBufferUShort(short dataArray[], int size, int offset) {
@@ -61,18 +61,21 @@
         data[0] = new short[size];
     }
 
+    @Override
     public void setElem(int bank, int i, int val) {
         data[bank][offsets[bank] + i] = (short)val;
         notifyChanged();
     }
 
+    @Override
     public void setElem(int i, int val) {
         data[0][offset + i] = (short)val;
         notifyChanged();
     }
 
+    @Override
     public int getElem(int bank, int i) {
-        return (int)(data[bank][offsets[bank] + i]) & 0xffff;
+        return (data[bank][offsets[bank] + i]) & 0xffff;
     }
 
     public short[] getData(int bank) {
@@ -80,13 +83,14 @@
         return data[bank];
     }
 
+    @Override
     public int getElem(int i) {
-        return (int)(data[0][offset + i]) & 0xffff;
+        return (data[0][offset + i]) & 0xffff;
     }
 
     public short[][] getBankData() {
         notifyTaken();
-        return (short[][])data.clone();
+        return data.clone();
     }
 
     public short[] getData() {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/DirectColorModel.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/DirectColorModel.java?view=diff&rev=447226&r1=447225&r2=447226
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/DirectColorModel.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/DirectColorModel.java Sun Sep 17 21:12:12 2006
@@ -78,6 +78,7 @@
         this(bits, rmask, gmask, bmask, 0);
     }
 
+    @Override
     public Object getDataElements(int components[], int offset, Object obj) {
         int pixel = 0;
         for (int i = 0; i < numComponents; i++) {
@@ -93,7 +94,7 @@
                 ba = (byte[]) obj;
             }
             ba[0] = (byte) pixel;
-            obj = (Object) ba;
+            obj = ba;
             break;
 
         case DataBuffer.TYPE_USHORT:
@@ -104,7 +105,7 @@
                 sa = (short[]) obj;
             }
             sa[0] = (short) pixel;
-            obj = (Object) sa;
+            obj = sa;
             break;
 
         case DataBuffer.TYPE_INT:
@@ -115,7 +116,7 @@
                 ia = (int[]) obj;
             }
             ia[0] = pixel;
-            obj = (Object) ia;
+            obj = ia;
             break;
 
         default:
@@ -126,13 +127,15 @@
         return obj;
     }
 
+    @Override
     public Object getDataElements(int rgb, Object pixel) {
         if (equals(ColorModel.getRGBdefault())) {
             int ia[];
-            if (pixel == null)
+            if (pixel == null) {
                 ia = new int[1];
-            else
+            } else {
                 ia = (int[]) pixel;
+            }
             ia[0] = rgb;
             return ia;
         }
@@ -142,8 +145,6 @@
         int green = (rgb >> 8) & 0xff;
         int blue = rgb & 0xff;
 
-        int components[] = null;
-
         float comp[] = new float[numColorComponents];
         float normComp[] = null;
 
@@ -159,13 +160,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];
@@ -173,14 +174,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 rgbComp[] = cs.fromRGB(comp);
-            if (!hasAlpha)
+            if (!hasAlpha) {
                 normComp = rgbComp;
-            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] = rgbComp[i];
@@ -216,28 +217,31 @@
         switch (transferType) {
         case DataBuffer.TYPE_BYTE:
             byte ba[];
-            if (pixel == null)
+            if (pixel == null) {
                 ba = new byte[1];
-            else
+            } else {
                 ba = (byte[]) pixel;
+            }
             ba[0] = (byte) pxl;
             return ba;
 
         case DataBuffer.TYPE_USHORT:
             short sa[];
-            if (pixel == null)
+            if (pixel == null) {
                 sa = new short[1];
-            else
+            } else {
                 sa = (short[]) pixel;
+            }
             sa[0] = (short) pxl;
             return sa;
 
         case DataBuffer.TYPE_INT:
             int ia[];
-            if (pixel == null)
+            if (pixel == null) {
                 ia = new int[1];
-            else
+            } else {
                 ia = (int[]) pixel;
+            }
             ia[0] = pxl;
             return ia;
 
@@ -247,11 +251,13 @@
         }
     }
 
+    @Override
     public final 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();
@@ -261,7 +267,7 @@
         int components[] = null;
         int transparentComponents[] = new int[numComponents];
 
-        float alphaFactor = (float) maxValues[numColorComponents];
+        float alphaFactor = maxValues[numColorComponents];
 
         if (isAlphaPremultiplied) {
             switch (transferType) {
@@ -275,7 +281,7 @@
                             raster.setPixel(x, minY, transparentComponents);
                         } else {
                             float alpha =
-                                (float) components[numColorComponents] /
+                                components[numColorComponents] /
                                     alphaFactor;
                             for (int n = 0; n < numColorComponents; n++) {
                                 components[n] =
@@ -326,6 +332,7 @@
                 isAlphaPremultiplied, transferType);
     }
 
+    @Override
     public String toString() {
         // The output format based on 1.5 release behaviour. 
         // It could be reveled such way:
@@ -341,6 +348,7 @@
         return str;
     }
 
+    @Override
     public final int[] getComponents(Object pixel, int components[],
             int offset) {
 
@@ -374,6 +382,7 @@
         return getComponents(intPixel, components, offset);
     }
 
+    @Override
     public int getRed(Object inData) {
         int pixel = 0;
         switch (transferType) {
@@ -399,6 +408,7 @@
         return getRed(pixel);
     }
 
+    @Override
     public int getRGB(Object inData) {
         int pixel = 0;
         switch (transferType) {
@@ -424,6 +434,7 @@
         return getRGB(pixel);
     }
 
+    @Override
     public int getGreen(Object inData) {
         int pixel = 0;
         switch (transferType) {
@@ -449,6 +460,7 @@
         return getGreen(pixel);
     }
 
+    @Override
     public int getBlue(Object inData) {
         int pixel = 0;
         switch (transferType) {
@@ -474,6 +486,7 @@
         return getBlue(pixel);
     }
 
+    @Override
     public int getAlpha(Object inData) {
         int pixel = 0;
         switch (transferType) {
@@ -499,12 +512,14 @@
         return getAlpha(pixel);
     }
 
+    @Override
     public final WritableRaster createCompatibleWritableRaster(int w, int h) {
-        if (w <= 0 || h <= 0)
+        if (w <= 0 || h <= 0) {
             throw new IllegalArgumentException("w or h is less than or " +
                     "equal to zero");
+        }
 
-        int bandMasks[] = (int[]) componentMasks.clone();
+        int bandMasks[] = componentMasks.clone();
 
         if (pixel_bits > 16) {
             return Raster.createPackedRaster(DataBuffer.TYPE_INT, w, h,
@@ -518,22 +533,27 @@
         }
     }
 
+    @Override
     public boolean isCompatibleRaster(Raster raster) {
         SampleModel sm = raster.getSampleModel();
-        if (!(sm instanceof SinglePixelPackedSampleModel))
+        if (!(sm instanceof SinglePixelPackedSampleModel)) {
             return false;
+        }
 
         SinglePixelPackedSampleModel sppsm = (SinglePixelPackedSampleModel) sm;
 
-        if (sppsm.getNumBands() != numComponents)
+        if (sppsm.getNumBands() != numComponents) {
             return false;
-        if (raster.getTransferType() != transferType)
+        }
+        if (raster.getTransferType() != transferType) {
             return false;
+        }
 
         int maskBands[] = sppsm.getBitMasks();
         return Arrays.equals(maskBands, componentMasks);
     }
 
+    @Override
     public int getDataElement(int components[], int offset) {
         int pixel = 0;
         for (int i = 0; i < numComponents; i++) {
@@ -542,6 +562,7 @@
         return pixel;
     }
 
+    @Override
     public final int[] getComponents(int pixel, int components[], int offset) {
         if (components == null) {
             components = new int[numComponents + offset];
@@ -552,41 +573,54 @@
         return components;
     }
 
+    @Override
     public final int getRed(int pixel) {
-        if (is_sRGB)
+        if (is_sRGB) {
             return getComponentFrom_sRGB(pixel, 0);
-        if (is_LINEAR_RGB)
+        }
+        if (is_LINEAR_RGB) {
             return getComponentFrom_LINEAR_RGB(pixel, 0);
+        }
         return getComponentFrom_RGB(pixel, 0);
     }
 
+    @Override
     public final int getRGB(int pixel) {
         return (getAlpha(pixel) << 24) | (getRed(pixel) << 16) |
                (getGreen(pixel) << 8) | getBlue(pixel);
     }
 
+    @Override
     public final int getGreen(int pixel) {
-        if (is_sRGB)
+        if (is_sRGB) {
             return getComponentFrom_sRGB(pixel, 1);
-        if (is_LINEAR_RGB)
+        }
+        if (is_LINEAR_RGB) {
             return getComponentFrom_LINEAR_RGB(pixel, 1);
+        }
         return getComponentFrom_RGB(pixel, 1);
     }
 
+    @Override
     public final int getBlue(int pixel) {
-        if (is_sRGB)
+        if (is_sRGB) {
             return getComponentFrom_sRGB(pixel, 2);
-        if (is_LINEAR_RGB)
+        }
+        if (is_LINEAR_RGB) {
             return getComponentFrom_LINEAR_RGB(pixel, 2);
+        }
         return getComponentFrom_RGB(pixel, 2);
     }
 
+    @Override
     public final int getAlpha(int pixel) {
-        if (!hasAlpha)
+        if (!hasAlpha) {
             return 255;
+        }
         int a = (pixel & componentMasks[3]) >>> offsets[3];
-        if (bits[3] == 8)
+        if (bits[3] == 8) {
             return a;
+        }
         return alphaLUT[a] & 0xff;
     }
 
@@ -603,8 +637,9 @@
     }
 
     public final int getAlphaMask() {
-        if (hasAlpha)
+        if (hasAlpha) {
             return componentMasks[3];
+        }
         return 0;
     }
 
@@ -629,7 +664,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;
         }
@@ -717,7 +752,7 @@
     private int getComponentFrom_LINEAR_RGB(int pixel, int idx) {
         int comp = (pixel & componentMasks[idx]) >> offsets[idx];
         if (isAlphaPremultiplied) {
-            float factor = (float) ((1 << LINEAR_RGB_Length) - 1);
+            float factor = ((1 << LINEAR_RGB_Length) - 1);
             int alpha = (pixel & componentMasks[3]) >> offsets[3];
             comp = alpha == 0 ? 0 : (int) (scales[idx] * comp * factor /
                     (scales[3] * alpha) + 0.5f);

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/FilteredImageSource.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/FilteredImageSource.java?view=diff&rev=447226&r1=447225&r2=447226
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/FilteredImageSource.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/FilteredImageSource.java Sun Sep 17 21:12:12 2006
@@ -27,7 +27,7 @@
     private ImageProducer source;
     private ImageFilter filter;
 
-    private Hashtable consTable = new Hashtable();
+    private Hashtable<ImageConsumer, ImageConsumer> consTable = new Hashtable<ImageConsumer, ImageConsumer>();
 
     public FilteredImageSource(ImageProducer orig, ImageFilter imgf) {
         source = orig;
@@ -41,7 +41,7 @@
 
     public void startProduction(ImageConsumer ic) {
         addConsumer(ic);
-        ImageConsumer fic = (ImageConsumer) consTable.get(ic);
+        ImageConsumer fic = consTable.get(ic);
         source.startProduction(fic);
     }
 
@@ -54,7 +54,7 @@
 
     public synchronized void removeConsumer(ImageConsumer ic) {
         if(ic != null && isConsumer(ic)){
-            ImageConsumer fic = (ImageConsumer) consTable.get(ic);
+            ImageConsumer fic = consTable.get(ic);
             source.removeConsumer(fic);
             consTable.remove(ic);
         }
@@ -67,6 +67,4 @@
             consTable.put(ic, fic);
         }
     }
-
 }
-

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/IndexColorModel.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/IndexColorModel.java?view=diff&rev=447226&r1=447225&r2=447226
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/IndexColorModel.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/IndexColorModel.java Sun Sep 17 21:12:12 2006
@@ -39,7 +39,7 @@
                                              // improving performace of selection
                                              // nearest color in Color Map
 
-    private int cachetable[] = new int[CACHESIZE * 2]; // Cache table - used for 
+    private final int cachetable[] = new int[CACHESIZE * 2]; // Cache table - used for 
                                // storing RGB values and that appropriate indices 
                                // in the Color Map 
                     
@@ -59,9 +59,10 @@
                 ColorSpace.getInstance(ColorSpace.CS_sRGB), true, false,
                 Transparency.OPAQUE, validateTransferType(transferType));
 
-        if (size < 1)
+        if (size < 1) {
             throw new IllegalArgumentException("Size of the color map is " +
                     "less than 1");
+        }
 
         mapSize = size;
         colorMap = new int[mapSize];
@@ -69,8 +70,9 @@
 
         if (validBits != null) {
             for (int i = 0; i < mapSize; i++) {
-                if (!validBits.testBit(i))
+                if (!validBits.testBit(i)) {
                     this.validBits = validBits;
+                }
                 break;
             }
         }
@@ -83,13 +85,16 @@
             colorMap[i] = cmap[start];
             alpha = cmap[start] & alphaMask;
 
-            if (alpha == alphaMask)
+            if (alpha == alphaMask) {
                 continue;
+            }
             if (alpha == 0) {
-                if (transparentIndex < 0)
+                if (transparentIndex < 0) {
                     transparentIndex = i;
-                if (transparency == Transparency.OPAQUE)
+                }
+                if (transparency == Transparency.OPAQUE) {
                     transparency = Transparency.BITMASK;
+                }
             } else if (alpha != alphaMask &&
                     transparency != Transparency.TRANSLUCENT) {
                 transparency = Transparency.TRANSLUCENT;
@@ -108,9 +113,10 @@
                 (hasalpha || (trans >= 0)), false, Transparency.OPAQUE,
                 validateTransferType(transferType));
 
-        if (size < 1)
+        if (size < 1) {
             throw new IllegalArgumentException("Size of the color map " +
                     "is less than 1");
+        }
 
         mapSize = size;
         colorMap = new int[mapSize];
@@ -134,13 +140,16 @@
                 alpha = cmap[start] & alphaMask;
                 colorMap[i] = cmap[start];
 
-                if (alpha == alphaMask)
+                if (alpha == alphaMask) {
                     continue;
+                }
                 if (alpha == 0) {
-                    if (trans < 0)
+                    if (trans < 0) {
                         trans = i;
-                    if (transparency == Transparency.OPAQUE)
+                    }
+                    if (transparency == Transparency.OPAQUE) {
                         transparency = Transparency.BITMASK;
+                    }
                 } else if (alpha != 0
                         && transparency != Transparency.TRANSLUCENT) {
                     transparency = Transparency.TRANSLUCENT;
@@ -195,9 +204,10 @@
                 (hasalpha || (trans >= 0)), false, Transparency.OPAQUE,
                 validateTransferType(ColorModel.getTransferType(bits)));
 
-        if (size < 1)
+        if (size < 1) {
             throw new IllegalArgumentException("Size of the color map " +
                     "is less than 1");
+        }
 
         mapSize = size;
         colorMap = new int[mapSize];
@@ -210,9 +220,12 @@
             colorMap[i] = (cmap[start++] & 0xff) << 16 |
                    (cmap[start++] & 0xff) << 8 | (cmap[start++] & 0xff);
             if (trans == i) {
-                if (transparency == Transparency.OPAQUE)
+                if (transparency == Transparency.OPAQUE) {
                     transparency = Transparency.BITMASK;
-                if(hasalpha) start++;
+                }
+                if(hasalpha) {
+                    start++;
+                }
                 continue;
             }
             if (hasalpha) {
@@ -220,21 +233,24 @@
                 if (alpha == 0) {
                     if (transparency == Transparency.OPAQUE) {
                         transparency = Transparency.BITMASK;
-                        if (trans < 0)
+                        if (trans < 0) {
                             trans = i;
+                        }
                     }
                 } else {
                     if (alpha != 0xff &&
-                           transparency != Transparency.TRANSLUCENT)
+                           transparency != Transparency.TRANSLUCENT) {
                         transparency = Transparency.TRANSLUCENT;
+                    }
                 }
                 alpha <<= 24;
             }
             colorMap[i] |= alpha;
         }
 
-        if (trans >= 0 && trans < mapSize)
+        if (trans >= 0 && trans < mapSize) {
             transparentIndex = trans;
+        }
         checkPalette();
 
     }
@@ -245,16 +261,19 @@
         this(bits, size, cmap, start, hasalpha, -1);
     }
 
+    @Override
     public Object getDataElements(int[] components, int offset, Object pixel) {
         int rgb = (components[offset] << 16) | (components[offset + 1]) << 8 |
                components[offset + 2];
-        if (hasAlpha)
+        if (hasAlpha) {
             rgb |= components[offset + 3] << 24;
-        else
+        } else {
             rgb |= 0xff000000;
+        }
         return getDataElements(rgb, pixel);
     }
 
+    @Override
     public synchronized Object getDataElements(int rgb, Object pixel) {
         int red = (rgb >> 16) & 0xff;
         int green = (rgb >> 8) & 0xff;
@@ -264,8 +283,9 @@
 
         for (int i = 0; i < totalInserted; i++) {
             int idx = i * 2;
-            if (rgb == cachetable[idx])
+            if (rgb == cachetable[idx]) {
                 return createDataObject(cachetable[idx + 1], pixel);
+            }
         }
 
         if (!hasAlpha && grayPalette) {
@@ -277,8 +297,9 @@
                 error = Math.abs((colorMap[i] & 0xff) - grey);
                 if (error < minError) {
                     pixIdx = i;
-                    if (error == 0)
+                    if (error == 0) {
                         break;
+                    }
                     minError = error;
                 }
             }
@@ -325,8 +346,9 @@
         cachetable[nextInsertIdx + 1] = pixIdx;
 
         nextInsertIdx = (nextInsertIdx + 2) % (CACHESIZE * 2);
-        if (totalInserted < CACHESIZE)
+        if (totalInserted < CACHESIZE) {
             totalInserted++;
+        }
 
         return createDataObject(pixIdx, pixel);
     }
@@ -334,9 +356,10 @@
     public BufferedImage convertToIntDiscrete(Raster raster,
             boolean forceARGB) {
 
-        if (!isCompatibleRaster(raster))
+        if (!isCompatibleRaster(raster)) {
             throw new IllegalArgumentException("The raster argument is " +
                     "not compatible with this IndexColorModel");
+        }
 
         ColorModel model;
         if (forceARGB || transparency == Transparency.TRANSLUCENT) {
@@ -363,23 +386,26 @@
             obj = raster.getDataElements(minX, minY, w, 1, obj);
             if (obj instanceof byte[]) {
                 byte ba[] = (byte[]) obj;
-                if (pixels == null)
+                if (pixels == null) {
                     pixels = new int[ba.length];
+                }
                 for (int j = 0; j < ba.length; j++) {
                     pixels[j] = colorMap[ba[j] & 0xff];
                 }
             } else if (obj instanceof short[]) {
                 short sa[] = (short[]) obj;
-                if (pixels == null)
+                if (pixels == null) {
                     pixels = new int[sa.length];
+                }
                 for (int j = 0; j < sa.length; j++) {
                     pixels[j] = colorMap[sa[j] & 0xffff];
                 }
             }
             if (obj instanceof int[]) {
                 int ia[] = (int[]) obj;
-                if (pixels == null)
+                if (pixels == null) {
                     pixels = new int[ia.length];
+                }
                 for (int j = 0; j < ia.length; j++) {
                     pixels[j] = colorMap[ia[j]];
                 }
@@ -395,6 +421,7 @@
         return validBits;
     }
 
+    @Override
     public String toString() {
         // The output format based on 1.5 release behaviour. 
         // It could be reveled such way:
@@ -405,12 +432,13 @@
                " numComponents = " + numComponents + " color space = " + cs +
                " transparency = ";
 
-        if (transparency == Transparency.OPAQUE)
+        if (transparency == Transparency.OPAQUE) {
             str = str + "Transparency.OPAQUE";
-        else if (transparency == Transparency.BITMASK)
+        } else if (transparency == Transparency.BITMASK) {
             str = str + "Transparency.BITMASK";
-        else
+        } else {
             str = str + "Transparency.TRANSLUCENT";
+        }
 
         str = str + " transIndex = " + transparentIndex + " has alpha = " +
                hasAlpha + " isAlphaPre = " + isAlphaPremultiplied;
@@ -418,6 +446,7 @@
         return str;
     }
 
+    @Override
     public int[] getComponents(Object pixel, int components[], int offset) {
         int pixIdx = -1;
         if (pixel instanceof byte[]) {
@@ -437,6 +466,7 @@
         return getComponents(pixIdx, components, offset);
     }
 
+    @Override
     public WritableRaster createCompatibleWritableRaster(int w, int h) {
         WritableRaster raster;
         if (pixel_bits == 1 || pixel_bits == 2 || pixel_bits == 4) {
@@ -456,48 +486,56 @@
         return raster;
     }
 
+    @Override
     public boolean isCompatibleSampleModel(SampleModel sm) {
-        if (sm == null)
+        if (sm == null) {
             return false;
+        }
 
         if (!(sm instanceof MultiPixelPackedSampleModel)
-                && !(sm instanceof ComponentSampleModel))
+                && !(sm instanceof ComponentSampleModel)) {
             return false;
+        }
 
-        if (sm.getTransferType() != transferType)
+        if (sm.getTransferType() != transferType) {
             return false;
-        if (sm.getNumBands() != 1)
+        }
+        if (sm.getNumBands() != 1) {
             return false;
+        }
 
         return true;
     }
 
+    @Override
     public SampleModel createCompatibleSampleModel(int w, int h) {
         if (pixel_bits == 1 || pixel_bits == 2 || pixel_bits == 4) {
             return new MultiPixelPackedSampleModel(DataBuffer.TYPE_BYTE, w, h,
                     pixel_bits);
-        } else {
-            int bandOffsets[] = new int[1];
-            bandOffsets[0] = 0;
-            return new ComponentSampleModel(transferType, w, h, 1, w,
-                    bandOffsets);
         }
+        int bandOffsets[] = new int[1];
+        bandOffsets[0] = 0;
+        return new ComponentSampleModel(transferType, w, h, 1, w,
+                bandOffsets);
 
     }
 
+    @Override
     public boolean isCompatibleRaster(Raster raster) {
         int sampleSize = raster.getSampleModel().getSampleSize(0);
         return (raster.getTransferType() == transferType &&
                raster.getNumBands() == 1 && (1 << sampleSize) >= mapSize);
     }
 
+    @Override
     public int getDataElement(int components[], int offset) {
         int rgb = (components[0] << 16) | (components[1] << 8) | components[2];
 
-        if (hasAlpha)
+        if (hasAlpha) {
             rgb |= (components[3] << 24);
-        else
+        } else {
             rgb |= 0xff000000;
+        }
 
         int pixel;
 
@@ -546,6 +584,7 @@
         }
     }
 
+    @Override
     public int[] getComponents(int pixel, int components[], int offset) {
         if (components == null) {
             components = new int[offset + numComponents];
@@ -562,40 +601,47 @@
     }
 
     public boolean isValid(int pixel) {
-        if (validBits == null)
+        if (validBits == null) {
             return (pixel >= 0 && pixel < mapSize);
-        else
-            return (pixel < mapSize && validBits.testBit(pixel));
+        }
+        return (pixel < mapSize && validBits.testBit(pixel));
     }
 
+    @Override
     public final int getRed(int pixel) {
         return (colorMap[pixel] >> 16) & 0xff;
     }
 
+    @Override
     public final int getRGB(int pixel) {
         return colorMap[pixel];
     }
 
+    @Override
     public final int getGreen(int pixel) {
         return (colorMap[pixel] >> 8) & 0xff;
     }
 
+    @Override
     public final int getBlue(int pixel) {
         return colorMap[pixel] & 0xff;
     }
 
+    @Override
     public final int getAlpha(int pixel) {
         return (colorMap[pixel] >> 24) & 0xff;
     }
 
+    @Override
     public int[] getComponentSize() {
-        return (int[]) bits.clone();
+        return bits.clone();
     }
 
     public boolean isValid() {
         return (validBits == null);
     }
 
+    @Override
     public void finalize() {
         // TODO: implement
         return;
@@ -605,6 +651,7 @@
         return transparentIndex;
     }
 
+    @Override
     public int getTransparency() {
         return transparency;
     }
@@ -615,9 +662,10 @@
 
     private void createColorMap(int size, byte r[], byte g[], byte b[],
             byte a[], int trans) {
-        if (size < 1)
+        if (size < 1) {
             throw new IllegalArgumentException("Size of the color map is " +
                     "less than 1");
+        }
 
         mapSize = size;
         colorMap = new int[mapSize];
@@ -634,8 +682,9 @@
             colorMap[i] = ((r[i] & 0xff) << 16) | ((g[i] & 0xff) << 8) |
                    (b[i] & 0xff);
 
-            if (trans == i)
+            if (trans == i) {
                 continue;
+            }
 
             if (a == null) {
                 colorMap[i] |= 0xff000000;
@@ -644,14 +693,17 @@
                 if (alpha == 0xff) {
                     colorMap[i] |= 0xff000000;
                 } else if (alpha == 0) {
-                    if (transparency == Transparency.OPAQUE)
+                    if (transparency == Transparency.OPAQUE) {
                         transparency = Transparency.BITMASK;
-                    if (transparentIndex < 0)
+                    }
+                    if (transparentIndex < 0) {
                         transparentIndex = i;
+                    }
                 } else {
                     colorMap[i] |= (a[i] & 0xff) << 24;
-                    if (transparency != Transparency.TRANSLUCENT)
+                    if (transparency != Transparency.TRANSLUCENT) {
                         transparency = Transparency.TRANSLUCENT;
+                    }
                 }
             }
 
@@ -664,15 +716,17 @@
      */
     private void checkPalette() {
         grayPalette = false;
-        if (transparency > Transparency.OPAQUE)
+        if (transparency > Transparency.OPAQUE) {
             return;
+        }
         int rgb = 0;
 
         for (int i = 0; i < mapSize; i++) {
             rgb = colorMap[i];
             if (((rgb >> 16) & 0xff) != ((rgb >> 8) & 0xff) ||
-                   ((rgb >> 8) & 0xff) != (rgb & 0xff))
+                   ((rgb >> 8) & 0xff) != (rgb & 0xff)) {
                 return;
+            }
         }
         grayPalette = true;
     }
@@ -689,12 +743,12 @@
             case DataBuffer.TYPE_BYTE:
                 byte[] ba = new byte[1];
                 ba[0] = (byte) colorMapIdx;
-                pixel = (Object) ba;
+                pixel = ba;
                 break;
             case DataBuffer.TYPE_USHORT:
                 short[] sa = new short[1];
                 sa[0] = (short) colorMapIdx;
-                pixel = (Object) sa;
+                pixel = sa;
                 break;
             default:
                 throw new UnsupportedOperationException("The transferType " +
@@ -704,16 +758,16 @@
                 && transferType == DataBuffer.TYPE_BYTE) {
             byte ba[] = (byte[]) pixel;
             ba[0] = (byte) colorMapIdx;
-            pixel = (Object) ba;
+            pixel = ba;
         } else if (pixel instanceof short[]&&
                 transferType == DataBuffer.TYPE_USHORT) {
             short[] sa = (short[]) pixel;
             sa[0] = (short) colorMapIdx;
-            pixel = (Object) sa;
+            pixel = sa;
         } else if (pixel instanceof int[]) {
             int ia[] = (int[]) pixel;
             ia[0] = colorMapIdx;
-            pixel = (Object) ia;
+            pixel = ia;
         } else {
             throw new ClassCastException("The pixel is not a primitive " +
                     "array of type transferType");
@@ -724,14 +778,16 @@
     private static int[] createBits(boolean hasAlpha) {
 
         int numChannels;
-        if (hasAlpha)
+        if (hasAlpha) {
             numChannels = 4;
-        else
+        } else {
             numChannels = 3;
+        }
 
         int bits[] = new int[numChannels];
-        for (int i = 0; i < numChannels; i++)
+        for (int i = 0; i < numChannels; i++) {
             bits[i] = 8;
+        }
 
         return bits;
 
@@ -739,9 +795,10 @@
 
     private static int validateTransferType(int transferType) {
         if (transferType != DataBuffer.TYPE_BYTE &&
-               transferType != DataBuffer.TYPE_USHORT)
+               transferType != DataBuffer.TYPE_USHORT) {
             throw new IllegalArgumentException("The transferType is not " +
                     "one of DataBuffer.TYPE_BYTE or DataBuffer.TYPE_USHORT");
+        }
         return transferType;
     }
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/Kernel.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/Kernel.java?view=diff&rev=447226&r1=447225&r2=447226
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/Kernel.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/Kernel.java Sun Sep 17 21:12:12 2006
@@ -31,10 +31,10 @@
 
     public Kernel(int width, int height, float[] data) {
         int dataLength = width*height;
-        if (data.length < dataLength)
+        if (data.length < dataLength) {
             throw new IllegalArgumentException(
-                    "Length of data should not be less than width*height"
-            );
+                    "Length of data should not be less than width*height");
+        }
 
         this.width = width;
         this.height = height;
@@ -71,8 +71,8 @@
         return yOrigin;
     }
 
+    @Override
     public Object clone() {
         return new Kernel(width, height, data);
     }
 }
-

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/MemoryImageSource.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/MemoryImageSource.java?view=diff&rev=447226&r1=447225&r2=447226
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/MemoryImageSource.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/MemoryImageSource.java Sun Sep 17 21:12:12 2006
@@ -32,7 +32,7 @@
     int offset;
     int scanline;
     Hashtable<?, ?> properties;
-    Vector consumers;
+    Vector<ImageConsumer> consumers;
     boolean animated;
     boolean fullbuffers;
     int dataType;
@@ -74,7 +74,9 @@
     }
 
     public void startProduction(ImageConsumer ic) {
-        if(!isConsumer(ic) && ic != null) consumers.addElement(ic);
+        if(!isConsumer(ic) && ic != null) {
+            consumers.addElement(ic);
+        }
         try{
             setHeader(ic);
             setPixels(ic, 0, 0, width, height);
@@ -82,11 +84,17 @@
                 ic.imageComplete(ImageConsumer.SINGLEFRAMEDONE);
             }else{
                 ic.imageComplete(ImageConsumer.STATICIMAGEDONE);
-                if(isConsumer(ic)) removeConsumer(ic);
+                if(isConsumer(ic)) {
+                    removeConsumer(ic);
+                }
             }
         }catch(Exception e){
-            if(isConsumer(ic)) ic.imageComplete(ImageConsumer.IMAGEERROR);
-            if(isConsumer(ic)) removeConsumer(ic);
+            if(isConsumer(ic)) {
+                ic.imageComplete(ImageConsumer.IMAGEERROR);
+            }
+            if(isConsumer(ic)) {
+                removeConsumer(ic);
+            }
         }
     }
 
@@ -98,7 +106,9 @@
     }
 
     public synchronized void addConsumer(ImageConsumer ic) {
-        if(ic == null || consumers.contains(ic)) return;
+        if(ic == null || consumers.contains(ic)) {
+            return;
+        }
         consumers.addElement(ic);
     }
 
@@ -123,12 +133,14 @@
     }
 
     public synchronized void setFullBufferUpdates(boolean fullbuffers) {
-        if(this.fullbuffers == fullbuffers) return;
+        if(this.fullbuffers == fullbuffers) {
+            return;
+        }
         this.fullbuffers = fullbuffers;
         if(animated){
             Object consAr[] = consumers.toArray();
-            for(int i = 0; i < consAr.length; i++){
-                ImageConsumer con = (ImageConsumer)consAr[i];
+            for (Object element : consAr) {
+                ImageConsumer con = (ImageConsumer)element;
                 try{
                     if(fullbuffers){
                         con.setHints(ImageConsumer.TOPDOWNLEFTRIGHT |
@@ -137,25 +149,30 @@
                         con.setHints(ImageConsumer.RANDOMPIXELORDER);
                     }
                 }catch(Exception e){
-                    if(isConsumer(con))
+                    if(isConsumer(con)) {
                         con.imageComplete(ImageConsumer.IMAGEERROR);
-                    if(isConsumer(con))
+                    }
+                    if(isConsumer(con)) {
                         removeConsumer(con);
+                    }
                 }
             }
         }
     }
 
     public synchronized void setAnimated(boolean animated) {
-        if(this.animated == animated) return;
+        if(this.animated == animated) {
+            return;
+        }
         Object consAr[] = consumers.toArray();
-        for(int i = 0; i < consAr.length; i++){
-            ImageConsumer con = (ImageConsumer)consAr[i];
+        for (Object element : consAr) {
+            ImageConsumer con = (ImageConsumer)element;
             try{
                 con.imageComplete(ImageConsumer.STATICIMAGEDONE);
             }catch(Exception e){
-                if(isConsumer(con))
+                if(isConsumer(con)) {
                     con.imageComplete(ImageConsumer.IMAGEERROR);
+                }
             }
             if(isConsumer(con)){
                 removeConsumer(con);
@@ -177,25 +194,34 @@
                     w += x;
                     x = 0;
                 }
-                if(w > width) w = width - x;
+                if(w > width) {
+                    w = width - x;
+                }
                 if(y < 0){
                     h += y;
                     y = 0;
                 }
             }
-            if(h > height) h = height - y;
+            if(h > height) {
+                h = height - y;
+            }
             Object consAr[] = consumers.toArray();
-            for(int i = 0; i < consAr.length; i++){
-                ImageConsumer con = (ImageConsumer)consAr[i];
+            for (Object element : consAr) {
+                ImageConsumer con = (ImageConsumer)element;
                 try{
-                    if(w > 0 && h > 0) setPixels(con, x, y, w, h);
-                    if(framenotify)
+                    if(w > 0 && h > 0) {
+                        setPixels(con, x, y, w, h);
+                    }
+                    if(framenotify) {
                         con.imageComplete(ImageConsumer.SINGLEFRAMEDONE);
+                    }
                 }catch(Exception ex){
-                    if(isConsumer(con))
+                    if(isConsumer(con)) {
                         con.imageComplete(ImageConsumer.IMAGEERROR);
-                    if(isConsumer(con))
+                    }
+                    if(isConsumer(con)) {
                         removeConsumer(con);
+                    }
                 }
             }
         }
@@ -210,7 +236,7 @@
     }
 
     private void init(int width, int height, ColorModel model, byte pixels[],
-            int off, int scan, Hashtable prop){
+            int off, int scan, Hashtable<?, ?> prop){
 
         this.width = width;
         this.height = height;
@@ -220,12 +246,12 @@
         this.scanline = scan;
         this.properties = prop;
         this.dataType = DATA_TYPE_BYTE;
-        this.consumers = new Vector();
+        this.consumers = new Vector<ImageConsumer>();
 
     }
 
     private void init(int width, int height, ColorModel model, int pixels[],
-            int off, int scan, Hashtable prop){
+            int off, int scan, Hashtable<?, ?> prop){
 
         this.width = width;
         this.height = height;
@@ -235,7 +261,7 @@
         this.scanline = scan;
         this.properties = prop;
         this.dataType = DATA_TYPE_INT;
-        this.consumers = new Vector();
+        this.consumers = new Vector<ImageConsumer>();
     }
 
     private void setPixels(ImageConsumer con, int x, int y, int w, int h){

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/MultiPixelPackedSampleModel.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/MultiPixelPackedSampleModel.java?view=diff&rev=447226&r1=447225&r2=447226
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/MultiPixelPackedSampleModel.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/MultiPixelPackedSampleModel.java Sun Sep 17 21:12:12 2006
@@ -39,22 +39,26 @@
         super(dataType, w, h, 1);
         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;
-        if(numberOfBits == 0)
+        if(numberOfBits == 0) {
             throw new RasterFormatException("Number of Bits equals to zero");
+        }
         this.pixelBitStride = numberOfBits;
         this.dataElementSize = DataBuffer.getDataTypeSize(dataType);
-        if(dataElementSize % pixelBitStride != 0)
+        if(dataElementSize % pixelBitStride != 0) {
             throw new RasterFormatException("The number of bits per pixel " +
                     "is not a power of 2 or pixels span data element boundaries");
+        }
 
-        if(dataBitOffset % numberOfBits != 0)
+        if(dataBitOffset % numberOfBits != 0) {
             throw new RasterFormatException("Data Bit offset is not a multiple " +
                     "of pixel bit stride");
+        }
         this.dataBitOffset = dataBitOffset;
 
         this.pixelsPerDataElement = dataElementSize / pixelBitStride;
@@ -69,47 +73,54 @@
                DataBuffer.getDataTypeSize(dataType), 0);
     }
 
+    @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) getSample(x, y, 0, data);
-            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) getSample(x, y, 0, data);
-            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] = getSample(x, y, 0, data);
-            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:
             setSample(x, y, 0, ((byte[]) obj)[0] & 0xff, data);
@@ -123,6 +134,7 @@
         }
     }
 
+    @Override
     public boolean equals(Object o) {
         if ((o == null) || !(o instanceof MultiPixelPackedSampleModel)) {
             return false;
@@ -141,41 +153,51 @@
                this.scanlineStride == model.scanlineStride;
     }
 
+    @Override
     public SampleModel createSubsetSampleModel(int bands[]) {
-        if (bands != null && bands.length != 1)
+        if (bands != null && bands.length != 1) {
             throw new RasterFormatException("Number of bands must be only 1");
+        }
         return createCompatibleSampleModel(width, height);
     }
 
+    @Override
     public SampleModel createCompatibleSampleModel(int w, int h) {
         return new MultiPixelPackedSampleModel(dataType, w, h, pixelBitStride);
     }
 
+    @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[numBands];
-        else
+        } else {
             pixel = iArray;
+        }
 
         pixel[0] = getSample(x, y, 0, 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");
+        }
         setSample(x, y, 0, iArray[0], data);
     }
 
+    @Override
     public int getSample(int x, int y, int b, DataBuffer data) {
-        if (x < 0 || y < 0 || x >= this.width || y >= this.height || b != 0)
+        if (x < 0 || y < 0 || x >= this.width || y >= this.height || b != 0) {
             throw new ArrayIndexOutOfBoundsException("Coordinates are not " +
                     "in bounds");
+        }
 
         int bitnum = dataBitOffset + x * pixelBitStride;
         int elem = data.getElem(y * scanlineStride + bitnum / dataElementSize);
@@ -185,10 +207,12 @@
         return (elem >> shift) & bitMask;
     }
 
+    @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 || b != 0)
+        if (x < 0 || y < 0 || x >= this.width || y >= this.height || b != 0) {
             throw new ArrayIndexOutOfBoundsException("Coordinates are not " +
                     "in bounds");
+        }
 
         int bitnum = dataBitOffset + x * pixelBitStride;
         int idx = y * scanlineStride + bitnum / dataElementSize;
@@ -201,6 +225,7 @@
         data.setElem(idx, elem);
     }
 
+    @Override
     public DataBuffer createDataBuffer() {
         DataBuffer dataBuffer = null;
         int size = scanlineStride * height;
@@ -224,6 +249,7 @@
                dataElementSize;
     }
 
+    @Override
     public int getSampleSize(int band) {
         return pixelBitStride;
     }
@@ -232,11 +258,13 @@
         return (x * pixelBitStride + dataBitOffset) % dataElementSize;
     }
 
+    @Override
     public int[] getSampleSize() {
         int sampleSizes[] = { pixelBitStride };
         return sampleSizes;
     }
 
+    @Override
     public int hashCode() {
         int hash = 0;
         int tmp = 0;
@@ -281,13 +309,15 @@
         return hash;
     }
 
+    @Override
     public int getTransferType() {
-        if (pixelBitStride > 16)
+        if (pixelBitStride > 16) {
             return DataBuffer.TYPE_INT;
-        else if (pixelBitStride > 8)
+        } else if (pixelBitStride > 8) {
             return DataBuffer.TYPE_USHORT;
-        else
+        } else {
             return DataBuffer.TYPE_BYTE;
+        }
     }
 
     public int getScanlineStride() {
@@ -298,6 +328,7 @@
         return pixelBitStride;
     }
 
+    @Override
     public int getNumDataElements() {
         return 1;
     }



Mime
View raw message