harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r441863 [3/5] - in /incubator/harmony/enhanced/classlib/trunk/modules/awt/src: main/java/common/java/awt/ test/api/java/common/java/awt/
Date Sat, 09 Sep 2006 21:56:50 GMT
Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Font.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Font.java?view=diff&rev=441863&r1=441862&r2=441863
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Font.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Font.java Sat Sep  9 14:56:46 2006
@@ -86,7 +86,7 @@
     private boolean transformed;
     
     // Set of font attributes 
-    private Hashtable fRequestedAttributes;
+    private Hashtable<Attribute, Object> fRequestedAttributes;
 
     // font peer object corresponding to this Font
     private transient FontPeerImpl fontPeer;
@@ -97,9 +97,6 @@
     // code for missing glyph for this Font     
     private transient int missingGlyphCode = -1;
 
-    // flag, true if this Font was created from InputStream
-    private boolean createdFromStream;
-
     /**
      * Writes object to ObjectOutputStream.
      * 
@@ -125,11 +122,10 @@
 
         numGlyphs = -1;
         missingGlyphCode = -1;
-        createdFromStream = false;
 
     }
 
-    public Font(Map attributes) {
+    public Font(Map<Attribute, Object> attributes) {
         Object currAttr;
 
         // Default values are taken from the documentation of the Font class. 
@@ -142,7 +138,7 @@
 
         if (attributes != null){
 
-            fRequestedAttributes = new Hashtable(attributes);
+            fRequestedAttributes = new Hashtable<Attribute, Object>(attributes);
 
             currAttr = attributes.get(TextAttribute.SIZE);
             if ( currAttr != null){
@@ -173,7 +169,7 @@
             }
 
         } else {
-            fRequestedAttributes = new Hashtable(5);
+            fRequestedAttributes = new Hashtable<Attribute, Object>(5);
             fRequestedAttributes.put(TextAttribute.TRANSFORM, IDENTITY_TRANSFORM);
 
             this.transformed = false;
@@ -206,7 +202,7 @@
         this.style = (style & ~0x03) == 0 ? style : Font.PLAIN;
         this.pointSize = this.size;
 
-        fRequestedAttributes = new Hashtable(5);
+        fRequestedAttributes = new Hashtable<Attribute, Object>(5);
 
         fRequestedAttributes.put(TextAttribute.TRANSFORM, IDENTITY_TRANSFORM);
 
@@ -244,10 +240,11 @@
             st++;
         }
 
-        if (st == limit)
+        if (st == limit) {
             result = -1;
-        else
+        } else {
             result = st;
+        }
 
         return result;
     }
@@ -261,10 +258,11 @@
             st++;
             c = iter.next();
         }
-        if (st == limit)
+        if (st == limit) {
             result = -1;
-        else
+        } else {
             result = st;
+        }
 
         return result;
     }
@@ -299,7 +297,9 @@
     public GlyphVector createGlyphVector(FontRenderContext frc,
             int[] glyphCodes) {
         // TODO : to find out, how to operate with glyphcodes
-        if (true) throw new RuntimeException("Method is not implemented");
+        if (true) {
+            throw new RuntimeException("Method is not implemented");
+        }
         return null;
     }
 
@@ -384,13 +384,14 @@
         return new Font(fontName, fontStyle, fontSize);
     }
 
+    @SuppressWarnings("unchecked")
     public Font deriveFont(AffineTransform trans) {
 
         if (trans == null) {
             throw new IllegalArgumentException("transform must not be null");
         }
 
-        Hashtable derivefRequestedAttributes = (Hashtable)fRequestedAttributes.clone();
+        Hashtable<Attribute, Object> derivefRequestedAttributes = (Hashtable<Attribute, Object>)fRequestedAttributes.clone();
 
         derivefRequestedAttributes.put(TextAttribute.TRANSFORM,
                 new TransformAttribute(trans));
@@ -399,14 +400,16 @@
 
     }
 
+    @SuppressWarnings("unchecked")
     public Font deriveFont(float size) {
-        Hashtable derivefRequestedAttributes = (Hashtable)fRequestedAttributes.clone();
+        Hashtable<Attribute, Object> derivefRequestedAttributes = (Hashtable<Attribute, Object>)fRequestedAttributes.clone();
         derivefRequestedAttributes.put(TextAttribute.SIZE, new Float(size));
         return new Font(derivefRequestedAttributes);
     }
 
+    @SuppressWarnings("unchecked")
     public Font deriveFont(int style) {
-        Hashtable derivefRequestedAttributes = (Hashtable)fRequestedAttributes.clone();
+        Hashtable<Attribute, Object> derivefRequestedAttributes = (Hashtable<Attribute, Object>)fRequestedAttributes.clone();
 
         if ((style & Font.BOLD) != 0){
             derivefRequestedAttributes.put(TextAttribute.WEIGHT,
@@ -425,12 +428,13 @@
         return new Font(derivefRequestedAttributes);
     }
 
+    @SuppressWarnings("unchecked")
     public Font deriveFont(int style, AffineTransform trans) {
 
         if (trans == null) {
             throw new IllegalArgumentException("transform must not be null");
         }
-        Hashtable derivefRequestedAttributes = (Hashtable)fRequestedAttributes.clone();
+        Hashtable<Attribute, Object> derivefRequestedAttributes = (Hashtable<Attribute, Object>)fRequestedAttributes.clone();
 
         if ((style & BOLD) != 0){
             derivefRequestedAttributes.put(TextAttribute.WEIGHT,
@@ -451,8 +455,9 @@
         return new Font(derivefRequestedAttributes);
     }
 
+    @SuppressWarnings("unchecked")
     public Font deriveFont(int style, float size) {
-        Hashtable derivefRequestedAttributes = (Hashtable)fRequestedAttributes.clone();
+        Hashtable<Attribute, Object> derivefRequestedAttributes = (Hashtable<Attribute, Object>)fRequestedAttributes.clone();
 
         if ((style & BOLD) != 0){
             derivefRequestedAttributes.put(TextAttribute.WEIGHT,
@@ -473,20 +478,22 @@
 
     }
 
-    public Font deriveFont(Map attributes) {
+    @SuppressWarnings("unchecked")
+    public Font deriveFont(Map<?, ?> attributes) {
         Attribute[] avalAttributes = this.getAvailableAttributes();
 
-        Hashtable derivefRequestedAttributes = (Hashtable)fRequestedAttributes.clone();
+        Hashtable<Attribute, Object> derivefRequestedAttributes = (Hashtable<Attribute, Object>)fRequestedAttributes.clone();
         Object currAttribute;
-        for (int i = 0; i < avalAttributes.length; i++){
-            currAttribute = attributes.get(avalAttributes[i]);
+        for (Attribute element : avalAttributes) {
+            currAttribute = attributes.get(element);
             if (currAttribute != null){
-                derivefRequestedAttributes.put(avalAttributes[i], currAttribute);
+                derivefRequestedAttributes.put(element, currAttribute);
             }
         }
         return new Font(derivefRequestedAttributes);
     }
 
+    @Override
     public boolean equals(Object obj) {
         if (obj == this){
             return true;
@@ -508,8 +515,9 @@
         return false;
     }
 
-    public Map getAttributes() {
-        return (Map)fRequestedAttributes.clone();
+    @SuppressWarnings("unchecked")
+    public Map<Attribute, Object> getAttributes() {
+        return (Map<Attribute, Object>)fRequestedAttributes.clone();
     }
 
     public Attribute[] getAvailableAttributes() {
@@ -541,13 +549,12 @@
     }
 
 
-    public static Font getFont(Map attributes) {
+    public static Font getFont(Map<Attribute, Object> attributes) {
         Font fnt = (Font)attributes.get(TextAttribute.FONT);
         if (fnt != null){
             return fnt;
-        } else {
-            return new Font(attributes);
         }
+        return new Font(attributes);
     }
 
     public static Font getFont(String sp, Font f) {
@@ -753,6 +760,7 @@
         return new CommonGlyphVector(out, frc, this, flags);
     }
 
+    @Override
     public String toString() {
         String stl = "plain";
         String result;
@@ -798,10 +806,9 @@
         if (transform != null) {
             if (transform instanceof TransformAttribute) {
                 return ((TransformAttribute) transform).getTransform();
-            } else {
-                if (transform instanceof AffineTransform) {
-                    return new AffineTransform((AffineTransform) transform);
-                }
+            }
+            if (transform instanceof AffineTransform) {
+                return new AffineTransform((AffineTransform) transform);
             }
         } else {
             transform = new AffineTransform();
@@ -831,6 +838,7 @@
         return peer.hasUniformLineMetrics();
     }
 
+    @Override
     public int hashCode() {
         HashCode hash = new HashCode();
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/FontMetrics.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/FontMetrics.java?view=diff&rev=441863&r1=441862&r2=441863
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/FontMetrics.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/FontMetrics.java Sat Sep  9 14:56:46 2006
@@ -34,6 +34,7 @@
         this.font = fnt;
     }
 
+    @Override
     public String toString() {
         return this.getClass().getName() +
                 "[font=" + this.getFont() +

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Frame.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Frame.java?view=diff&rev=441863&r1=441862&r2=441863
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Frame.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Frame.java Sat Sep  9 14:56:46 2006
@@ -83,6 +83,7 @@
     protected  class AccessibleAWTFrame extends AccessibleAWTWindow {
         private static final long serialVersionUID = -6172960752956030250L;
 
+        @Override
         public AccessibleRole getAccessibleRole() {
             toolkit.lockAWT();
             try {
@@ -92,6 +93,7 @@
             }
         }
 
+        @Override
         public AccessibleStateSet getAccessibleStateSet() {
             // do nothing(Window does everything already)
             return super.getAccessibleStateSet();
@@ -137,10 +139,12 @@
         }
     }
 
+    @Override
     protected void finalize() throws Throwable {
         // do nothing
     }
 
+    @Override
     public void remove(MenuComponent popup) {
         toolkit.lockAWT();
         try {
@@ -161,6 +165,7 @@
         }
     }
 
+    @Override
     public void addNotify() {
         toolkit.lockAWT();
         try {
@@ -173,6 +178,7 @@
         }
     }
 
+    @Override
     public AccessibleContext getAccessibleContext() {
         toolkit.lockAWT();
         try {
@@ -182,6 +188,7 @@
         }
     }
 
+    @Override
     protected String paramString() {
         toolkit.lockAWT();
         try {
@@ -214,6 +221,7 @@
         return str;
     }
 
+    @Override
     public void removeNotify() {
         toolkit.lockAWT();
         try {
@@ -229,6 +237,7 @@
     /**
      * @deprecated
      */
