harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r447707 [1/2] - in /incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl: color/ font/
Date Tue, 19 Sep 2006 03:32:58 GMT
Author: ndbeyer
Date: Mon Sep 18 20:32:57 2006
New Revision: 447707

URL: http://svn.apache.org/viewvc?view=rev&rev=447707
Log:
Code cleanup; remove warnings, add braces, remove unnecessary code

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/color/ColorConverter.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/color/ColorScaler.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/color/ICC_Transform.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/color/NativeCMM.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/color/NativeImageFormat.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/CaretManager.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/CommonGlyphVector.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/CompositeFont.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontFinder.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontManager.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontMetricsImpl.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontPeerImpl.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/Glyph.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/LineMetricsImpl.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/TextDecorator.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/TextMetricsCalculator.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/TextRunBreaker.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/TextRunSegment.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/TextRunSegmentImpl.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/color/ColorConverter.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/color/ColorConverter.java?view=diff&rev=447707&r1=447706&r2=447707
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/color/ColorConverter.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/color/ColorConverter.java Mon Sep 18 20:32:57 2006
@@ -149,7 +149,7 @@
         int nDstChannels = t.getNumOutputChannels();
         int bufferSize = buffer[0].length;
         if (bufferSize < nDstChannels + 1) { // Re-allocate buffer if needed
-            for (int i=0, dstDataPos = 0; i<nPixels; i++) {
+            for (int i=0; i<nPixels; i++) {
                 // One extra element reserved for alpha
                 buffer[i] = new float[nDstChannels + 1];
             }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/color/ColorScaler.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/color/ColorScaler.java?view=diff&rev=447707&r1=447706&r2=447707
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/color/ColorScaler.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/color/ColorScaler.java Mon Sep 18 20:32:57 2006
@@ -194,8 +194,7 @@
                 for (int col=r.getMinY(); col<height; col++) {
                     for (int chan = 0; chan < nColorChannels; chan++) {
                         sample = r.getSample(row, col, chan);
-                        result[pos][chan] =
-                            (float) (sample * normMultipliers[chan]);
+                        result[pos][chan] = (sample * normMultipliers[chan]);
                     }
                     pos++;
                 }
@@ -348,7 +347,7 @@
      */
     public void unscale(float[] pixelData, short[] chanData, int chanDataOffset) {
         for (int chan = 0; chan < nColorChannels; chan++) {
-            pixelData[chan] = ((float) (chanData[chanDataOffset + chan] & 0xFFFF))
+            pixelData[chan] = (chanData[chanDataOffset + chan] & 0xFFFF)
                 * invChannelMulipliers[chan] + channelMinValues[chan];
         }
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/color/ICC_Transform.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/color/ICC_Transform.java?view=diff&rev=447707&r1=447706&r2=447707
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/color/ICC_Transform.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/color/ICC_Transform.java Mon Sep 18 20:32:57 2006
@@ -24,15 +24,15 @@
 import org.apache.harmony.awt.gl.color.NativeCMM;
 
 /**
- * This class incapsulates native ICC transform object, is responsible for its
+ * This class encapsulates native ICC transform object, is responsible for its
  * creation, destruction and passing its handle to the native CMM.
  */
 public class ICC_Transform {
-    private long transformHandle = 0;
-    private int numInputChannels = 0;
-    private int numOutputChannels = 0;
-    private ICC_Profile src = null;
-    private ICC_Profile dst = null;
+    private long transformHandle;
+    private int numInputChannels;
+    private int numOutputChannels;
+    private ICC_Profile src;
+    private ICC_Profile dst;
 
 
     /**
@@ -72,8 +72,9 @@
         int numProfiles = profiles.length;
 
         long[] profileHandles = new long[numProfiles];
-        for (int i=0; i<numProfiles; i++)
+        for (int i=0; i<numProfiles; i++) {
             profileHandles[i] = NativeCMM.getHandle(profiles[i]);
+        }
 
         transformHandle = NativeCMM.cmmCreateMultiprofileTransform(
                 profileHandles,
@@ -97,8 +98,9 @@
         int currRenderingIntent = ICC_Profile.icPerceptual;
 
         // render as colorimetric for output device
-        if (profiles[0].getProfileClass() == ICC_Profile.CLASS_OUTPUT)
+        if (profiles[0].getProfileClass() == ICC_Profile.CLASS_OUTPUT) {
             currRenderingIntent = ICC_Profile.icRelativeColorimetric;
+        }
 
         // get the transforms from each profile
         for (int i = 0; i < numProfiles; i++) {
@@ -121,8 +123,9 @@
 
         // Get the profile handles and go ahead
         long[] profileHandles = new long[numProfiles];
-        for (int i=0; i<numProfiles; i++)
+        for (int i=0; i<numProfiles; i++) {
             profileHandles[i] = NativeCMM.getHandle(profiles[i]);
+        }
 
         transformHandle = NativeCMM.cmmCreateMultiprofileTransform(
                 profileHandles,
@@ -134,9 +137,11 @@
         numOutputChannels = dst.getNumComponents();
     }
 
+    @Override
     protected void finalize() {
-        if (transformHandle != 0)
+        if (transformHandle != 0) {
             NativeCMM.cmmDeleteTransform(transformHandle);
+        }
     }
 
     /**

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/color/NativeCMM.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/color/NativeCMM.java?view=diff&rev=447707&r1=447706&r2=447707
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/color/NativeCMM.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/color/NativeCMM.java Mon Sep 18 20:32:57 2006
@@ -20,6 +20,8 @@
 package org.apache.harmony.awt.gl.color;
 
 import java.awt.color.ICC_Profile;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.HashMap;
 
 /**
@@ -31,9 +33,9 @@
      * Storage for profile handles, since they are private
      * in ICC_Profile, but we need access to them.
      */
-    private static HashMap profileHandles = new HashMap();
+    private static HashMap<ICC_Profile, Long> profileHandles = new HashMap<ICC_Profile, Long>();
 
-    private static boolean isCMMLoaded = false;
+    private static boolean isCMMLoaded;
 
     public static void addHandle(ICC_Profile key, long handle) {
         profileHandles.put(key, new Long(handle));
@@ -44,7 +46,7 @@
     }
 
     public static long getHandle(ICC_Profile key) {
-        return ((Long) profileHandles.get(key)).longValue();
+        return profileHandles.get(key).longValue();
     }
 
     /* ICC profile management */
@@ -71,9 +73,9 @@
 
     static void loadCMM() {
         if (!isCMMLoaded) {
-            java.security.AccessController.doPrivileged(
-                  new java.security.PrivilegedAction() {
-                    public Object run() {
+            AccessController.doPrivileged(
+                  new PrivilegedAction<Void>() {
+                    public Void run() {
                         System.loadLibrary("lcmm");
                         return null;
                     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/color/NativeImageFormat.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/color/NativeImageFormat.java?view=diff&rev=447707&r1=447706&r2=447707
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/color/NativeImageFormat.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/color/NativeImageFormat.java Mon Sep 18 20:32:57 2006
@@ -33,7 +33,7 @@
 
 /**
  * This class converts java color/sample models to the LCMS pixel formats.
- * It also incapsulates all the information about the image format, which native CMM
+ * It also encapsulates all the information about the image format, which native CMM
  * needs to have in order to read/write data.
  *
  * At present planar formats (multiple bands) are not supported
@@ -195,22 +195,12 @@
      * @param nRows - number of scanlines in the image
      * @param nCols - number of pixels in one row of the image
      */
-    public NativeImageFormat(
-            Object imgData,
-            int nChannels,
-            int nRows,
-            int nCols
-    ) {
-
-        int dataSize = 0;
-
+    public NativeImageFormat(Object imgData, int nChannels, int nRows, int nCols) {
         if (imgData instanceof short[]) {
             cmmFormat |= bytesSh(2);
-            dataSize = 2;
         }
         else if (imgData instanceof byte[]) {
             cmmFormat |= bytesSh(1);
-            dataSize = 1;
         }
         else
             throw new IllegalArgumentException(
@@ -232,9 +222,7 @@
      * @param bi - image
      * @return image format object
      */
-    public static NativeImageFormat createNativeImageFormat(
-            BufferedImage bi
-    ) {
+    public static NativeImageFormat createNativeImageFormat(BufferedImage bi) {
         NativeImageFormat fmt = new NativeImageFormat();
 
         switch (bi.getType()) {
@@ -362,10 +350,7 @@
      * @param hasAlpha - true if there's an alpha channel
      * @return LCMS format
      */
-    private static int getFormatFromComponentModel(
-            ComponentSampleModel sm,
-            boolean hasAlpha) {
-
+    private static int getFormatFromComponentModel(ComponentSampleModel sm, boolean hasAlpha) {
         // Multiple data arrays (banks) not supported
         int bankIndex = sm.getBankIndices()[0];
         for (int i=1; i < sm.getNumBands(); i++) {
@@ -463,10 +448,8 @@
      * @param hasAlpha - true if there's an alpha channel
      * @return LCMS format
      */
-    private static int getFormatFromSPPSampleModel(
-            SinglePixelPackedSampleModel sm,
-            boolean hasAlpha
-        ) {
+    private static int getFormatFromSPPSampleModel(SinglePixelPackedSampleModel sm,
+            boolean hasAlpha) {
         // Can we extract bytes?
         int mask = sm.getBitMasks()[0] >>> sm.getBitOffsets()[0];
         if (!(mask == 0xFF || mask == 0xFFFF || mask == 0xFFFFFFFF))
@@ -508,7 +491,7 @@
         extra +=  pixelSize/bytes - sm.getNumBands(); // Unused bytes?
 
         // Form an ArrayList containing offset for each band
-        ArrayList offsetsLst = new ArrayList();
+        ArrayList<Integer> offsetsLst = new ArrayList<Integer>();
         for (int k=0; k < sm.getNumBands(); k++) {
             offsetsLst.add(new Integer(sm.getBitOffsets()[k]/(bytes*8)));
         }
@@ -521,7 +504,7 @@
 
         int offsets[] = new int[pixelSize/bytes];
         for (int i=0; i<offsetsLst.size(); i++) {
-            offsets[i] = ((Integer)offsetsLst.get(i)).intValue();
+            offsets[i] = offsetsLst.get(i).intValue();
         }
 
         int doSwap = 0;
@@ -616,8 +599,8 @@
         if (csm.getScanlineStride() != csm.getPixelStride()*csm.getWidth()) {
             int dataTypeSize = DataBuffer.getDataTypeSize(r.getDataBuffer().getDataType()) / 8;
             return csm.getScanlineStride()*dataTypeSize;
-        } else
-            return -1;
+        }
+        return -1;
     }
 
     /**
@@ -630,8 +613,8 @@
         if (sppsm.getScanlineStride() != sppsm.getWidth()) {
             int dataTypeSize = DataBuffer.getDataTypeSize(r.getDataBuffer().getDataType()) / 8;
             return sppsm.getScanlineStride()*dataTypeSize;
-        } else
-            return -1;
+        }
+        return -1;
     }
 
     /**

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/CaretManager.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/CaretManager.java?view=diff&rev=447707&r1=447706&r2=447707
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/CaretManager.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/CaretManager.java Mon Sep 18 20:32:57 2006
@@ -48,8 +48,9 @@
     private void checkHit(TextHitInfo info) {
         int idx = info.getInsertionIndex();
 
-        if (idx < 0 || idx > breaker.getCharCount())
+        if (idx < 0 || idx > breaker.getCharCount()) {
             throw new IllegalArgumentException("TextHitInfo out of range");
+        }
     }
 
     /**
@@ -115,14 +116,14 @@
         if (visual < breaker.getCharCount()) {
             int logIdx = breaker.getLogicalFromVisual(visual);
             int segmentIdx = breaker.logical2segment[logIdx];
-            seg = (TextRunSegment) breaker.runSegments.get(segmentIdx);
+            seg = breaker.runSegments.get(segmentIdx);
             advance = seg.x + seg.getAdvanceDelta(seg.getStart(), logIdx);
             angle = seg.metrics.italicAngle;
 
         } else { // Last character
             int logIdx = breaker.getLogicalFromVisual(visual-1);
             int segmentIdx = breaker.logical2segment[logIdx];
-            seg = (TextRunSegment) breaker.runSegments.get(segmentIdx);
+            seg = breaker.runSegments.get(segmentIdx);
             advance = seg.x + seg.getAdvanceDelta(seg.getStart(), logIdx+1);
         }
 
@@ -143,8 +144,9 @@
         checkHit(hitInfo);
         int visual = getVisualFromHitInfo(hitInfo);
 
-        if (visual == breaker.getCharCount())
+        if (visual == breaker.getCharCount()) {
             return null;
+        }
 
         TextHitInfo newInfo;
 
@@ -165,10 +167,8 @@
                 }
             }
 
-            TextRunSegment seg =
-                    (TextRunSegment) breaker.runSegments.get(
-                            breaker.logical2segment[newInfo.getCharIndex()]
-                    );
+            TextRunSegment seg = breaker.runSegments.get(breaker.logical2segment[newInfo
+                    .getCharIndex()]);
             if (!seg.charHasZeroAdvance(newInfo.getCharIndex())) {
                 return newInfo;
             }
@@ -186,8 +186,9 @@
         checkHit(hitInfo);
         int visual = getVisualFromHitInfo(hitInfo);
 
-        if (visual == 0)
+        if (visual == 0) {
             return null;
+        }
 
         TextHitInfo newInfo;
 
@@ -209,10 +210,8 @@
                 }
             }
 
-            TextRunSegment seg =
-                    (TextRunSegment) breaker.runSegments.get(
-                            breaker.logical2segment[newInfo.getCharIndex()]
-                    );
+            TextRunSegment seg = breaker.runSegments.get(breaker.logical2segment[newInfo
+                    .getCharIndex()]);
             if (!seg.charHasZeroAdvance(newInfo.getCharIndex())) {
                 return newInfo;
             }
@@ -252,10 +251,11 @@
                     }
                 } else {
                     resIdx = breaker.getLogicalFromVisual(visual);
-                    if ((breaker.getLevel(resIdx) & 0x1) == 0x0)
+                    if ((breaker.getLevel(resIdx) & 0x1) == 0x0) {
                         resIsLeading = true;
-                    else
+                    } else {
                         resIsLeading = false;
+                    }
                 }
             } else {
                 visual--;
@@ -269,10 +269,11 @@
                     }
                 } else {
                     resIdx = breaker.getLogicalFromVisual(visual);
-                    if ((breaker.getLevel(resIdx) & 0x1) == 0x0)
+                    if ((breaker.getLevel(resIdx) & 0x1) == 0x0) {
                         resIsLeading = false;
-                    else
+                    } else {
                         resIsLeading = true;
+                    }
                 }
             }
         } else if (idx < 0) { // before "start"
@@ -321,10 +322,7 @@
         int charIdx = hitInfo.getCharIndex();
 
         if (charIdx >= 0 && charIdx < breaker.getCharCount()) {
-            TextRunSegment segment =
-                    (TextRunSegment) breaker.runSegments.get(
-                            breaker.logical2segment[charIdx]
-                    );
+            TextRunSegment segment = breaker.runSegments.get(breaker.logical2segment[charIdx]);
             y1 = segment.metrics.descent;
             y2 = - segment.metrics.ascent - segment.metrics.leading;
 
@@ -358,10 +356,12 @@
             y1 = (float) bounds.getMaxY();
             y2 = (float) bounds.getMinY();
 
-            if (x2 > bounds.getMaxX())
+            if (x2 > bounds.getMaxX()) {
                 x1 = x2 = (float) bounds.getMaxX();
-            if (x1 < bounds.getMinX())
+            }
+            if (x1 < bounds.getMinX()) {
                 x1 = x2 = (float) bounds.getMinX();
+            }
         }
 
         return new Line2D.Float(x1, y1, x2, y2);
@@ -388,14 +388,13 @@
 
         if (getVisualFromHitInfo(hit1) == getVisualFromHitInfo(hit2)) {
             return new Shape[] {caret1, null};
-        } else {
-            Shape caret2 = getCaretShape(hit2, layout);
-
-            TextHitInfo strongHit = policy.getStrongCaret(hit1, hit2, layout);
-            return strongHit.equals(hit1) ?
-                    new Shape[] {caret1, caret2} :
-                    new Shape[] {caret2, caret1};
         }
+        Shape caret2 = getCaretShape(hit2, layout);
+
+        TextHitInfo strongHit = policy.getStrongCaret(hit1, hit2, layout);
+        return strongHit.equals(hit1) ?
+                new Shape[] {caret1, caret2} :
+                new Shape[] {caret2, caret1};
     }
 
     /**

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/CommonGlyphVector.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/CommonGlyphVector.java?view=diff&rev=447707&r1=447706&r2=447707
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/CommonGlyphVector.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/CommonGlyphVector.java Mon Sep 18 20:32:57 2006
@@ -93,6 +93,7 @@
      * @param fnt Font object
      * @param flags layout flags
      */
+    @SuppressWarnings("deprecation")
     public CommonGlyphVector(char[] chars, FontRenderContext frc, Font fnt,
             int flags) {
         int len = chars.length;
@@ -210,6 +211,7 @@
      * @param y specified y coordinate value
      * @return a Rectangle that bounds pixels of this GlyphVector
      */
+    @Override
     public Rectangle getPixelBounds(FontRenderContext frc, float x, float y) {
 
         double xM, yM, xm, ym;
@@ -256,6 +258,7 @@
      * this GlyphVector.
      * @return a Rectangle2D that id the visual bounds of this GlyphVector
      */
+    @Override
     public Rectangle2D getVisualBounds() {
         float xM, yM, xm, ym;
         float minX = 0;
@@ -306,6 +309,7 @@
     /**
      * Sets new position to the specified glyph.
      */
+    @Override
     public void setGlyphPosition(int glyphIndex, Point2D newPos) {
         if ((glyphIndex > vector.length) || (glyphIndex < 0)) {
             throw new IndexOutOfBoundsException(
@@ -328,6 +332,7 @@
      * this GlyphVector
      * @return a Point2D that the origin of the glyph with specified index
      */
+    @Override
     public Point2D getGlyphPosition(int glyphIndex) {
         if ((glyphIndex > vector.length) || (glyphIndex < 0)) {
             throw new IndexOutOfBoundsException(
@@ -357,6 +362,7 @@
      * @param glyphIndex specified index of the glyph
      * @param trans AffineTransform of the glyph with specified index
      */
+    @Override
     public void setGlyphTransform(int glyphIndex, AffineTransform trans) {
         if ((glyphIndex >= vector.length) || (glyphIndex < 0)) {
             throw new IndexOutOfBoundsException(
@@ -377,6 +383,7 @@
      * @param glyphIndex specified index of the glyph
      * @return an AffineTransform of the glyph with specified index
      */
+    @Override
     public AffineTransform getGlyphTransform(int glyphIndex) {
         if ((glyphIndex >= this.vector.length) || (glyphIndex < 0)) {
             throw new IndexOutOfBoundsException(
@@ -390,6 +397,7 @@
      * 
      * @param glyphIndex specified index of the glyph
      */
+    @Override
     public GlyphMetrics getGlyphMetrics(int glyphIndex) {
 
         if ((glyphIndex < 0) || ((glyphIndex) >= this.getNumGlyphs())) {
@@ -409,15 +417,19 @@
      * @return a GlyphJustificationInfo object that contains glyph justification 
      * properties of the specified glyph
      */
+    @Override
     public GlyphJustificationInfo getGlyphJustificationInfo(int glyphIndex) {
         // TODO : Find out the source of Justification info
-        if (true) throw new RuntimeException("Method is not implemented");
+        if (true) {
+            throw new RuntimeException("Method is not implemented");
+        }
         return null;
     }
 
     /**
      * Returns the FontRenderContext parameter of this GlyphVector.
      */
+    @Override
     public FontRenderContext getFontRenderContext() {
         return this.vectorFRC;
     }
@@ -427,6 +439,7 @@
      * 
      * @param glyphIndex specified index of the glyph
      */
+    @Override
     public Shape getGlyphVisualBounds(int glyphIndex) {
         if ((glyphIndex < 0) || (glyphIndex >= this.getNumGlyphs())) {
             throw new IndexOutOfBoundsException(
@@ -467,6 +480,7 @@
      * @param y specified y coordinate value
      * @return a Rectangle that bounds pixels of the specified glyph
      */
+    @Override
     public Rectangle getGlyphPixelBounds(int glyphIndex, FontRenderContext frc,
             float x, float y) {
         // TODO : need to be implemented with FontRenderContext
@@ -504,6 +518,7 @@
      * 
      * @param glyphIndex specified index of the glyph
      */
+    @Override
     public Shape getGlyphOutline(int glyphIndex) {
         if ((glyphIndex < 0) || (glyphIndex >= this.getNumGlyphs())) {
             throw new IndexOutOfBoundsException(
@@ -542,6 +557,7 @@
      * @return a Shape object that is the outline of this GlyphVector
      * at the specified coordinates.
      */
+    @Override
     public Shape getOutline(float x, float y) {
         GeneralPath gp = new GeneralPath(GeneralPath.WIND_EVEN_ODD);
         for (int i = 0; i < this.vector.length; i++) {
@@ -560,6 +576,7 @@
      * 
      * @return a Shape object that is the outline of this GlyphVector
      */
+    @Override
     public Shape getOutline() {
         return this.getOutline(0, 0);
     }
@@ -572,6 +589,7 @@
      * @param codeReturn the array that receives glyph codes' values
      * @return an array that receives glyph codes' values
      */
+    @Override
     public int[] getGlyphCodes(int beginGlyphIndex, int numEntries,
             int[] codeReturn) {
 
@@ -604,6 +622,7 @@
      * @param codeReturn the array that receives glyph codes' values
      * @return an array that receives glyph char indices
      */
+    @Override
     public int[] getGlyphCharIndices(int beginGlyphIndex, int numEntries,
             int[] codeReturn) {
         if ((beginGlyphIndex < 0) || (beginGlyphIndex >= this.getNumGlyphs())) {
@@ -636,6 +655,7 @@
      * @param positionReturn the array that receives glyphs' positions
      * @return an array of floats that receives glyph char indices
      */
+    @Override
     public float[] getGlyphPositions(int beginGlyphIndex, int numEntries,
             float[] positionReturn) {
 
@@ -716,6 +736,7 @@
      * 
      * @param glyphIndex specified index of the glyph
      */
+    @Override
     public int getGlyphCode(int glyphIndex) {
         if (glyphIndex >= this.vector.length || glyphIndex < 0) {
             throw new IndexOutOfBoundsException(
@@ -729,6 +750,7 @@
      * 
      * @param glyphIndex specified index of the glyph
      */
+    @Override
     public int getGlyphCharIndex(int glyphIndex) {
 
         if ((glyphIndex < 0) || (glyphIndex >= this.getNumGlyphs())) {
@@ -760,6 +782,7 @@
     /**
      * Assigns default positions to each glyph in this GlyphVector.
      */
+    @Override
     public void performDefaultLayout() {
 
         System.arraycopy(logicalPositions, 0, visualPositions, 0, logicalPositions.length);
@@ -771,6 +794,7 @@
     /**
      * Returns the number of glyphs in this Glyph Vector
      */
+    @Override
     public int getNumGlyphs() {
         return vector.length;
     }
@@ -778,6 +802,7 @@
     /**
      * Returns the logical bounds of this GlyphVector
      */
+    @Override
     public Rectangle2D getLogicalBounds(){
         // XXX: for transforms where an angle between basis vectors is not 90 degrees
         // Rectanlge2D class doesn't fit as Logical bounds. For this reason we use
@@ -797,6 +822,7 @@
      * Checks whether given GlyphVector equals to this GlyphVector.
      * @param glyphVector GlyphVector object to compare
      */
+    @Override
     public boolean equals(GlyphVector glyphVector){
         if (glyphVector == this){
             return true;
@@ -844,6 +870,7 @@
     /**
      * Returns flags describing the state of the GlyphVector.
      */
+    @Override
     public int getLayoutFlags() {
         return layoutFlags;
     }
@@ -875,6 +902,7 @@
      * @param glyphIndex index of the glyph to get it's logical bounds
      * @return logical bounds of the specified glyph
      */
+    @Override
     public Shape getGlyphLogicalBounds(int glyphIndex){
         if ((glyphIndex < 0) || (glyphIndex >= this.getNumGlyphs())){
             throw new IndexOutOfBoundsException("glyphIndex is out of vector's range");
@@ -911,6 +939,7 @@
     /**
      * Returns the Font parameter of this GlyphVector
      */
+    @Override
     public Font getFont(){
         return this.font;
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/CompositeFont.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/CompositeFont.java?view=diff&rev=447707&r1=447706&r2=447707
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/CompositeFont.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/CompositeFont.java Mon Sep 18 20:32:57 2006
@@ -140,6 +140,7 @@
      *   
      * @param chr specified character
      */
+    @Override
     public boolean canDisplay(char chr){
         return (getCharFontIndex(chr) != -1);
     }
@@ -147,6 +148,7 @@
     /**
      * Returns logical ascent (in pixels)
      */
+    @Override
     public int getAscent(){
         return nlm.getLogicalAscent();
     }
@@ -158,7 +160,8 @@
      * @param frc specified FontRenderContext 
      * @param at specified AffineTransform
      */
-     public LineMetrics getLineMetrics(String str, FontRenderContext frc , AffineTransform at){
+     @Override
+    public LineMetrics getLineMetrics(String str, FontRenderContext frc , AffineTransform at){
         LineMetricsImpl lm = (LineMetricsImpl)(this.nlm.clone());
         lm.setNumChars(str.length());
 
@@ -173,6 +176,7 @@
      * Returns cached LineMetrics instance for the null string or creates it if
      * it wasn't cached yet.
      */
+    @Override
     public LineMetrics getLineMetrics(){
         if (nlm == null){
             setDefaultLineMetrics("", null);
@@ -277,6 +281,7 @@
     /**
      * Returns the number of glyphs in this CompositeFont object.
      */
+    @Override
     public int getNumGlyphs(){
         if (this.cachedNumGlyphs == -1){
 
@@ -293,6 +298,7 @@
     /**
      * Returns the italic angle of this object.
      */
+    @Override
     public float getItalicAngle(){
         // !! only first physical font used to get this value
         return fPhysicalFonts[0].getItalicAngle();
@@ -308,8 +314,6 @@
      */
     public Rectangle2D getStringBounds(char[] chars, int start, int end, FontRenderContext frc){
 
-        int finish = chars.length;
-
         LineMetrics lm = getLineMetrics();
         float minY = -lm.getAscent();
         float minX = 0;
@@ -331,6 +335,7 @@
      *  
      * @param frc specified FontRenderContext
      */
+    @Override
     public Rectangle2D getMaxCharBounds(FontRenderContext frc){
 
         Rectangle2D rect2D = fPhysicalFonts[0].getMaxCharBounds(frc);
@@ -368,6 +373,7 @@
     /**
      * Returns font name.
      */
+    @Override
     public String getFontName(){
         return face;
     }
@@ -375,6 +381,7 @@
     /**
      * Returns font postscript name.
      */
+    @Override
     public String getPSName(){
         return psName;
     }
@@ -382,6 +389,7 @@
     /**
      * Returns font family name.
      */
+    @Override
     public String getFamily(){
         return family;
     }
@@ -389,6 +397,7 @@
     /**
      * Returns the code of the missing glyph.
      */
+    @Override
     public int getMissingGlyphCode(){
         // !! only first physical font used to get this value
         return fPhysicalFonts[0].getMissingGlyphCode();
@@ -399,6 +408,7 @@
      * 
      * @param ch specified char
      */
+    @Override
     public Glyph getGlyph(char ch){
         for (int i = 0; i < numFonts; i++){
             if (fontProperties[i].isCharExcluded(ch)){
@@ -418,6 +428,7 @@
      * 
      * @param ind specified index of the character 
      */
+    @Override
     public int charWidth(int ind){
         return charWidth((char)ind);
     }
@@ -427,6 +438,7 @@
      * 
      * @param c specified character 
      */
+    @Override
     public int charWidth(char c){
         Glyph gl = this.getGlyph(c);
         return (int)gl.getGlyphPointMetrics().getAdvanceX();
@@ -435,6 +447,7 @@
     /**
      * Returns debug information about this class.
      */
+    @Override
     public String toString(){
     return new String(this.getClass().getName() +
             "[name=" + this.name +
@@ -445,6 +458,7 @@
     /**
      * Returns Glyph object corresponding to the default glyph.
      */
+    @Override
     public Glyph getDefaultGlyph(){
         // !! only first physical font used to get this value
         return fPhysicalFonts[0].getDefaultGlyph();
@@ -454,6 +468,7 @@
      * Returns FontExtraMetrics object with extra metrics
      * related to this CompositeFont.
      */
+    @Override
     public FontExtraMetrics getExtraMetrics(){
         // Returns FontExtraMetrics instanse of the first physical 
         // Font from the array of fonts.
@@ -463,6 +478,7 @@
     /**
      * Disposes CompositeFont object's resources.
      */
+    @Override
     public void dispose() {
         // Nothing to dispose
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontFinder.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontFinder.java?view=diff&rev=447707&r1=447706&r2=447707
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontFinder.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontFinder.java Mon Sep 18 20:32:57 2006
@@ -22,9 +22,10 @@
 
 package org.apache.harmony.awt.gl.font;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.awt.*;
+import java.awt.Font;
+import java.awt.GraphicsEnvironment;
+import java.util.List;
+import java.util.Map;
 
 /**
  * This class chooses the default font for the given text.
@@ -48,7 +49,7 @@
     private static final int BLOCK_SHIFT = 8;
 
     // Maps characters into the fonts array
-    private static int blocks[][] = new int[NUM_BLOCKS][];
+    private static final int blocks[][] = new int[NUM_BLOCKS][];
 
     /**
      * Finds the font which is able to display the given character
@@ -100,20 +101,19 @@
      * @param runStarts - starts of the resulting font runs
      * @param fonts - mapping of the font run starts to the fonts
      */
-    static void findFonts(
-            char text[], int runStart, int runLimit,
-            ArrayList runStarts, HashMap fonts
-    ) {
+    static void findFonts(char text[], int runStart, int runLimit, List<Integer> runStarts,
+            Map<Integer, Font> fonts) {
         Font prevFont = null;
         Font currFont;
-        for (int i = runStart; i<runLimit; i++) {
+        for (int i = runStart; i < runLimit; i++) {
             currFont = findFontForChar(text[i]);
             if (currFont != prevFont) {
                 prevFont = currFont;
                 Integer idx = new Integer(i);
                 fonts.put(idx, currFont);
-                if (i != runStart)
+                if (i != runStart) {
                     runStarts.add(idx);
+                }
             }
         }
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontManager.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontManager.java?view=diff&rev=447707&r1=447706&r2=447707
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontManager.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontManager.java Mon Sep 18 20:32:57 2006
@@ -24,7 +24,6 @@
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
-import java.lang.ref.Reference;
 import java.lang.ref.ReferenceQueue;
 import java.lang.ref.SoftReference;
 import java.util.Enumeration;
@@ -129,14 +128,14 @@
      * Logical font styles names table where font styles names used 
      * as the key and the value is the index of this style name.
      */
-    private static Hashtable style_keys = new Hashtable(4);
+    private static final Hashtable<String, Integer> style_keys = new Hashtable<String, Integer>(4);
 
     /**
      * Initialize font styles keys table.
      */
     static {
         for (int i = 0; i < STYLE_NAMES.length; i++){
-            style_keys.put(STYLE_NAMES[i], new Integer(i));
+            style_keys.put(STYLE_NAMES[i], Integer.valueOf(i));
         }
     }
 
@@ -146,7 +145,7 @@
      * @param lName style name of the logical face
      */
     public static int getLogicalStyle(String lName){
-        Integer value = (Integer) style_keys.get(lName);
+        Integer value = style_keys.get(lName);
         return value != null ? value.intValue(): -1;
     }
 
@@ -220,7 +219,7 @@
      * Hash table that contains FontPeers instances.
      */
 
-    public Hashtable fontsTable = new Hashtable();
+    public Hashtable<String, HashMapReference> fontsTable = new Hashtable<String, HashMapReference>();
     
     /**
      * ReferenceQueue for HashMapReference objects to check
@@ -279,7 +278,7 @@
                     concat(String.valueOf(size));
         }
         
-        Reference hmr   = (Reference)fontsTable.get(key);
+        HashMapReference hmr   = fontsTable.get(key);
         if (hmr != null) {
             peer = (FontPeer)hmr.get();
         }
@@ -296,7 +295,7 @@
     }
     
     /**
-     * Returns instanse of font peer (logical or physical) according to the 
+     * Returns instance of font peer (logical or physical) according to the 
      * specified parameters.
      * 
      * @param name font face name
@@ -353,7 +352,7 @@
                 String key = name.concat(String.valueOf(fpStyle)).
                     concat(String.valueOf(size));
                 
-                Reference hmr   = (Reference)fontsTable.get(key);
+                HashMapReference hmr   = fontsTable.get(key);
                 if (hmr != null) {
                     physicalFonts[i] = (FontPeerImpl)hmr.get();
                 }
@@ -403,7 +402,7 @@
         String key = DEFAULT_NAME.concat(String.valueOf(style)).
                     concat(String.valueOf(size));
         
-        Reference hmr   = (Reference)fontsTable.get(key);
+        HashMapReference hmr   = fontsTable.get(key);
         if (hmr != null) {
             peer = (FontPeer)hmr.get();
         }
@@ -514,14 +513,15 @@
      */
     private class DisposeNativeHook extends Thread {
 
+        @Override
         public void run() {
             try{
                 /* Disposing native font peer's resources */
-                Enumeration kEnum = fontsTable.keys();
+                Enumeration<String> kEnum = fontsTable.keys();
 
                 while(kEnum.hasMoreElements()){
                     Object key = kEnum.nextElement();
-                    HashMapReference hmr = (HashMapReference)fontsTable.remove(key);
+                    HashMapReference hmr = fontsTable.remove(key);
                     FontPeerImpl delPeer = (FontPeerImpl)hmr.get();
                     
                     if ((delPeer != null) && (delPeer.getClass() != CompositeFont.class)){

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontMetricsImpl.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontMetricsImpl.java?view=diff&rev=447707&r1=447706&r2=447707
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontMetricsImpl.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontMetricsImpl.java Mon Sep 18 20:32:57 2006
@@ -103,6 +103,7 @@
     /**
      * Returns the ascent of the Font describing this FontMetricsImpl object.
      */
+    @Override
     public int getAscent() {
         return this.ascent;
     }
@@ -110,6 +111,7 @@
     /**
      * Returns the descent of the Font describing this FontMetricsImpl object.
      */
+    @Override
     public int getDescent() {
         return this.descent;
     }
@@ -117,6 +119,7 @@
     /**
      * Returns the leading of the Font describing this FontMetricsImpl object.
      */
+    @Override
     public int getLeading() {
         return this.leading;
     }
@@ -129,6 +132,7 @@
      * @return the advance width of the specified char of the Font 
      * describing this FontMetricsImpl object
      */
+    @Override
     public int charWidth(int ch) {
         if (ch < 256){
             return widths[ch];
@@ -145,6 +149,7 @@
      * @return the advance width of the specified char of the Font 
      * describing this FontMetricsImpl object
      */
+    @Override
     public int charWidth(char ch) {
         if (ch < 256){
             return widths[ch];
@@ -157,6 +162,7 @@
      * Returns the maximum advance of the Font describing this 
      * FontMetricsImpl object.
      */
+    @Override
     public int getMaxAdvance() {
         return this.maxAdvance;
     }
@@ -165,6 +171,7 @@
      * Returns the maximum ascent of the Font describing this 
      * FontMetricsImpl object.
      */
+    @Override
     public int getMaxAscent() {
         return this.maxAscent;
     }
@@ -173,6 +180,7 @@
      * Returns the maximum descent of the Font describing this 
      * FontMetricsImpl object.
      */
+    @Override
     public int getMaxDecent() {
         return this.maxDescent;
     }
@@ -181,6 +189,7 @@
      * Returns the maximum descent of the Font describing this 
      * FontMetricsImpl object.
      */
+    @Override
     public int getMaxDescent() {
         return this.maxDescent;
     }
@@ -189,6 +198,7 @@
      * Returns the advance widths of the first 256 characters in the Font 
      * describing this FontMetricsImpl object.
      */
+    @Override
     public int[] getWidths() {
         return this.widths;
     }
@@ -201,6 +211,7 @@
      * @return the total advance width of the specified string in the metrics 
      * of the Font describing this FontMetricsImpl object
      */
+    @Override
     public int stringWidth(String str) {
         int width = 0;
         char chr;
@@ -222,6 +233,7 @@
      * @return a FontPeer object, that is the platform dependent FontPeer 
      * implementation for the Font describing this FontMetricsImpl object.
      */
+    @SuppressWarnings("deprecation")
     public FontPeerImpl getFontPeer(){
         if (peer == null){
             peer = (FontPeerImpl)font.getPeer();

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontPeerImpl.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontPeerImpl.java?view=diff&rev=447707&r1=447706&r2=447707
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontPeerImpl.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontPeerImpl.java Mon Sep 18 20:32:57 2006
@@ -264,7 +264,7 @@
 
         char i = uFirst;
         int len = uLast - uFirst;
-        ArrayList lst = new ArrayList(len);
+        ArrayList<Glyph> lst = new ArrayList<Glyph>(len);
 
         if (size < 0) {
             throw new IllegalArgumentException(
@@ -462,6 +462,7 @@
      * 
      * @param newType new type value
      */
+    @Override
     protected void finalize() throws Throwable {
       super.finalize();
       

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/Glyph.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/Glyph.java?view=diff&rev=447707&r1=447706&r2=447707
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/Glyph.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/Glyph.java Mon Sep 18 20:32:57 2006
@@ -169,9 +169,11 @@
     /**
      * Returns true if this Glyph and specified object are equal.
      */
+    @Override
     public boolean equals(Object obj){
-         if (obj == this)
+         if (obj == this) {
             return true;
+        }
 
         if (obj != null) {
           try {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/LineMetricsImpl.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/LineMetricsImpl.java?view=diff&rev=447707&r1=447706&r2=447707
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/LineMetricsImpl.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/LineMetricsImpl.java Mon Sep 18 20:32:57 2006
@@ -255,6 +255,7 @@
     /**
      * Returns offset of the baseline.
      */
+    @Override
     public float[] getBaselineOffsets() {
         // XXX: at the moment there only horizontal metrics are taken into
         // account. If there is no baseline information in TrueType font
@@ -266,6 +267,7 @@
     /**
      * Returns a number of chars in specified text
      */
+    @Override
     public int getNumChars() {
         return numChars;
     }
@@ -273,6 +275,7 @@
     /**
      * Returns index of the baseline, one of predefined constants.
      */
+    @Override
     public int getBaselineIndex() {
         // Baseline index is the deafult baseline index value
         // taken from the TrueType table "BASE".
@@ -282,6 +285,7 @@
     /**
      * Returns thickness of the Underline.
      */
+    @Override
     public float getUnderlineThickness() {
         return underlineThickness;
     }
@@ -289,6 +293,7 @@
     /**
      * Returns offset of the Underline.
      */
+    @Override
     public float getUnderlineOffset() {
         return underlineOffset;
     }
@@ -296,6 +301,7 @@
     /**
      * Returns thickness of the Strikethrough line.
      */
+    @Override
     public float getStrikethroughThickness() {
         return strikethroughThickness;
     }
@@ -303,6 +309,7 @@
     /**
      * Returns offset of the Strikethrough line.
      */
+    @Override
     public float getStrikethroughOffset() {
         return strikethroughOffset;
     }
@@ -310,6 +317,7 @@
     /**
      * Returns the leading.
      */
+    @Override
     public float getLeading() {
         return leading;
     }
@@ -317,6 +325,7 @@
     /**
      * Returns the height of the font.
      */
+    @Override
     public float getHeight() {
         return height; // equals to (ascent + descent + leading);
     }
@@ -324,6 +333,7 @@
     /**
      * Returns the descent.
      */
+    @Override
     public float getDescent() {
         return descent;
     }
@@ -331,6 +341,7 @@
     /**
      * Returns the ascent.
      */
+    @Override
     public float getAscent() {
         return ascent;
     }
@@ -414,6 +425,7 @@
         numChars = num;
     }
 
+    @Override
     public Object clone(){
         try{
             return super.clone();

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/TextDecorator.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/TextDecorator.java?view=diff&rev=447707&r1=447706&r2=447707
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/TextDecorator.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/TextDecorator.java Mon Sep 18 20:32:57 2006
@@ -37,7 +37,7 @@
  * underline, strikethrough, text with background, etc.
  */
 public class TextDecorator {
-    private static TextDecorator inst = new TextDecorator();
+    private static final TextDecorator inst = new TextDecorator();
     private TextDecorator() {}
     static TextDecorator getInstance() {
         return inst;
@@ -156,8 +156,9 @@
      * @return Decoration object
      */
     static Decoration getDecoration(Map attributes) {
-        if (attributes == null)
+        if (attributes == null) {
             return null; // It is for plain text
+        }
 
         Object underline = attributes.get(TextAttribute.UNDERLINE);
         boolean hasStandardUnderline = underline == TextAttribute.UNDERLINE_ON;
@@ -188,22 +189,18 @@
         ) {
             return null;
         }
-        else {
-            return new Decoration(
-                    imUl, swapBgFg, strikeThrough,
-                    bg, fg, hasStandardUnderline
-            );
-        }
+        return new Decoration(imUl, swapBgFg, strikeThrough, bg, fg, hasStandardUnderline);
     }
 
     /**
      * Fills the background before drawing if needed.
+     * 
      * @param trs - text segment
      * @param g2d - graphics to draw to
-     * @param xOffset - offset in X direction to the upper left corner
-     * of the layout from the origin of the graphics
-     * @param yOffset - offset in Y direction to the upper left corner
-     * of the layout from the origin of the graphics
+     * @param xOffset - offset in X direction to the upper left corner of the
+     *        layout from the origin of the graphics
+     * @param yOffset - offset in Y direction to the upper left corner of the
+     *        layout from the origin of the graphics
      */
     static void prepareGraphics(
             TextRunSegment trs, Graphics2D g2d,
@@ -217,8 +214,9 @@
 
         d.graphicsPaint = g2d.getPaint();
 
-        if (d.fg == null)
+        if (d.fg == null) {
             d.fg = d.graphicsPaint;
+        }
 
         if (d.swapBfFg) {
             // Fill background area
@@ -282,8 +280,9 @@
     ) {
         Decoration d = trs.decoration;
 
-        if (!d.ulOn && d.imUlStroke == null && !d.strikeThrough)
+        if (!d.ulOn && d.imUlStroke == null && !d.strikeThrough) {
             return; // Nothing to do
+        }
 
         float left = xOffset + (float) trs.getLogicalBounds().getMinX();
         float right = xOffset + (float) trs.getLogicalBounds().getMaxX();
@@ -331,48 +330,48 @@
             Rectangle2D segmentBounds,
             Decoration d
     ) {
-        if (d == null)
+        if (d == null) {
             return segmentBounds;
-        else {
-            double minx = segmentBounds.getMinX();
-            double miny = segmentBounds.getMinY();
-            double maxx = segmentBounds.getMaxX();
-            double maxy = segmentBounds.getMaxY();
-
-            Rectangle2D lb = trs.getLogicalBounds();
-
-            if (d.swapBfFg || d.bg != null) {
-                minx = Math.min(lb.getMinX() - trs.x, minx);
-                miny = Math.min(lb.getMinY() - trs.y, miny);
-                maxx = Math.max(lb.getMaxX() - trs.x, maxx);
-                maxy = Math.max(lb.getMaxY() - trs.y, maxy);
+        }
+        double minx = segmentBounds.getMinX();
+        double miny = segmentBounds.getMinY();
+        double maxx = segmentBounds.getMaxX();
+        double maxy = segmentBounds.getMaxY();
+
+        Rectangle2D lb = trs.getLogicalBounds();
+
+        if (d.swapBfFg || d.bg != null) {
+            minx = Math.min(lb.getMinX() - trs.x, minx);
+            miny = Math.min(lb.getMinY() - trs.y, miny);
+            maxx = Math.max(lb.getMaxX() - trs.x, maxx);
+            maxy = Math.max(lb.getMaxY() - trs.y, maxy);
+        }
+
+        if (d.ulOn || d.imUlStroke != null || d.strikeThrough) {
+            minx = Math.min(lb.getMinX() - trs.x, minx);
+            maxx = Math.max(lb.getMaxX() - trs.x, maxx);
+
+            d.getStrokes(trs.metrics);
+
+            if (d.ulStroke != null) {
+                maxy = Math.max(
+                        maxy,
+                        trs.metrics.underlineOffset +
+                        d.ulStroke.getLineWidth()
+                );
             }
 
-            if (d.ulOn || d.imUlStroke != null || d.strikeThrough) {
-                minx = Math.min(lb.getMinX() - trs.x, minx);
-                maxx = Math.max(lb.getMaxX() - trs.x, maxx);
-
-                d.getStrokes(trs.metrics);
-
-                if (d.ulStroke != null)
-                    maxy = Math.max(
-                            maxy,
-                            trs.metrics.underlineOffset +
-                            d.ulStroke.getLineWidth()
-                    );
-
-                if (d.imUlStroke != null) {
-                    maxy = Math.max(
-                            maxy,
-                            trs.metrics.underlineOffset +
-                            d.imUlStroke.getLineWidth() +
-                            (d.imUlStroke2 == null ? 0 : d.imUlStroke2.getLineWidth())
-                    );
-                }
+            if (d.imUlStroke != null) {
+                maxy = Math.max(
+                        maxy,
+                        trs.metrics.underlineOffset +
+                        d.imUlStroke.getLineWidth() +
+                        (d.imUlStroke2 == null ? 0 : d.imUlStroke2.getLineWidth())
+                );
             }
-
-            return new Rectangle2D.Double(minx, miny, maxx-minx, maxy-miny);
         }
+
+        return new Rectangle2D.Double(minx, miny, maxx-minx, maxy-miny);
     }
 
     /**
@@ -388,8 +387,9 @@
             Shape segmentOutline,
             Decoration d
     ) {
-        if (d == null || !d.ulOn && d.imUlStroke == null && !d.strikeThrough)
+        if (d == null || !d.ulOn && d.imUlStroke == null && !d.strikeThrough) {
             return segmentOutline; // Nothing to do
+        }
 
         Area res = new Area(segmentOutline);
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/TextMetricsCalculator.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/TextMetricsCalculator.java?view=diff&rev=447707&r1=447706&r2=447707
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/TextMetricsCalculator.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/TextMetricsCalculator.java Mon Sep 18 20:32:57 2006
@@ -28,11 +28,6 @@
 import java.util.ArrayList;
 
 /**
- * Date: Apr 26, 2005
- * Time: 4:32:20 PM
- */
-
-/**
  * This class operates with an arbitrary text string which can include
  * any number of style, font and direction runs. It is responsible for computation
  * of the text metrics, such as ascent, descent, leading and advance. Actually,
@@ -64,14 +59,15 @@
      * @return baseline offset
      */
     float getBaselineOffset(int baselineIndex) {
-        if (baselineIndex >= 0)
+        if (baselineIndex >= 0) {
             return baselineOffsets[baselineIndex];
-        else if (baselineIndex == GraphicAttribute.BOTTOM_ALIGNMENT)
+        } else if (baselineIndex == GraphicAttribute.BOTTOM_ALIGNMENT) {
             return descent;
-        else if (baselineIndex == GraphicAttribute.TOP_ALIGNMENT)
+        } else if (baselineIndex == GraphicAttribute.TOP_ALIGNMENT) {
             return -ascent;
-        else
+        } else {
             throw new IllegalArgumentException("Invalid baseline index");
+        }
     }
 
     public float[] getBaselineOffsets() {
@@ -122,8 +118,9 @@
         // Normalize offsets if needed
         if (baselineOffsets[baselineIndex] != 0) {
             float baseOffset = baselineOffsets[baselineIndex];
-            for (int i = 0; i < baselineOffsets.length; i++)
+            for (int i = 0; i < baselineOffsets.length; i++) {
                 baselineOffsets[i] -= baseOffset;
+            }
         }
     }
 
@@ -132,13 +129,13 @@
      */
     void computeMetrics() {
 
-        ArrayList segments = breaker.runSegments;
+        ArrayList<TextRunSegment> segments = breaker.runSegments;
 
         float maxHeight = 0;
         float maxHeightLeading = 0;
 
         for (int i = 0; i < segments.size(); i++) {
-            TextRunSegment segment = (TextRunSegment) segments.get(i);
+            TextRunSegment segment = segments.get(i);
             BasicMetrics metrics = segment.metrics;
             int baseline = metrics.baseLineIndex;
 
@@ -170,13 +167,11 @@
         float currAdvance = 0;
 
         for (int i = 0; i < segments.size(); i++) {
-            TextRunSegment segment =
-                    (TextRunSegment) segments.get(breaker.getSegmentFromVisualOrder(i));
+            TextRunSegment segment = segments.get(breaker.getSegmentFromVisualOrder(i));
             currMetrics = segment.metrics;
 
-            segment.y =
-                    getBaselineOffset(currMetrics.baseLineIndex) +
-                    currMetrics.superScriptOffset;
+            segment.y = getBaselineOffset(currMetrics.baseLineIndex)
+                    + currMetrics.superScriptOffset;
             segment.x = currAdvance;
 
             currAdvance += segment.getAdvance();
@@ -200,11 +195,9 @@
      * @param metrics - metrics with outdated advance which should be corrected 
      */
     public void correctAdvance(BasicMetrics metrics) {
-        ArrayList segments = breaker.runSegments;
-        TextRunSegment segment =
-                (TextRunSegment) segments.get(
-                        breaker.getSegmentFromVisualOrder(segments.size()-1)
-                );
+        ArrayList<TextRunSegment> segments = breaker.runSegments;
+        TextRunSegment segment = segments.get(breaker
+                .getSegmentFromVisualOrder(segments.size() - 1));
 
         advance = segment.x + segment.getAdvance();
         metrics.advance = advance;

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/TextRunBreaker.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/TextRunBreaker.java?view=diff&rev=447707&r1=447706&r2=447707
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/TextRunBreaker.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/TextRunBreaker.java Mon Sep 18 20:32:57 2006
@@ -31,13 +31,11 @@
 import java.text.Annotation;
 import java.util.*;
 
+import org.apache.harmony.awt.gl.font.TextDecorator.Decoration;
 import org.apache.harmony.misc.HashCode;
 // XXX - TODO - bidi not implemented yet
 
 /**
- * Date: Apr 26, 2005
- * Time: 4:32:04 PM
- *
  * This class is responsible for breaking the text into the run segments
  * with constant font, style, other text attributes and direction.
  * It also stores the created text run segments and covers functionality
@@ -53,12 +51,12 @@
     byte[] levels;
 
     HashMap fonts = null;
-    HashMap decorations = null;
+    HashMap<Integer, Decoration> decorations = null;
 
     // Related to default font substitution
     int forcedFontRunStarts[] = null;
 
-    ArrayList runSegments = new ArrayList();
+    ArrayList<TextRunSegment> runSegments = new ArrayList<TextRunSegment>();
 
     // For fast retrieving of the segment containing
     // character with known logical index
@@ -138,17 +136,17 @@
      * @return end index of the level run
      */
     int getLevelRunLimit(int runStart, int runEnd) {
-        if (levels == null)
+        if (levels == null) {
             return runEnd;
-        else {
-            int endLevelRun = runStart + 1;
-            byte level = levels[runStart];
-
-            while (endLevelRun <= runEnd && levels[endLevelRun] == level)
-                endLevelRun++;
+        }
+        int endLevelRun = runStart + 1;
+        byte level = levels[runStart];
 
-            return endLevelRun;
+        while (endLevelRun <= runEnd && levels[endLevelRun] == level) {
+            endLevelRun++;
         }
+
+        return endLevelRun;
     }
 
     /**
@@ -193,17 +191,18 @@
     void createStyleRuns() {
         // XXX - todo - implement fast and simple case
         fonts = new HashMap();
-        decorations = new HashMap();
+        decorations = new HashMap<Integer, Decoration>();
         ////
 
-        ArrayList forcedFontRunStartsList = null;
+        ArrayList<Integer> forcedFontRunStartsList = null;
 
         Map attributes = null;
 
         // Check justification attribute
         Object val = aci.getAttribute(TextAttribute.JUSTIFICATION);
-        if (val != null)
+        if (val != null) {
             justification = ((Float) val).floatValue();
+        }
 
         for (
             int index = segmentsStart, nextRunStart = segmentsStart;
@@ -233,8 +232,9 @@
 
                     if (value == null) {
                         // 4. No attributes found, using default.
-                        if (forcedFontRunStartsList == null)
-                            forcedFontRunStartsList = new ArrayList();
+                        if (forcedFontRunStartsList == null) {
+                            forcedFontRunStartsList = new ArrayList<Integer>();
+                        }
                         FontFinder.findFonts(
                                 text,
                                 index,
@@ -255,7 +255,7 @@
             forcedFontRunStarts = new int[forcedFontRunStartsList.size()];
             for (int i=0; i<forcedFontRunStartsList.size(); i++) {
                 forcedFontRunStarts[i] =
-                        ((Integer) forcedFontRunStartsList.get(i)).intValue();
+                        forcedFontRunStartsList.get(i).intValue();
             }
         }
     }
@@ -271,17 +271,18 @@
         try {
             aci.setIndex(runStart);
         } catch(IllegalArgumentException e) { // Index out of bounds
-            if (runStart < segmentsStart)
+            if (runStart < segmentsStart) {
                 aci.first();
-            else
+            } else {
                 aci.last();
+            }
         }
 
         // If we have some extra runs we need to check for their limits
         if (forcedFontRunStarts != null) {
-            for (int i=0; i<forcedFontRunStarts.length; i++) {
-                if (forcedFontRunStarts[i] > runStart) {
-                    maxPos = Math.min(forcedFontRunStarts[i], maxPos);
+            for (int element : forcedFontRunStarts) {
+                if (element > runStart) {
+                    maxPos = Math.min(element, maxPos);
                     break;
                 }
             }
@@ -389,15 +390,14 @@
                 segmentIndex < runSegments.size();
                 segmentIndex++
            ) {
-            s = (TextRunSegment) runSegments.get(segmentIndex);
+            s = runSegments.get(segmentIndex);
             breakIndex = s.getCharIndexFromAdvance(maxAdvance, start);
 
-            if (breakIndex < s.getEnd())
+            if (breakIndex < s.getEnd()) {
                 return breakIndex;
-            else {
-                maxAdvance -= s.getAdvanceDelta(start, s.getEnd());
-                start = s.getEnd();
             }
+            maxAdvance -= s.getAdvanceDelta(start, s.getEnd());
+            start = s.getEnd();
         }
 
         return s.getEnd();
@@ -423,10 +423,11 @@
         System.arraycopy(text, insertPos, newText, insertPos+1, text.length - insertPos);
         text = newText;
 
-        if (aci.getRunStart() == key.intValue() && aci.getRunLimit() == key.intValue() + 1)
+        if (aci.getRunStart() == key.intValue() && aci.getRunLimit() == key.intValue() + 1) {
             createStyleRuns(); // We have to create one new run, could be optimized
-        else
+        } else {
             shiftStyleRuns(key, 1);
+        }
 
         resetSegments();
 
@@ -450,8 +451,9 @@
         System.arraycopy(text, deletePos+1, newText, deletePos, newText.length - deletePos);
         text = newText;
 
-        if (fonts.get(key) != null)
+        if (fonts.get(key) != null) {
             fonts.remove(key);
+        }
 
         shiftStyleRuns(key, -1);
 
@@ -467,18 +469,18 @@
      * @param shift - shift, could be negative
      */
     private void shiftStyleRuns(Integer pos, final int shift) {
-        ArrayList keys = new ArrayList();
+        ArrayList<Integer> keys = new ArrayList<Integer>();
 
         Integer key, oldkey;
-        for (Iterator it = fonts.keySet().iterator(); it.hasNext(); ) {
-            oldkey = (Integer) it.next();
+        for (Iterator<Integer> it = fonts.keySet().iterator(); it.hasNext(); ) {
+            oldkey = it.next();
             if (oldkey.intValue() > pos.intValue()) {
                 keys.add(oldkey);
             }
         }
 
         for (int i=0; i<keys.size(); i++) {
-            oldkey = (Integer) keys.get(i);
+            oldkey = keys.get(i);
             key = new Integer(shift + oldkey.intValue());
             fonts.put(key, fonts.remove(oldkey));
             decorations.put(key, decorations.remove(oldkey));
@@ -489,7 +491,7 @@
      * Resets state of the class
      */
     private void resetSegments() {
-        runSegments = new ArrayList();
+        runSegments = new ArrayList<TextRunSegment>();
         logical2segment = null;
         segment2visual = null;
         visual2segment = null;
@@ -498,7 +500,7 @@
     }
 
     private class SegmentsInfo {
-        ArrayList runSegments;
+        ArrayList<TextRunSegment> runSegments;
         int logical2segment[];
         int segment2visual[];
         int visual2segment[];
@@ -532,8 +534,9 @@
      * Restores the internal state of the class
      */
     public void popSegments() {
-        if (storedSegments == null)
+        if (storedSegments == null) {
             return;
+        }
 
         this.runSegments = storedSegments.runSegments;
         this.logical2segment = storedSegments.logical2segment;
@@ -544,20 +547,22 @@
         this.segmentsEnd = storedSegments.segmentsEnd;
         storedSegments = null;
 
-        if (runSegments.size() == 0 && logical2segment == null)
+        if (runSegments.size() == 0 && logical2segment == null) {
             haveAllSegments = false;
-        else
+        } else {
             haveAllSegments = true;
+        }
     }
 
+    @Override
     public Object clone() {
         try {
             TextRunBreaker res = (TextRunBreaker) super.clone();
             res.storedSegments = null;
-            ArrayList newSegments = new ArrayList(runSegments.size());
+            ArrayList<TextRunSegment> newSegments = new ArrayList<TextRunSegment>(runSegments.size());
             for (int i = 0; i < runSegments.size(); i++) {
-                TextRunSegment seg =  (TextRunSegment) runSegments.get(i);
-                newSegments.add(seg.clone());
+                TextRunSegment seg =  runSegments.get(i);
+                newSegments.add((TextRunSegment)seg.clone());
             }
             res.runSegments = newSegments;
             return res;
@@ -566,18 +571,22 @@
         }
     }
 
+    @Override
     public boolean equals(Object obj) {
-        if (!(obj instanceof TextRunBreaker))
+        if (!(obj instanceof TextRunBreaker)) {
             return false;
+        }
 
         TextRunBreaker br = (TextRunBreaker) obj;
 
-        if (br.getACI().equals(aci) && br.frc.equals(frc))
+        if (br.getACI().equals(aci) && br.frc.equals(frc)) {
             return true;
+        }
 
         return false;
     }
 
+    @Override
     public int hashCode() {
         return HashCode.combine(aci.hashCode(), frc.hashCode());
     }
@@ -592,7 +601,7 @@
      */
     public void drawSegments(Graphics2D g2d, float xOffset, float yOffset) {
         for (int i=0; i<runSegments.size(); i++) {
-            ((TextRunSegment) runSegments.get(i)).draw(g2d, xOffset, yOffset);
+            runSegments.get(i).draw(g2d, xOffset, yOffset);
         }
     }
 
@@ -608,7 +617,7 @@
         TextRunSegment segment;
 
         for (int idx = firstEndpoint; idx < secondEndpoint; idx=segment.getEnd()) {
-            segment = (TextRunSegment) runSegments.get(logical2segment[idx]);
+            segment = runSegments.get(logical2segment[idx]);
             bounds.append(segment.getCharsBlackBoxBounds(idx, secondEndpoint), false);
         }
 
@@ -623,11 +632,12 @@
         Rectangle2D bounds = null;
 
         for (int i=0; i<runSegments.size(); i++) {
-            TextRunSegment s = (TextRunSegment) runSegments.get(i);
-            if (bounds != null)
+            TextRunSegment s = runSegments.get(i);
+            if (bounds != null) {
                 Rectangle2D.union(bounds, s.getVisualBounds(), bounds);
-            else
+            } else {
                 bounds = s.getVisualBounds();
+            }
         }
 
         return bounds;
@@ -641,11 +651,12 @@
         Rectangle2D bounds = null;
 
         for (int i=0; i<runSegments.size(); i++) {
-            TextRunSegment s = (TextRunSegment) runSegments.get(i);
-            if (bounds != null)
+            TextRunSegment s = runSegments.get(i);
+            if (bounds != null) {
                 Rectangle2D.union(bounds, s.getLogicalBounds(), bounds);
-            else
+            } else {
                 bounds = s.getLogicalBounds();
+            }
         }
 
         return bounds;
@@ -656,10 +667,10 @@
     }
 
     public byte getLevel(int idx) {
-        if (levels == null)
+        if (levels == null) {
             return 0;
-        else
-            return levels[idx];
+        }
+        return levels[idx];
     }
 
     public int getBaseLevel() {
@@ -688,7 +699,7 @@
         TextRunSegment segment;
 
         for (int i = 0; i < runSegments.size(); i++) {
-            segment = (TextRunSegment) runSegments.get(i);
+            segment = runSegments.get(i);
             outline.append(segment.getOutline(), false);
         }
 
@@ -709,7 +720,7 @@
 
         double endOfPrevSeg = -1;
         for (int i = 0; i < runSegments.size(); i++) {
-            segment = (TextRunSegment) runSegments.get(i);
+            segment = runSegments.get(i);
             Rectangle2D bounds = segment.getVisualBounds();
             if ((bounds.getMinX() <= x && bounds.getMaxX() >= x) || // We are in the segment
                (endOfPrevSeg < x && bounds.getMinX() > x)) { // We are somewhere between the segments
@@ -735,8 +746,9 @@
 
         while (lastNonWhitespace >= 0) {
             lastNonWhitespace--;
-            if (!Character.isWhitespace(text[lastNonWhitespace]))
+            if (!Character.isWhitespace(text[lastNonWhitespace])) {
                 break;
+            }
         }
 
         return lastNonWhitespace;
@@ -771,9 +783,10 @@
             }
 
             for (int i = 0; i < runSegments.size(); i++) {
-                TextRunSegment segment = (TextRunSegment) runSegments.get(i);
-                if (segment.getStart() <= lastIdx)
+                TextRunSegment segment = runSegments.get(i);
+                if (segment.getStart() <= lastIdx) {
                     segment.updateJustificationInfo(jInfo);
+                }
             }
 
             if (jInfo.priority == highestPriority) {
@@ -782,8 +795,9 @@
             }
 
             if (jInfo.weight != 0) {
-                if (highestPriority < 0) // Remember highest priority
+                if (highestPriority < 0) {
                     highestPriority = priority;
+                }
                 jInfos[priority] = jInfo;
             } else {
                 continue;
@@ -795,9 +809,8 @@
                 gapLeft = 0;
                 jInfo.gapPerUnit = jInfo.gapToFill/jInfo.weight;
                 break;
-            } else {
-                jInfo.useLimits = true;
             }
+            jInfo.useLimits = true;
 
             if (jInfo.absorbedWeight > 0) {
                 jInfo.absorb = true;
@@ -810,7 +823,7 @@
         float currJustificationOffset = 0;
         for (int i = 0; i < runSegments.size(); i++) {
             TextRunSegment segment =
-                    (TextRunSegment) runSegments.get(getSegmentFromVisualOrder(i));
+                    runSegments.get(getSegmentFromVisualOrder(i));
             segment.x += currJustificationOffset;
             currJustificationOffset += segment.doJustification(jInfos);
         }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/TextRunSegment.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/TextRunSegment.java?view=diff&rev=447707&r1=447706&r2=447707
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/TextRunSegment.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/TextRunSegment.java Mon Sep 18 20:32:57 2006
@@ -159,5 +159,6 @@
      */    
     abstract float doJustification(TextRunBreaker.JustificationInfo jInfos[]);
 
+    @Override
     public abstract Object clone();
 }



Mime
View raw message