+    @Deprecated
     public void setCursor(int cursorType) {
         toolkit.lockAWT();
         try {
@@ -241,6 +250,7 @@
     /**
      * @deprecated
      */
+    @Deprecated
     public int getCursorType() {
         toolkit.lockAWT();
         try {
@@ -262,6 +272,7 @@
     /**
      * Returns icon image of this frame. 
      */
+    @Override
     public Image getIconImage() {
         toolkit.lockAWT();
         try {
@@ -289,6 +300,7 @@
         }
     }
 
+    @Override
     public String getTitle() {
         toolkit.lockAWT();
         try {
@@ -298,6 +310,7 @@
         }
     }
 
+    @Override
     public boolean isResizable() {
         toolkit.lockAWT();
         try {
@@ -307,6 +320,7 @@
         }
     }
 
+    @Override
     public boolean isUndecorated() {
         toolkit.lockAWT();
         try {
@@ -451,6 +465,7 @@
         }
     }
 
+    @Override
     public void setResizable(boolean resizable) {
         toolkit.lockAWT();
         try {
@@ -469,10 +484,12 @@
         }
     }
 
+    @Override
     public void setTitle(String title) {
         super.setTitle(title);
     }
 
+    @Override
     public void setUndecorated(boolean undecorated) {
         toolkit.lockAWT();
         try {
@@ -482,6 +499,7 @@
         }
     }
 
+    @Override
     public Insets getInsets() {
         toolkit.lockAWT();
         try {
@@ -495,6 +513,7 @@
         }
     }
 
+    @Override
     void setBounds(int x, int y, int w, int h, int bMask,
                    boolean updateBehavior) {
         boolean widthChanged =  (this.w != w);
@@ -504,17 +523,20 @@
         }
     }
 
+    @Override
     void nativeWindowCreated(NativeWindow win) {
         super.nativeWindowCreated(win);
 
         win.setMaximizedBounds(getMaximizedBounds());
     }
 
+    @Override
     String autoName() {
         int number = toolkit.autoNumber.nextFrame++;
         return ("frame" + Integer.toString(number));
     }
 
+    @Override
     AccessibleContext createAccessibleContext() {
         return new AccessibleAWTFrame();
     }
@@ -538,6 +560,7 @@
         }
     }
 
+    @Override
     void validateMenuBar() {
         if (menuBar != null) {
             menuBar.validate();
@@ -546,24 +569,24 @@
 
 
     static final class AllFrames {
-        private final ArrayList frames = new ArrayList();
+        private final ArrayList<WeakReference<Frame>> frames = new ArrayList<WeakReference<Frame>>();
 
         void add(Frame f) {
-            frames.add(new WeakReference(f));
+            frames.add(new WeakReference<Frame>(f));
         }
 
         Frame[] getFrames() {
-            ArrayList aliveFrames = new ArrayList();
+            ArrayList<Frame> aliveFrames = new ArrayList<Frame>();
 
-            for(Iterator it = frames.iterator(); it.hasNext(); ) {
-                WeakReference ref = (WeakReference)it.next();
+            for(Iterator<WeakReference<Frame>> it = frames.iterator(); it.hasNext(); ) {
+                WeakReference<?> ref = it.next();
                 Frame f = (Frame)ref.get();
                 if (f != null) {
                     aliveFrames.add(f);
                 }
             }
 
-            return (Frame [])aliveFrames.toArray(new Frame[0]);
+            return aliveFrames.toArray(new Frame[0]);
         }
     }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Graphics.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Graphics.java?view=diff&rev=441863&r1=441862&r2=441863
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Graphics.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Graphics.java Sat Sep  9 14:56:46 2006
@@ -101,6 +101,7 @@
         fillPolygon(p.xpoints, p.ypoints, p.npoints);
     }
 
+    @Override
     public void finalize() {
     }
 
@@ -122,6 +123,7 @@
     /**
      * @deprecated Use {@link #getClipBounds()}
      */
+    @Deprecated
     public Rectangle getClipRect() {
         return getClipBounds();
     }
@@ -135,6 +137,7 @@
         return getClipBounds().intersects(new Rectangle(x, y, width, height));
     }
 
+    @Override
     public String toString() {
         // TODO: Think about string representation of Graphics.
         return "Graphics";

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Graphics2D.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Graphics2D.java?view=diff&rev=441863&r1=441862&r2=441863
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Graphics2D.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Graphics2D.java Sat Sep  9 14:56:46 2006
@@ -56,10 +56,12 @@
 
     public abstract void drawString(AttributedCharacterIterator iterator, float x, float y);
 
+    @Override
     public abstract void drawString(AttributedCharacterIterator iterator, int x, int y);
 
     public abstract void drawString(String s, float x, float y);
 
+    @Override
     public abstract void drawString(String str, int x, int y);
 
     public abstract void fill(Shape s);
@@ -110,5 +112,6 @@
 
     public abstract void translate(double tx, double ty);
 
+    @Override
     public abstract void translate(int x, int y);
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/GraphicsConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/GraphicsConfiguration.java?view=diff&rev=441863&r1=441862&r2=441863
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/GraphicsConfiguration.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/GraphicsConfiguration.java Sat Sep  9 14:56:46 2006
@@ -73,16 +73,18 @@
     public VolatileImage createCompatibleVolatileImage(int width, int height,
             ImageCapabilities caps) throws AWTException {
         VolatileImage res = createCompatibleVolatileImage(width, height);
-        if (!res.getCapabilities().equals(caps))
+        if (!res.getCapabilities().equals(caps)) {
             throw new AWTException("Can not create VolatileImage with specified capabilities");
+        }
         return res;
     }
 
     public VolatileImage createCompatibleVolatileImage(int width, int height,
             ImageCapabilities caps, int transparency) throws AWTException {
         VolatileImage res = createCompatibleVolatileImage(width, height, transparency);
-        if (!res.getCapabilities().equals(caps))
+        if (!res.getCapabilities().equals(caps)) {
             throw new AWTException("Can not create VolatileImage with specified capabilities");
+        }
         return res;
     }
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/GraphicsDevice.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/GraphicsDevice.java?view=diff&rev=441863&r1=441862&r2=441863
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/GraphicsDevice.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/GraphicsDevice.java Sat Sep  9 14:56:46 2006
@@ -99,15 +99,17 @@
     }
 
     public void setDisplayMode(DisplayMode dm) {
-        if (!isDisplayChangeSupported())
+        if (!isDisplayChangeSupported()) {
             throw new UnsupportedOperationException("Does not support display mode changes");
+        }
 
         DisplayMode []dms = getDisplayModes();
-        for (int i = 0; i < dms.length; i++)
-            if (dms[i].equals(dm)) {
+        for (DisplayMode element : dms) {
+            if (element.equals(dm)) {
                 displayMode = dm;
                 return;
             }
+        }
         throw new IllegalArgumentException("Unsupported display mode: "+dm);
     }
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/GridBagConstraints.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/GridBagConstraints.java?view=diff&rev=441863&r1=441862&r2=441863
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/GridBagConstraints.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/GridBagConstraints.java Sat Sep  9 14:56:46 2006
@@ -97,6 +97,7 @@
         ipady = 0;
     }
 
+    @Override
     public Object clone() {
         return new GridBagConstraints(gridx, gridy, gridwidth, gridheight,
                 weightx, weighty, anchor, fill, insets, ipadx, ipady);

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/GridBagLayout.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/GridBagLayout.java?view=diff&rev=441863&r1=441862&r2=441863
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/GridBagLayout.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/GridBagLayout.java Sat Sep  9 14:56:46 2006
@@ -48,8 +48,8 @@
 
     private final Toolkit toolkit = Toolkit.getDefaultToolkit();
 
-    // Direct modification is forbiden
-    protected volatile Hashtable comptable;
+    // Direct modification is forbidden
+    protected volatile Hashtable<Component, GridBagConstraints> comptable;
     protected volatile GridBagConstraints defaultConstraints;
     protected volatile GridBagLayoutInfo layoutInfo;
 
@@ -63,7 +63,7 @@
     public GridBagLayout() {
         toolkit.lockAWT();
         try {
-            comptable = new Hashtable();
+            comptable = new Hashtable<Component, GridBagConstraints>();
             defaultConstraints = new GridBagConstraints();
 
             columnWeights = rowWeights = null;
@@ -75,6 +75,7 @@
         }
     }
 
+    @Override
     public String toString() {
         toolkit.lockAWT();
         try {
@@ -149,11 +150,11 @@
     public GridBagConstraints getConstraints(Component comp) {
         toolkit.lockAWT();
         try {
-            GridBagConstraints cons = (GridBagConstraints) comptable.get(comp);
+            GridBagConstraints cons = comptable.get(comp);
 
             if (cons == null) {
                 cons = defaultConstraints;
-                comptable.put(comp, cons.clone());
+                comptable.put(comp, (GridBagConstraints)cons.clone());
             }
 
             return (GridBagConstraints) cons.clone();
@@ -178,7 +179,7 @@
 
             ParentInfo info = getParentInfo(comp.getParent());
             if (info != null) {
-                GridBagConstraints cons = (GridBagConstraints) comptable.get(comp);
+                GridBagConstraints cons = comptable.get(comp);
                 info.allConstraints.remove(info.consTable.get(cons)); //?
                 info.consTable.remove(cons);
             }
@@ -369,10 +370,11 @@
             if (sizeflag == PREFERREDSIZE) {
                 return new GridBagLayoutInfo(parentInfo.grid.lookupPrefWidths(),
                         parentInfo.grid.lookupPrefHeights());
-            } else { //MINSIZE
-                return new GridBagLayoutInfo(parentInfo.grid.lookupMinWidths(),
-                        parentInfo.grid.lookupMinHeights());
-            }
+            } 
+            // MINSIZE
+            return new GridBagLayoutInfo(parentInfo.grid.lookupMinWidths(), parentInfo.grid
+                    .lookupMinHeights());
+            
         } finally {
             toolkit.unlockAWT();
         }
@@ -401,7 +403,7 @@
         toolkit.lockAWT();
         try {
             assert comp != null : "LookupConstraints: attempt to get constraints of null component";
-            GridBagConstraints cons = (GridBagConstraints) comptable.get(comp);
+            GridBagConstraints cons = comptable.get(comp);
 
             if (cons == null) {
                 // if comp is not in the layout, return a copy of default constraints
@@ -557,18 +559,17 @@
             }
 
             return s;
-        } else {
-            float insetFactor = (float) (dispLength - compLength)
-                    / (float) (compSide.start_inset + compSide.end_inset);
-
-            return (dispStart + (int) (compSide.start_inset * insetFactor));
         }
+        float insetFactor = (float) (dispLength - compLength)
+                / (float) (compSide.start_inset + compSide.end_inset);
+
+        return (dispStart + (int) (compSide.start_inset * insetFactor));
     }
 
     private void initHorCompSide(ComponentSide side, GridBagConstraints cons,
             Dimension minSize, Dimension prefSize, ParentInfo info)
     {
-        MixedConstraints mixCons = (MixedConstraints) info.consTable.get(cons);
+        MixedConstraints mixCons = info.consTable.get(cons);
 
         side.gridStart = mixCons.mapped.x;
         side.gridLength = mixCons.mapped.width;
@@ -604,7 +605,7 @@
     private void initVertCompSide(ComponentSide side, GridBagConstraints cons,
             Dimension minSize, Dimension prefSize, ParentInfo info)
     {
-        MixedConstraints mixCons = (MixedConstraints) info.consTable.get(cons);
+        MixedConstraints mixCons = info.consTable.get(cons);
 
         side.gridStart = mixCons.mapped.y;
         side.gridLength = mixCons.mapped.height;
@@ -696,10 +697,10 @@
             Component comp = info.components[i];
 
             info.horCompSides[i] = new ComponentSide();
-            initHorCompSide(info.horCompSides[i], (GridBagConstraints) comptable.get(comp),
+            initHorCompSide(info.horCompSides[i], comptable.get(comp),
                     comp.getMinimumSize(), comp.getPreferredSize(), info);
             info.vertCompSides[i] = new ComponentSide();
-            initVertCompSide(info.vertCompSides[i], (GridBagConstraints) comptable.get(comp),
+            initVertCompSide(info.vertCompSides[i], comptable.get(comp),
                     comp.getMinimumSize(), comp.getPreferredSize(), info);
         }
     }
@@ -709,10 +710,10 @@
         int maxH = 0;
         int i = 0;
 
-        for (Enumeration keys = comptable.keys(); keys.hasMoreElements();) {
-            Component comp = (Component) keys.nextElement();
+        for (Enumeration<Component> keys = comptable.keys(); keys.hasMoreElements();) {
+            Component comp = keys.nextElement();
 
-            GridBagConstraints cons = (GridBagConstraints) comptable.get(comp);
+            GridBagConstraints cons = comptable.get(comp);
 
             if ((comp.getParent() == parent) && comp.isVisible()) {
                 components[i++] = comp;
@@ -732,8 +733,8 @@
     private int getComponentsNumber(Container parent) {
         int componentsNumber = 0;
 
-        for (Enumeration keys = comptable.keys(); keys.hasMoreElements();) {
-            Component comp = (Component) keys.nextElement();
+        for (Enumeration<Component> keys = comptable.keys(); keys.hasMoreElements();) {
+            Component comp = keys.nextElement();
 
             if ((comp.getParent() == parent) && comp.isVisible()) {
                 componentsNumber++;
@@ -770,8 +771,8 @@
 
     private void updateParentInfo(Container parent) {
         Component[] comps = parent.getComponents();
-        for (int i = 0; i < comps.length; i++) {
-            GridBagConstraints gbc = (GridBagConstraints) comptable.get(comps[i]);
+        for (Component element : comps) {
+            GridBagConstraints gbc = comptable.get(element);
             updateParentInfo(parent, gbc);
         }
 
@@ -787,8 +788,6 @@
         private boolean relHComp;
         private int relEndY;
         private int relEndX;
-        private int curYBackup;
-
         public RelativeTranslator(int maxW, int maxH) {
             this.maxW = maxW;
             this.maxH = maxH;
@@ -798,7 +797,6 @@
             relHComp = false;
             relEndY = 0;
             relEndX = 0;
-            curYBackup = -1;
         }
 
         public void translate(ParentInfo info) {
@@ -807,10 +805,10 @@
             applyOrientation(info);
         }
 
-        private void spreadComponents(ArrayList allConstraints) {
+        private void spreadComponents(ArrayList<MixedConstraints> allConstraints) {
             for (int i = 0; i < allConstraints.size(); i++) {
                 MixedConstraints mixCons =
-                    (MixedConstraints) allConstraints.get(i);
+                    allConstraints.get(i);
 
                 assert !((relWComp && (mixCons.initial.width != GridBagConstraints.REMAINDER))
                         || (relHComp && (mixCons.initial.height != GridBagConstraints.REMAINDER)))
@@ -833,7 +831,7 @@
             if (!info.orientation.isLeftToRight()) {
                 for (int i = 0; i < info.allConstraints.size(); i++) {
                     MixedConstraints mixCons =
-                            (MixedConstraints) info.allConstraints.get(i);
+                            info.allConstraints.get(i);
 
                     if (mixCons.relative) {
                         mixCons.mapped.x = maxW - mixCons.mapped.x
@@ -843,19 +841,17 @@
             }
         }
 
-        private int translateVert(MixedConstraints mixCons, int i, ArrayList allConstraints) {
+        private int translateVert(MixedConstraints mixCons, int i, ArrayList<MixedConstraints> allConstraints) {
             int endY;
 
             if (mixCons.initial.y != GridBagConstraints.RELATIVE) {
-                curYBackup = curY;
                 curY = mixCons.initial.y;
             }
             mixCons.mapped.y = curY;
             mixCons.mapped.height = Math.max(mixCons.initial.height, 1);
             if (mixCons.initial.height == GridBagConstraints.REMAINDER) {
                 if (relHComp) {
-                    mixCons.mapped.y = ((MixedConstraints)
-                            allConstraints.get(i - 1)).mapped.y + 1;
+                    mixCons.mapped.y = allConstraints.get(i - 1).mapped.y + 1;
                     relHComp = false;
                 }
                 endY = MAXGRIDSIZE;
@@ -885,8 +881,9 @@
                     if (trueCurY == MAXGRIDSIZE) {
                         throw new RuntimeException("component is out of grid's range");
                     }
-                    if (curX[trueCurY] <= mixCons.initial.x)
+                    if (curX[trueCurY] <= mixCons.initial.x) {
                         break;
+                    }
                 }
                 mixCons.mapped.y = trueCurY;
                 mixCons.mapped.x = mixCons.initial.x;
@@ -927,9 +924,9 @@
 //            }
         }
 
-        private void recalculateRemainders(ArrayList allConstraints) {
+        private void recalculateRemainders(ArrayList<MixedConstraints> allConstraints) {
             for (int i = 0; i < allConstraints.size(); i++) {
-                MixedConstraints mixCons = (MixedConstraints) allConstraints.get(i);
+                MixedConstraints mixCons = allConstraints.get(i);
 
                 if (mixCons.initial.width == GridBagConstraints.REMAINDER) {
                     mixCons.mapped.width = maxW - mixCons.mapped.x;
@@ -938,7 +935,7 @@
                     if (reserve > 0) {
                         mixCons.mapped.width += reserve;
                         if ((i + 1) < allConstraints.size()) {
-                            ((MixedConstraints) allConstraints.get(i + 1)).mapped.x += reserve;
+                            allConstraints.get(i + 1).mapped.x += reserve;
                         }
                     }
                 }
@@ -949,7 +946,7 @@
                     int reserve = maxH - mixCons.mapped.y - 2;
                     mixCons.mapped.height += reserve;
                     if ((i + 1) < allConstraints.size()) {
-                        ((MixedConstraints) allConstraints.get(i + 1)).mapped.y +=
+                        allConstraints.get(i + 1).mapped.y +=
                             reserve;
                     }
                 }
@@ -1228,25 +1225,25 @@
             }
 
             private void spreadComponents(ComponentSide compSides[]) {
-                for (int i = 0; i < compSides.length; i++) {
-                    if (compSides[i].gridLength == 1) {
-                        int insets = compSides[i].start_inset
-                                + compSides[i].end_inset;
-
-                        spreadUnicellularComponent(compSides[i].gridStart,
-                                compSides[i].minLength + insets, compSides[i].prefLength + insets,
-                                compSides[i].weight);
+                for (ComponentSide element : compSides) {
+                    if (element.gridLength == 1) {
+                        int insets = element.start_inset
+                                + element.end_inset;
+
+                        spreadUnicellularComponent(element.gridStart,
+                                element.minLength + insets, element.prefLength + insets,
+                                element.weight);
                     }
                 }
 
-                for (int i = 0; i < compSides.length; i++) {
-                    if (compSides[i].gridLength > 1) {
-                        int insets = compSides[i].start_inset
-                                + compSides[i].end_inset;
-
-                        spreadMulticellularComponent(compSides[i].gridStart, compSides[i].gridLength,
-                                compSides[i].minLength + insets, compSides[i].prefLength + insets,
-                                compSides[i].weight);
+                for (ComponentSide element : compSides) {
+                    if (element.gridLength > 1) {
+                        int insets = element.start_inset
+                                + element.end_inset;
+
+                        spreadMulticellularComponent(element.gridStart, element.gridLength,
+                                element.minLength + insets, element.prefLength + insets,
+                                element.weight);
                     }
                 }
             }
@@ -1365,24 +1362,6 @@
                 }
             }
 
-            private void divideExtraLength(Segment clientSide) {
-                int extraL = prefLength - clientSide.length;
-                int sharedExtraL = 0;
-                int accumL = 0;
-
-                for (int i = 0; i < MAXGRIDSIZE; i++) {
-                    if (weights[i] > 0.) {
-                        accumL += prefLengths[i];
-                        int curExtraL = (int) (extraL * ((float) accumL / (float) (prefLength - weightlessPrefLength)))
-                                - sharedExtraL;
-                        lengths[i] = prefLengths[i] - curExtraL;
-                        sharedExtraL += curExtraL;
-                    } else {
-                        lengths[i] = prefLengths[i];
-                    }
-                }
-            }
-
             private int centerSide(Segment clientSide) {
                 for (int i = 0; i < MAXGRIDSIZE; i++) {
                     lengths[i] = prefLengths[i];
@@ -1414,27 +1393,6 @@
                 }
             }
 
-            private void divideSufficientLength(Segment clientSide) {
-                int sharedL = 0;
-                int accumMinL = 0;
-                int accumPrefL = 0;
-
-                for (int i = 0; i < MAXGRIDSIZE; i++) {
-                    if (weights[i] > 0.) {
-                        lengths[i] = 0;
-                    } else {
-                        accumMinL += minLengths[i];
-                        accumPrefL += prefLengths[i];
-                        int curL = accumMinL
-                                + (int) ((clientSide.length - weightlessMinLength) *
-                                    ((float) (accumPrefL - accumMinL) / (float) (weightlessPrefLength - weightlessMinLength)))
-                                - sharedL;
-                        lengths[i] = curL;
-                        sharedL += curL;
-                    }
-                }
-            }
-
             private void calculateCoordinates(int start) {
                 coordinates[0] = start;
 
@@ -1477,8 +1435,8 @@
 
     private class ParentInfo {
 
-        final HashMap consTable;            // Components' constraints to relative constraints
-        final ArrayList allConstraints;     // Only mapped rectangle is a part of cache
+        final HashMap<GridBagConstraints, MixedConstraints> consTable;            // Components' constraints to relative constraints
+        final ArrayList<MixedConstraints> allConstraints;     // Only mapped rectangle is a part of cache
 
         final Grid grid;
 
@@ -1492,8 +1450,8 @@
 
         ParentInfo() {
             valid = false;
-            consTable = new HashMap();
-            allConstraints = new ArrayList();
+            consTable = new HashMap<GridBagConstraints, MixedConstraints>();
+            allConstraints = new ArrayList<MixedConstraints>();
             grid = new Grid();
             orientation = ComponentOrientation.LEFT_TO_RIGHT;
             horCompSides = vertCompSides = null;

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/GridLayout.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/GridLayout.java?view=diff&rev=441863&r1=441862&r2=441863
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/GridLayout.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/GridLayout.java Sat Sep  9 14:56:46 2006
@@ -20,7 +20,6 @@
 package java.awt;
 
 import java.io.Serializable;
-import java.util.LinkedList;
 
 public class GridLayout implements LayoutManager, Serializable {
     private static final long serialVersionUID = -7411804673224730901L;   
@@ -74,6 +73,7 @@
         }
     }
 
+    @Override
     public String toString() {
         /* The format is based on 1.5 release behavior 
          * which can be revealed by the following code:
@@ -317,10 +317,10 @@
         int maxWidth = 0;
         int maxHeight = 0;
 
-        for (int i = 0; i < components.length; i++) {
+        for (Component element : components) {
             Dimension compSize = (preferred ?
-                    components[i].getPreferredSize() :
-                    components[i].getMinimumSize());
+                    element.getPreferredSize() :
+                    element.getMinimumSize());
 
             maxWidth = Math.max(maxWidth, compSize.width);
             maxHeight = Math.max(maxHeight, compSize.height);

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Image.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Image.java?view=diff&rev=441863&r1=441862&r2=441863
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Image.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Image.java Sat Sep  9 14:56:46 2006
@@ -50,10 +50,11 @@
 
     public Image getScaledInstance(int width, int height, int hints) {
         ImageFilter filter;
-        if ((hints & (SCALE_SMOOTH | SCALE_AREA_AVERAGING)) != 0)
+        if ((hints & (SCALE_SMOOTH | SCALE_AREA_AVERAGING)) != 0) {
             filter = new AreaAveragingScaleFilter(width, height);
-        else
+        } else {
             filter = new ReplicateScaleFilter(width, height);
+        }
         ImageProducer producer = new FilteredImageSource(getSource(), filter);
         return Toolkit.getDefaultToolkit().createImage(producer);
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/ImageCapabilities.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/ImageCapabilities.java?view=diff&rev=441863&r1=441862&r2=441863
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/ImageCapabilities.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/ImageCapabilities.java Sat Sep  9 14:56:46 2006
@@ -30,6 +30,7 @@
         this.accelerated = accelerated;
     }
 
+    @Override
     public Object clone() {
         return new ImageCapabilities(accelerated);
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Insets.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Insets.java?view=diff&rev=441863&r1=441862&r2=441863
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Insets.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Insets.java Sat Sep  9 14:56:46 2006
@@ -40,6 +40,7 @@
         setValues(top, left, bottom, right);
     }
 
+    @Override
     public int hashCode() {
         int hashCode = HashCode.EMPTY_HASH_CODE;
         hashCode = HashCode.combine(hashCode, top);
@@ -49,10 +50,12 @@
         return hashCode;
     }
 
+    @Override
     public Object clone() {
         return new Insets(top, left, bottom, right);
     }
 
+    @Override
     public boolean equals(Object o) {
         if (o == this) {
             return true;
@@ -65,6 +68,7 @@
         return false;
     }
 
+    @Override
     public String toString() {
         /* The format is based on 1.5 release behavior 
          * which can be revealed by the following code:

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/JobAttributes.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/JobAttributes.java?view=diff&rev=441863&r1=441862&r2=441863
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/JobAttributes.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/JobAttributes.java Sat Sep  9 14:56:46 2006
@@ -41,10 +41,6 @@
 
     /* section of the nested classes */
     public static final class DefaultSelectionType {
-        private final int value;
-        private final String name;
-        private static final String names[] = {"ALL", "RANGE", "SELECTION"};
-
         public static final DefaultSelectionType ALL
                                     = new DefaultSelectionType(0);
         public static final DefaultSelectionType RANGE
@@ -54,8 +50,6 @@
 
         private DefaultSelectionType(int i){
             super();
-            value = i;
-            name = names[i];
         }
 
         private DefaultSelectionType(){
@@ -64,17 +58,11 @@
     }
 
     public static final class DestinationType {
-        private final int value;
-        private final String name;
-        private static final String names[] = {"FILE", "PRINTER"};
-
         public static final DestinationType FILE = new DestinationType(0);
         public static final DestinationType PRINTER = new DestinationType(1);
 
         private DestinationType(int i) {
             super();
-            value = i;
-            name = names[i];
         }
         private DestinationType() {
             this(0);
@@ -82,18 +70,12 @@
     }
 
     public static final class DialogType{
-        private final int value;
-        private final String name;
-        private static final String names[] = {"COMMON", "NATIVE", "NONE"};
-
         public static final DialogType COMMON = new DialogType(0);
         public static final DialogType NATIVE = new DialogType(1);
         public static final DialogType NONE = new DialogType(2);
 
         private DialogType(int i){
             super();
-            value = i;
-            name = names[i];
         }
         private DialogType(){
             this(0);
@@ -102,12 +84,6 @@
     }
 
     public static final class MultipleDocumentHandlingType {
-        private final int value;
-        private final String name;
-        private static final String names[]
-                 = {"SEPARATE_DOCUMENTS_COLLATED_COPIES",
-                    "SEPARATE_DOCUMENTS_UNCOLLATED_COPIES"};
-
         public static final MultipleDocumentHandlingType
                             SEPARATE_DOCUMENTS_COLLATED_COPIES
                                 = new MultipleDocumentHandlingType(0);
@@ -117,8 +93,6 @@
 
         private MultipleDocumentHandlingType(int i){
             super();
-            value = i;
-            name = names[i];
         }
 
         private MultipleDocumentHandlingType(){
@@ -127,19 +101,12 @@
     }
 
     public static final class SidesType{
-        private final int value;
-        private final String name;
-        private static final String names[] = {"ONE_SIDED",
-                "TWO_SIDED_LONG_EDGE",  "TWO_SIDED_SHORT_EDGE"};
-
         public static final SidesType ONE_SIDED = new SidesType(0);
         public static final SidesType TWO_SIDED_LONG_EDGE  = new SidesType(1);
         public static final SidesType TWO_SIDED_SHORT_EDGE = new SidesType(2);
 
         private SidesType(int i){
             super();
-            value = i;
-            name = names[i];
         }
 
         private SidesType(){
@@ -208,9 +175,8 @@
     public void setCopies(int copies) {
         if(copies <= 0) {
             throw new IllegalArgumentException("Invalid number of copies");
-        } else {
-            this.copies = copies;
         }
+        this.copies = copies;
     }
 
     public int getMaxPage(){
@@ -220,9 +186,8 @@
     public void setMaxPage(int imaxPage) {
         if (imaxPage <= 0 || imaxPage < minPage) {
             throw new IllegalArgumentException("Invalid value for maxPage");
-        } else {
-            maxPage = imaxPage;
         }
+        maxPage = imaxPage;
     }
 
     public int getMinPage(){
@@ -232,18 +197,20 @@
     public void setMinPage(int iminPage) {
         if (iminPage <= 0 || iminPage > maxPage) {
             throw new IllegalArgumentException("Invalid value for minPage");
-        } else {
-            minPage = iminPage;
         }
+        minPage = iminPage;
     }
 
     public int getFromPage() {
-        if (fromPage != 0)
+        if (fromPage != 0) {
             return fromPage;
-        if (toPage != 0)
+        }
+        if (toPage != 0) {
             return getMinPage();
-        if (pageRanges != null)
+        }
+        if (pageRanges != null) {
             return firstPage;
+        }
         return getMinPage();
     }
 
@@ -251,18 +218,20 @@
         if (ifromPage <= 0 || ifromPage > toPage
                 || ifromPage < minPage || ifromPage > maxPage) {
             throw new IllegalArgumentException("Invalid value for fromPage");
-        } else {
-            fromPage = ifromPage;
         }
+        fromPage = ifromPage;
     }
 
     public int getToPage() {
-        if (toPage != 0)
+        if (toPage != 0) {
             return toPage;
-        if (fromPage != 0)
+        }
+        if (fromPage != 0) {
             return fromPage;
-        if (pageRanges != null)
+        }
+        if (pageRanges != null) {
             return lastPage;
+        }
         return getMinPage();
     }
 
@@ -271,9 +240,8 @@
                 || itoPage < minPage
                 || itoPage > maxPage) {
             throw new IllegalArgumentException("Invalid value for toPage");
-        } else {
-            toPage = itoPage;
         }
+        toPage = itoPage;
     }
 
     public String getPrinter(){
@@ -320,21 +288,25 @@
         int n2 = 0;
         int prl = pr.length;
 
-        if(pr == null)
+        if(pr == null) {
             throw new IllegalArgumentException(msg);
+        }
 
         for(int k = 0; k < prl; k++) {
             if(pr[k] == null || pr[k].length != 2
-                    || pr[k][0] <= n2 || pr[k][1] < pr[k][0])
+                    || pr[k][0] <= n2 || pr[k][1] < pr[k][0]) {
                 throw new IllegalArgumentException(msg);
+            }
 
             n2 = pr[k][1];
-            if(n1 == 0)
+            if(n1 == 0) {
                 n1 = pr[k][0];
+            }
         }
 
-        if(n1 < minPage || n2 > maxPage)
+        if(n1 < minPage || n2 > maxPage) {
             throw new IllegalArgumentException(msg);
+        }
 
         pageRanges = new int[prl][2];
 
@@ -353,9 +325,8 @@
     public void setDestination(JobAttributes.DestinationType destination) {
         if(destination == null){
             throw new IllegalArgumentException("Invalid value for destination");
-        } else {
-            this.destination = destination;
         }
+        this.destination = destination;
     }
 
     public DialogType getDialog() {
@@ -365,9 +336,8 @@
     public void setDialog(JobAttributes.DialogType dialog) {
         if(dialog == null) {
             throw new IllegalArgumentException("Invalid value for dialog");
-        } else {
-            this.dialog = dialog;
         }
+        this.dialog = dialog;
     }
 
 
@@ -380,9 +350,8 @@
         if (a_defaultSelection == null) {
             throw new IllegalArgumentException(
                     "Invalid value for defaultSelection");
-        } else {
-            this.defaultSelection = a_defaultSelection;
         }
+        this.defaultSelection = a_defaultSelection;
     }
 
     public JobAttributes.MultipleDocumentHandlingType
@@ -396,9 +365,8 @@
         if(multipleDocumentHandling == null) {
             throw new IllegalArgumentException
                         ("Invalid value for multipleDocumentHandling");
-        } else {
-            multiDocHandling = multipleDocumentHandling;
         }
+        multiDocHandling = multipleDocumentHandling;
     }
 
     public JobAttributes.SidesType getSides(){
@@ -410,9 +378,8 @@
         if(sides == null) {
             throw new IllegalArgumentException
                         ("Invalid value for attribute sides");
-        } else {
-            this.sides = sides;
         }
+        this.sides = sides;
     }
 
     public void set(JobAttributes obj) {
@@ -437,6 +404,7 @@
         }
     }
 
+    @Override
     public String toString(){
         /* The format is based on 1.5 release behavior 
          * which can be revealed by the following code:
@@ -465,16 +433,19 @@
         return s;
     }
 
+    @Override
     public int hashCode() {
         int hash = this.toString().hashCode();
         return hash;
     }
 
+    @Override
     public Object clone() {
         JobAttributes ja = new JobAttributes(this);
-        return (Object)ja;
+        return ja;
     }
 
+    @Override
     public boolean equals(Object obj){
         if(!(obj instanceof JobAttributes)){
             return false;
@@ -482,11 +453,13 @@
         JobAttributes ja = (JobAttributes)obj;
 
         if(fileName == null){
-            if(ja.fileName != null)
+            if(ja.fileName != null) {
                 return false;
+            }
         } else {
-            if(!fileName.equals(ja.fileName))
+            if(!fileName.equals(ja.fileName)) {
                 return false;
+            }
         }
 
         if(printer == null) {
@@ -500,8 +473,9 @@
         }
 
         if(pageRanges == null) {
-            if(ja.pageRanges != null)
+            if(ja.pageRanges != null) {
                 return false;
+            }
         } else {
             if(ja.pageRanges == null){
                 return false;
@@ -509,9 +483,9 @@
             if(pageRanges.length != ja.pageRanges.length){
                 return false;
             }
-            for(int i = 0; i < pageRanges.length; i++){
-                if(pageRanges[i][0] != ja.pageRanges[i][0]
-                || pageRanges[i][1] != ja.pageRanges[i][1]){
+            for (int[] element : pageRanges) {
+                if(element[0] != element[0]
+                || element[1] != element[1]){
                     return false;
                 }
             }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/KeyboardFocusManager.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/KeyboardFocusManager.java?view=diff&rev=441863&r1=441862&r2=441863
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/KeyboardFocusManager.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/KeyboardFocusManager.java Sat Sep  9 14:56:46 2006
@@ -56,8 +56,8 @@
                                            UP_CYCLE_TRAVERSAL_KEYS,
                                            DOWN_CYCLE_TRAVERSAL_KEYS };
 
-    private HashMap/*<int, Set<AWTKeyStroke>>*/ defaultFocusTraversalKeys =
-        new HashMap();
+    private Map<Integer, Set<AWTKeyStroke>> defaultFocusTraversalKeys =
+        new HashMap<Integer, Set<AWTKeyStroke>>();
 
     private FocusTraversalPolicy defaultFocusTraversalPolicy =
         new DefaultFocusTraversalPolicy();
@@ -96,8 +96,8 @@
 //    private final Toolkit toolkit = Toolkit.getDefaultToolkit();
 
     public KeyboardFocusManager() {
-        for (int i = 0; i < contTraversalIDs.length; i++) {
-            defaultFocusTraversalKeys.put(new Integer(contTraversalIDs[i]),
+        for (int element : contTraversalIDs) {
+            defaultFocusTraversalKeys.put(new Integer(element),
                     null);
         }
     }
@@ -202,10 +202,10 @@
         }
     }
 
-    public Set getDefaultFocusTraversalKeys(int id) {
-        Integer kId = new Integer(id);
+    public Set<?> getDefaultFocusTraversalKeys(int id) {
+        Integer kId = Integer.valueOf(id);
         checkTraversalKeysID(defaultFocusTraversalKeys, kId);
-        return (Set) defaultFocusTraversalKeys.get(kId);
+        return defaultFocusTraversalKeys.get(kId);
     }
 
     public FocusTraversalPolicy getDefaultFocusTraversalPolicy() {
@@ -272,11 +272,11 @@
         return permanentFocusOwner;
     }
 
-    protected List getKeyEventDispatchers() {
+    protected List<?> getKeyEventDispatchers() {
         return keyEventDispatchers.getUserListeners();
     }
 
-    protected List getKeyEventPostProcessors() {
+    protected List<?> getKeyEventPostProcessors() {
         return keyEventPostProcessors.getUserListeners();
     }
 
@@ -367,9 +367,9 @@
         newManager.firePropertyChange(propName, Boolean.FALSE, Boolean.TRUE);
     }
 
-    public void setDefaultFocusTraversalKeys(int id, Set keystrokes) {
-        Integer kId = new Integer(id);
-        Set oldKeyStrokes = (Set) defaultFocusTraversalKeys.get(kId);
+    public void setDefaultFocusTraversalKeys(int id, Set<AWTKeyStroke> keystrokes) {
+        Integer kId = Integer.valueOf(id);
+        Set<AWTKeyStroke> oldKeyStrokes = defaultFocusTraversalKeys.get(kId);
         checkTraversalKeysID(defaultFocusTraversalKeys, kId);
         checkKeyStrokes(contTraversalIDs, defaultFocusTraversalKeys, kId,
                         keystrokes);
@@ -406,7 +406,7 @@
     protected void setGlobalActiveWindow(Window activeWindow) {
         String propName = "activeWindow";
         // fire Vetoable change[before it is reflected in Java focus state],
-        // catch vetoe exception
+        // catch veto exception
         try {
             fireVetoableChange(propName, KeyboardFocusManager.activeWindow,
                                activeWindow);
@@ -433,7 +433,7 @@
         String propName = "focusOwner";
 
         // fire Vetoable change[before it is reflected in Java focus state],
-        // catch vetoe exception
+        // catch veto exception
 
         try {
             fireVetoableChange(propName, KeyboardFocusManager.focusOwner,
@@ -469,7 +469,7 @@
         String propName = "focusedWindow";
 
         // fire Vetoable change[before it is reflected in Java focus state],
-        // catch vetoe exception
+        // catch veto exception
 
         try {
             fireVetoableChange(propName, KeyboardFocusManager.focusedWindow,
@@ -495,7 +495,7 @@
         String propName = "permanentFocusOwner";
 
         // fire Vetoable change[before it is reflected in Java focus state],
-        // catch vetoe exception
+        // catch veto exception
 
         try {
             fireVetoableChange(propName, KeyboardFocusManager.permanentFocusOwner,
@@ -523,20 +523,20 @@
 
     public abstract void upFocusCycle(Component a0);
 
-    static void checkTraversalKeysID(Map keysMap, Integer id) {
+    static void checkTraversalKeysID(Map<?, ?> keysMap, Integer id) {
         if (!keysMap.containsKey(id)) {
             throw new IllegalArgumentException(
                     "invalid focus traversal key identifier");
         }
     }
 
-    static void checkKeyStrokes(int[] traversalIDs, Map traversalKeys,
-                                Integer kId, Set keystrokes) {
+    static void checkKeyStrokes(int[] traversalIDs, Map<Integer, Set<AWTKeyStroke>> traversalKeys,
+                                Integer kId, Set<AWTKeyStroke> keystrokes) {
         if (keystrokes == null) {
             return;
         }
 
-        Iterator i = keystrokes.iterator();
+        Iterator<AWTKeyStroke> i = keystrokes.iterator();
         while (i.hasNext()) {
             Object o = i.next();
             AWTKeyStroke key = o instanceof AWTKeyStroke ? (AWTKeyStroke) o
@@ -555,8 +555,8 @@
             // throw exception if such a KeyStroke is already present for
             // another id
 
-            for (int k = 0; k < traversalIDs.length; k++) {
-                Integer theID = new Integer(traversalIDs[k]);
+            for (int element : traversalIDs) {
+                Integer theID = new Integer(element);
                 Object val = traversalKeys.get(theID);
                 if ((!theID.equals(kId)) &&
                     (val instanceof Set) &&
@@ -658,7 +658,9 @@
     Frame getOwningFrame(Window w) {
         Window wnd;
         for (wnd = w; (wnd != null) && !(wnd instanceof Frame);
-             wnd = wnd.getOwner());
+             wnd = wnd.getOwner()) {
+            ;
+        }
         return (Frame)wnd;
     }
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Label.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Label.java?view=diff&rev=441863&r1=441862&r2=441863
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Label.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Label.java Sat Sep  9 14:56:46 2006
@@ -39,10 +39,12 @@
             // define default constructor explicitly just to make it public
         }
 
+        @Override
         public String getAccessibleName() {
             return Label.this.getText();
         }
 
+        @Override
         public AccessibleRole getAccessibleRole() {
             return AccessibleRole.LABEL;
         }
@@ -69,6 +71,7 @@
             return alignment;
         }
 
+        @Override
         public void calculate() {
             toolkit.theme.calculateLabel(state);
         }
@@ -117,6 +120,7 @@
         }
     }
 
+    @Override
     protected String paramString() {
         /* The format is based on 1.5 release behavior 
          * which can be revealed by the following code:
@@ -145,6 +149,7 @@
         return alignStr;
     }
 
+    @Override
     public void addNotify() {
         toolkit.lockAWT();
         try {
@@ -154,6 +159,7 @@
         }
     }
 
+    @Override
     public AccessibleContext getAccessibleContext() {
         toolkit.lockAWT();
         try {
@@ -218,32 +224,39 @@
         }
     }
 
+    @Override
     void prepaint(Graphics g) {
         toolkit.theme.drawLabel(g, state);
     }
 
+    @Override
     boolean isPrepainter() {
         return true;
     }
 
+    @Override
     String autoName() {
         return ("label" + toolkit.autoNumber.nextLabel++);
     }
 
+    @Override
     void validateImpl() {
         super.validateImpl();
         toolkit.theme.calculateLabel(state);
     }
 
+    @Override
     void setEnabledImpl(boolean value) {
         super.setEnabledImpl(value);
         repaint();
     }
 
+    @Override
     ComponentBehavior createBehavior() {
         return new HWBehavior(this);
     }
 
+    @Override
     Dimension getDefaultMinimumSize() {
         if (getFont() == null) {
             return new Dimension(0, 0);
@@ -251,14 +264,17 @@
         return state.getDefaultMinimumSize();
     }
 
+    @Override
     void resetDefaultSize() {
         state.reset();
     }
 
+    @Override
     boolean hasDefaultFont() {
         return true;
     }
 
+    @Override
     AccessibleContext createAccessibleContext() {
         return new AccessibleAWTLabel();
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/List.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/List.java?view=diff&rev=441863&r1=441862&r2=441863
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/List.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/List.java Sat Sep  9 14:56:46 2006
@@ -55,15 +55,15 @@
     private final AWTListenerList actionListeners = new AWTListenerList(this);
     private final AWTListenerList itemListeners = new AWTListenerList(this);
 
-    private int rows = 0;
+    private int rows;
 
-    private boolean multipleMode = false;
+    private boolean multipleMode;
 
-    private ArrayList items = new ArrayList();
-    private ArrayList selection = new ArrayList();
+    private ArrayList<String> items = new ArrayList<String>();
+    private ArrayList<Integer> selection = new ArrayList<Integer>();
 
     private int visibleIndex = -1;
-    private int currentIndex = 0; // "focused" item index
+    private int currentIndex; // "focused" item index
 
     private final ListStateController stateController;
     private final ListScrollable scrollable;
@@ -97,34 +97,42 @@
                 return this;
             }
 
+            @Override
             public void addFocusListener(FocusListener l) {
                 // do nothing
             }
 
+            @Override
             public boolean contains(Point p) {
                 return false;
             }
 
+            @Override
             public Accessible getAccessibleAt(Point p) {
                 return null;
             }
 
+            @Override
             public Accessible getAccessibleChild(int i) {
                 return null;
             }
 
+            @Override
             public int getAccessibleChildrenCount() {
                 return 0;
             }
 
+            @Override
             public int getAccessibleIndexInParent() {
                 return accessibleIndexInParent;
             }
 
+            @Override
             public AccessibleRole getAccessibleRole() {
                 return AccessibleRole.LIST_ITEM;
             }
 
+            @Override
             public AccessibleStateSet getAccessibleStateSet() {
                 AccessibleStateSet aStateSet = super.getAccessibleStateSet();
                 if (isAccessibleChildSelected(accessibleIndexInParent)) {
@@ -133,108 +141,133 @@
                 return aStateSet;
             }
 
+            @Override
             public Color getBackground() {
                 return parent.getBackground();
             }
 
+            @Override
             public Rectangle getBounds() {
                 // return null
                 return null;
             }
 
+            @Override
             public Cursor getCursor() {
                 return parent.getCursor();
             }
 
+            @Override
             public Font getFont() {
                 return parent.getFont();
             }
 
+            @Override
             public FontMetrics getFontMetrics(Font f) {
                 return parent.getFontMetrics(f);
             }
 
+            @Override
             public Color getForeground() {
                 return parent.getForeground();
             }
 
+            @Override
             public Locale getLocale() throws IllegalComponentStateException {
                 return parent.getLocale();
             }
 
+            @Override
             public Point getLocation() {
                 // just return null
                 return null;
             }
 
+            @Override
             public Point getLocationOnScreen() {
                 // just return null
                 return null;
             }
 
+            @Override
             public Dimension getSize() {
                 // just return null
                 return null;
             }
 
+            @Override
             public boolean isEnabled() {
                 return parent.isEnabled();
             }
 
+            @Override
             public boolean isFocusTraversable() {
                 return false;
             }
 
+            @Override
             public boolean isShowing() {
                 // always invisible
                 return false;
             }
 
+            @Override
             public boolean isVisible() {
                 // always invisible
                 return false;
             }
 
+            @Override
             public void removeFocusListener(FocusListener l) {
                 // do nothing
             }
 
+            @Override
             public void requestFocus() {
                 // do nothing
             }
 
+            @Override
             public void setBackground(Color color) {
                 parent.setBackground(color);
             }
 
+            @Override
             public void setBounds(Rectangle r) {
                 // do nothing
             }
 
+            @Override
             public void setCursor(Cursor cursor) {
                 parent.setCursor(cursor);
             }
 
+            @Override
             public void setEnabled(boolean enabled) {
                 parent.setEnabled(enabled);
             }
 
+            @Override
             public void setFont(Font f) {
                 parent.setFont(f);
             }
 
+            @Override
             public void setForeground(Color color) {
                 parent.setForeground(color);
             }
 
+            @Override
             public void setLocation(Point p) {
                 // do nothing
             }
 
+            @Override
             public void setSize(Dimension size) {
                 // do nothing
             }
 
+            @Override
             public void setVisible(boolean visible) {
                 parent.setVisible(visible);
             }
@@ -302,6 +335,7 @@
             }
         }
 
+        @Override
         public AccessibleSelection getAccessibleSelection() {
             return this;
         }
@@ -316,11 +350,13 @@
 
         }
 
+        @Override
         public Accessible getAccessibleAt(Point p) {
             // no specific implementation yet
             return super.getAccessibleAt(p);
         }
 
+        @Override
         public Accessible getAccessibleChild(int i) {
             toolkit.lockAWT();
             try {
@@ -334,14 +370,17 @@
             }
         }
 
+        @Override
         public int getAccessibleChildrenCount() {
             return getItemCount();
         }
 
+        @Override
         public AccessibleRole getAccessibleRole() {
             return AccessibleRole.LIST;
         }
 
+        @Override
         public AccessibleStateSet getAccessibleStateSet() {
             toolkit.lockAWT();
             try {
@@ -747,7 +786,7 @@
             // decrease all selected indices greater than position
             // by 1, because items list is shifted to the left
             for (int i=0; i < selection.size(); i++) {
-                Integer idx = (Integer) selection.get(i);
+                Integer idx = selection.get(i);
                 int val = idx.intValue();
                 if (val > position) {
                     selection.set(i, new Integer(val - 1));
@@ -765,6 +804,7 @@
     /**
      * @deprecated
      */
+    @Deprecated
     public void clear() {
         toolkit.lockAWT();
         try {
@@ -788,6 +828,7 @@
         }
     }
 
+    @Override
     protected String paramString() {
         toolkit.lockAWT();
         try {
@@ -801,12 +842,13 @@
     public String getItem(int index) {
         toolkit.lockAWT();
         try {
-            return (String)items.get(index);
+            return items.get(index);
         } finally {
             toolkit.unlockAWT();
         }
     }
 
+    @Override
     public void addNotify() {
         toolkit.lockAWT();
         try {
@@ -818,6 +860,7 @@
         }
     }
 
+    @Override
     public AccessibleContext getAccessibleContext() {
         toolkit.lockAWT();
         try {
@@ -827,6 +870,7 @@
         }
     }
 
+    @Override
     public Dimension getMinimumSize() {
         toolkit.lockAWT();
         try {
@@ -883,6 +927,7 @@
         }
     }
 
+    @Override
     public Dimension getPreferredSize() {
         toolkit.lockAWT();
         try {
@@ -895,6 +940,9 @@
     /**
      * @deprecated
      */
+    @SuppressWarnings("deprecation")
+    @Deprecated
+    @Override
     public Dimension minimumSize() {
         toolkit.lockAWT();
         try {
@@ -910,6 +958,7 @@
     /**
      * @deprecated
      */
+    @Deprecated
     public Dimension minimumSize(int rows) {
         toolkit.lockAWT();
         try {
@@ -922,6 +971,7 @@
     /**
      * @deprecated
      */
+    @Deprecated
     public Dimension preferredSize(int rows) {
         toolkit.lockAWT();
         try {
@@ -934,6 +984,9 @@
     /**
      * @deprecated
      */
+    @SuppressWarnings("deprecation")
+    @Deprecated
+    @Override
     public Dimension preferredSize() {
         toolkit.lockAWT();
         try {
@@ -946,6 +999,7 @@
         }
     }
 
+    @Override
     public void removeNotify() {
         toolkit.lockAWT();
         try {
@@ -959,6 +1013,7 @@
     /**
      * @deprecated
      */
+    @Deprecated
     public void addItem(String item) {
         toolkit.lockAWT();
         try {
@@ -972,6 +1027,7 @@
     /**
      * @deprecated
      */
+    @Deprecated
     public void addItem(String item, int index) {
         toolkit.lockAWT();
         try {
@@ -985,6 +1041,7 @@
     /**
      * @deprecated
      */
+    @Deprecated
     public boolean allowsMultipleSelections() {
         toolkit.lockAWT();
         try {
@@ -997,6 +1054,7 @@
     /**
      * @deprecated
      */
+    @Deprecated
     public int countItems() {
         toolkit.lockAWT();
         try {
@@ -1009,6 +1067,7 @@
     /**
      * @deprecated
      */
+    @Deprecated
     public void delItem(int position) {
         toolkit.lockAWT();
         try {
@@ -1021,6 +1080,7 @@
     /**
      * @deprecated
      */
+    @Deprecated
     public void delItems(int start, int end) {
         toolkit.lockAWT();
         try {
@@ -1080,7 +1140,7 @@
         try {
             int selectedIndex = -1;
             if (selection.size() == 1) {
-                selectedIndex = ((Integer)selection.get(0)).intValue();
+                selectedIndex = selection.get(0).intValue();
             }
             return selectedIndex;
         } finally {
@@ -1110,7 +1170,7 @@
             if (selectedIndex < 0) {
                 return null;
             }
-            return (String)items.get(selectedIndex);
+            return items.get(selectedIndex);
         } finally {
             toolkit.unlockAWT();
         }
@@ -1124,7 +1184,7 @@
             Integer[] selArr = new Integer[size];
             selection.toArray(selArr);
             for(int i = 0; i < selItemsArr.length; i++) {
-                selItemsArr[i] = (String)items.get(selArr[i].intValue());
+                selItemsArr[i] = items.get(selArr[i].intValue());
             }
             return selItemsArr;
         } finally {
@@ -1171,6 +1231,7 @@
     /**
      * @deprecated
      */
+    @Deprecated
     public boolean isSelected(int pos) {
         toolkit.lockAWT();
         try {
@@ -1260,6 +1321,7 @@
     /**
      * @deprecated
      */
+    @Deprecated
     public void setMultipleSelections(boolean mm) {
         toolkit.lockAWT();
         try {
@@ -1269,7 +1331,8 @@
         }
     }
 
-    public EventListener[] getListeners(Class listenerType) {
+    @Override
+    public EventListener[] getListeners(Class<?> listenerType) {
         if (ActionListener.class.isAssignableFrom(listenerType)) {
             return getActionListeners();
         } else if (ItemListener.class.isAssignableFrom(listenerType)) {
@@ -1305,6 +1368,7 @@
         itemListeners.getUserListeners(new ItemListener[0]);
     }
 
+    @Override
     protected void processEvent(AWTEvent e) {
         long eventMask = toolkit.eventTypeLookup.getEventMask(e);
 
@@ -1318,7 +1382,7 @@
     }
 
     protected void processItemEvent(ItemEvent e) {
-        for (Iterator i = itemListeners.getUserIterator(); i.hasNext();) {
+        for (Iterator<?> i = itemListeners.getUserIterator(); i.hasNext();) {
             ItemListener listener = (ItemListener) i.next();
 
             switch (e.getID()) {
@@ -1330,7 +1394,7 @@
     }
 
     protected void processActionEvent(ActionEvent e) {
-        for (Iterator i = actionListeners.getUserIterator(); i.hasNext();) {
+        for (Iterator<?> i = actionListeners.getUserIterator(); i.hasNext();) {
             ActionListener listener = (ActionListener) i.next();
 
             switch (e.getID()) {
@@ -1341,6 +1405,7 @@
         }
     }
 
+    @Override
     String autoName() {
         return ("list" + toolkit.autoNumber.nextList++);
     }
@@ -1349,14 +1414,17 @@
         return getMinimumSize(getRows());
     }
 
+    @Override
     ComponentBehavior createBehavior() {
         return new HWBehavior(this);
     }
 
+    @Override
     boolean isPrepainter() {
         return true;
     }
 
+    @Override
     void prepaint(Graphics g) {
         toolkit.theme.drawList(g, state, false);
         vAdjustable.prepaint(g);
@@ -1382,6 +1450,7 @@
         doRepaint(new Rectangle(new Point(), getSize()));
     }
 
+    @Override
     void setFontImpl(Font f) {
         super.setFontImpl(f);
         if (isDisplayable()) {
@@ -1421,6 +1490,7 @@
                              getHeight() - (ins.top + ins.bottom));
     }
 
+    @Override
     Insets getInsets() {
         if (!isDisplayable()) {
             return super.getInsets();
@@ -1431,6 +1501,7 @@
         return insets;
     }
 
+    @Override
     Insets getNativeInsets() {
         Insets insets = getInsets();
         insets.bottom += hAdjustable.getBounds().height;
@@ -1468,6 +1539,7 @@
         return minRect;
     }
 
+    @Override
     AccessibleContext createAccessibleContext() {
         return new AccessibleAWTList();
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/MediaTracker.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/MediaTracker.java?view=diff&rev=441863&r1=441862&r2=441863
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/MediaTracker.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/MediaTracker.java Sat Sep  9 14:56:46 2006
@@ -40,7 +40,7 @@
     public static final int LOADING = 1;
 
     Component owner;
-    LinkedList trackingObjects = new LinkedList();
+    LinkedList<TrackingImage> trackingObjects = new LinkedList<TrackingImage>();
 
     public MediaTracker(Component comp) {
         owner = comp;
@@ -52,9 +52,9 @@
 
     public synchronized void addImage(Image image, int id, int w, int h) {
         int idx = 0;
-        ListIterator li = trackingObjects.listIterator();
+        ListIterator<TrackingImage> li = trackingObjects.listIterator();
         while(li.hasNext()){
-            TrackingNode node = (TrackingNode) li.next();
+            TrackingNode node = li.next();
             if(id < node.getID()){
                 idx = li.previousIndex();
                 break;
@@ -70,10 +70,12 @@
 
     public boolean checkAll(boolean load) {
         boolean result = true;
-        ListIterator li = trackingObjects.listIterator();
+        ListIterator<TrackingImage> li = trackingObjects.listIterator();
         while(li.hasNext()){
-            TrackingNode node = (TrackingNode) li.next();
-            if(load) node.loadMedia();
+            TrackingNode node = li.next();
+            if(load) {
+                node.loadMedia();
+            }
             if((node.getState() & TrackingNode.LOADING_DONE) == 0){
                 result = false;
             }
@@ -87,11 +89,13 @@
 
     public boolean checkID(int id, boolean load) {
         boolean result = true;
-        ListIterator li = trackingObjects.listIterator();
+        ListIterator<TrackingImage> li = trackingObjects.listIterator();
         while(li.hasNext()){
-            TrackingNode node = (TrackingNode) li.next();
+            TrackingNode node = li.next();
             if(node.getID() == id){
-                if(load) node.loadMedia();
+                if(load) {
+                    node.loadMedia();
+                }
                 if((node.getState() & TrackingNode.LOADING_DONE) == 0){
                     result = false;
                 }
@@ -101,88 +105,103 @@
     }
 
     public synchronized Object[] getErrorsAny() {
-        ArrayList errors = new ArrayList();
-        ListIterator li = trackingObjects.listIterator();
+        ArrayList<Object> errors = new ArrayList<Object>();
+        ListIterator<TrackingImage> li = trackingObjects.listIterator();
         while(li.hasNext()){
-            TrackingNode node = (TrackingNode) li.next();
+            TrackingNode node = li.next();
             if((node.getState() & ERRORED) != 0){
                 errors.add(node.getMediaObject());
             }
         }
-        if(errors.size() == 0) return null;
-        else return errors.toArray();
+        if(errors.size() == 0) {
+            return null;
+        }
+        return errors.toArray();
     }
 
     public synchronized Object[] getErrorsID(int id) {
-        ArrayList errors = new ArrayList();
-        ListIterator li = trackingObjects.listIterator();
+        ArrayList<Object> errors = new ArrayList<Object>();
+        ListIterator<TrackingImage> li = trackingObjects.listIterator();
         while(li.hasNext()){
-            TrackingNode node = (TrackingNode) li.next();
+            TrackingNode node = li.next();
             if(node.getID() == id){
                 if((node.getState() & ERRORED) != 0){
                     errors.add(node.getMediaObject());
                 }
             }
         }
-        if(errors.size() == 0) return null;
-        else return errors.toArray();
+        if(errors.size() == 0) {
+            return null;
+        }
+        return errors.toArray();
     }
 
     public synchronized boolean isErrorAny() {
-        ListIterator li = trackingObjects.listIterator();
+        ListIterator<TrackingImage> li = trackingObjects.listIterator();
         while(li.hasNext()){
-            TrackingNode node = (TrackingNode) li.next();
-            if((node.getState() & ERRORED) != 0) return true;
+            TrackingNode node = li.next();
+            if((node.getState() & ERRORED) != 0) {
+                return true;
+            }
         }
         return false;
     }
 
     public synchronized boolean isErrorID(int id) {
-        ListIterator li = trackingObjects.listIterator();
+        ListIterator<TrackingImage> li = trackingObjects.listIterator();
         while(li.hasNext()){
-            TrackingNode node = (TrackingNode) li.next();
+            TrackingNode node = li.next();
             if(node.getID() == id){
-                if((node.getState() & ERRORED) != 0) return true;
+                if((node.getState() & ERRORED) != 0) {
+                    return true;
+                }
             }
         }
         return false;
     }
 
     public synchronized void removeImage(Image image) {
-        ListIterator li = trackingObjects.listIterator();
+        ListIterator<TrackingImage> li = trackingObjects.listIterator();
         while(li.hasNext()){
-            TrackingNode node = (TrackingNode) li.next();
-            if(node.getMediaObject() == image) li.remove();
+            TrackingNode node = li.next();
+            if(node.getMediaObject() == image) {
+                li.remove();
+            }
         }
     }
 
     public synchronized void removeImage(Image image, int id) {
-        ListIterator li = trackingObjects.listIterator();
+        ListIterator<TrackingImage> li = trackingObjects.listIterator();
         while(li.hasNext()){
-            TrackingNode node = (TrackingNode) li.next();
-            if(node.getID() == id && node.getMediaObject() == image)
+            TrackingNode node = li.next();
+            if(node.getID() == id && node.getMediaObject() == image) {
                 li.remove();
+            }
         }
     }
 
     public synchronized void removeImage(Image image, int id, int width,
             int height) {
-        ListIterator li = trackingObjects.listIterator();
+        ListIterator<TrackingImage> li = trackingObjects.listIterator();
         while(li.hasNext()){
-            TrackingNode node = (TrackingNode) li.next();
+            TrackingNode node = li.next();
             if(node instanceof TrackingImage){
                 TrackingImage ti = (TrackingImage) node;
-                if(ti.equals(image, id, width, height)) li.remove();
+                if(ti.equals(image, id, width, height)) {
+                    li.remove();
+                }
             }
         }
     }
 
     public int statusAll(boolean load) {
         int status = 0;
-        ListIterator li = trackingObjects.listIterator();
+        ListIterator<TrackingImage> li = trackingObjects.listIterator();
         while(li.hasNext()){
-            TrackingNode node = (TrackingNode) li.next();
-            if(load) node.loadMedia();
+            TrackingNode node = li.next();
+            if(load) {
+                node.loadMedia();
+            }
             status |= node.getState();
         }
         return status;
@@ -190,11 +209,13 @@
 
     public int statusID(int id, boolean load) {
         int status = 0;
-        ListIterator li = trackingObjects.listIterator();
+        ListIterator<TrackingImage> li = trackingObjects.listIterator();
         while(li.hasNext()){
-            TrackingNode node = (TrackingNode) li.next();
+            TrackingNode node = li.next();
             if(id == node.getID()){
-                if(load) node.loadMedia();
+                if(load) {
+                    node.loadMedia();
+                }
                 status |= node.getState();
             }
         }
@@ -219,8 +240,10 @@
                 timeout = 0;
             }else{
                 long curtime = System.currentTimeMillis();
-                if(finishtime <= curtime) return false;
-                else timeout = finishtime - curtime;
+                if(finishtime <= curtime) {
+                    return false;
+                }
+                timeout = finishtime - curtime;
             }
             wait(timeout);
         }
@@ -245,8 +268,10 @@
                 timeout = 0;
             }else{
                 long curtime = System.currentTimeMillis();
-                if(finishtime <= curtime) return false;
-                else timeout = finishtime - curtime;
+                if(finishtime <= curtime) {
+                    return false;
+                }
+                timeout = finishtime - curtime;
             }
             wait(timeout);
         }
@@ -299,10 +324,12 @@
             this.h = h;
         }
 
+        @Override
         Object getMediaObject() {
             return img;
         }
 
+        @Override
         void loadMedia() {
             if((state & LOADING_STARTED) == 0){
                 state = (state & ~ABORTED) | LOADING;
@@ -312,18 +339,26 @@
             }
         }
 
+        @Override
         synchronized int getState(){
             int infoflags = tracker.owner.checkImage(img, w, h, this);
             int st = translateFlags(infoflags);
-            if(st != 0 && st != state) updateState(st);
+            if(st != 0 && st != state) {
+                updateState(st);
+            }
             return state;
         }
 
         int translateFlags(int infoflags){
-            if((infoflags & ERROR) != 0) return ERRORED;
-            else if((infoflags & ABORT) != 0) return ABORTED;
-            else if((infoflags & (ALLBITS | FRAMEBITS)) != 0) return COMPLETE;
-            else return 0;
+            if((infoflags & ERROR) != 0) {
+                return ERRORED;
+            } else if((infoflags & ABORT) != 0) {
+                return ABORTED;
+            } else if((infoflags & (ALLBITS | FRAMEBITS)) != 0) {
+                return COMPLETE;
+            } else {
+                return 0;
+            }
         }
 
         boolean equals(Image image, int id, int width, int height){
@@ -332,7 +367,9 @@
 
         public boolean imageUpdate(Image image, int infoflags, int x, int y, int w, int h) {
             int st = translateFlags(infoflags);
-            if(st != 0 && st != state) updateState(st);
+            if(st != 0 && st != state) {
+                updateState(st);
+            }
             return ((state & LOADING) != 0);
         }
 



Mime
View raw message