You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-commits@xmlgraphics.apache.org by dv...@apache.org on 2008/11/24 20:13:01 UTC

svn commit: r720261 - in /xmlgraphics/batik/trunk/sources/org/apache/batik: bridge/ dom/util/ ext/awt/image/renderable/ ext/awt/image/rendered/ gvt/ gvt/flow/ util/

Author: dvholten
Date: Mon Nov 24 11:13:01 2008
New Revision: 720261

URL: http://svn.apache.org/viewvc?rev=720261&view=rev
Log:
replace some manual copy-loops
minor text formatting

Modified:
    xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGAnimationEngine.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/dom/util/SAXIOException.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/renderable/DeferRable.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/rendered/LRUCache.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/FillShapePainter.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/MarkerShapePainter.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/flow/FlowTextPainter.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/util/ParsedURL.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/util/RunnableQueue.java

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGAnimationEngine.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGAnimationEngine.java?rev=720261&r1=720260&r2=720261&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGAnimationEngine.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGAnimationEngine.java Mon Nov 24 11:13:01 2008
@@ -256,12 +256,8 @@
             animationEventNames11.add(eventNamesCommon[i]);
             animationEventNames12.add(eventNamesCommon[i]);
         }
-        for (int i = 0; i < eventNamesSVG11.length; i++) {
-            animationEventNames11.add(eventNamesSVG11[i]);
-        }
-        for (int i = 0; i < eventNamesSVG12.length; i++) {
-            animationEventNames12.add(eventNamesSVG12[i]);
-        }
+        animationEventNames11.addAll(Arrays.asList(eventNamesSVG11));
+        animationEventNames12.addAll(Arrays.asList(eventNamesSVG12));
     }
 
     /**

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/util/SAXIOException.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/util/SAXIOException.java?rev=720261&r1=720260&r2=720261&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/util/SAXIOException.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/util/SAXIOException.java Mon Nov 24 11:13:01 2008
@@ -40,4 +40,4 @@
 
     public SAXException getSAXException() { return saxe; }
     public Throwable    getCause() { return saxe; }
-};
+}

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/renderable/DeferRable.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/renderable/DeferRable.java?rev=720261&r1=720260&r2=720261&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/renderable/DeferRable.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/renderable/DeferRable.java Mon Nov 24 11:13:01 2008
@@ -39,7 +39,7 @@
  * @version $Id$
  */
 public class DeferRable implements Filter {
-    Filter      src;
+    volatile Filter  src;
     Rectangle2D bounds;
     Map         props;
     /**
@@ -56,8 +56,7 @@
             try {
                 // Wait for someone to set src.
                 wait();
-            }
-            catch(InterruptedException ie) {
+            } catch(InterruptedException ie) {
                 // Loop around again see if src is set now...
             }
         }

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/rendered/LRUCache.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/rendered/LRUCache.java?rev=720261&r1=720260&r2=720261&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/rendered/LRUCache.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/rendered/LRUCache.java Mon Nov 24 11:13:01 2008
@@ -151,7 +151,7 @@
                 System.out.println("In Use: " + used.getSize() +
                                                    " Free: " + free.getSize());
                 LRUNode nde = (LRUNode)used.getHead();
-        if (nde == null) return;
+                if (nde == null) return;
                 do {
                         System.out.println(nde.getObj());
                         nde = (LRUNode)nde.getNext();

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/FillShapePainter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/FillShapePainter.java?rev=720261&r1=720260&r2=720261&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/FillShapePainter.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/FillShapePainter.java Mon Nov 24 11:13:01 2008
@@ -100,7 +100,7 @@
         if ((paint == null) || (shape == null))
             return  null;
 
-            return shape.getBounds2D();
+        return shape.getBounds2D();
     }
 
     /**

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/MarkerShapePainter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/MarkerShapePainter.java?rev=720261&r1=720260&r2=720261&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/MarkerShapePainter.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/MarkerShapePainter.java Mon Nov 24 11:13:01 2008
@@ -27,6 +27,7 @@
 import java.awt.geom.Rectangle2D;
 import java.util.List;
 import java.util.ArrayList;
+import java.util.Arrays;
 
 import org.apache.batik.ext.awt.geom.ExtendedGeneralPath;
 import org.apache.batik.ext.awt.geom.ExtendedPathIterator;
@@ -300,9 +301,7 @@
         }
 
         if (middleMarkerProxies != null) {
-            for(int i=0; i<middleMarkerProxies.length; i++){
-                children.add(middleMarkerProxies[i]);
-            }
+            children.addAll(Arrays.asList(middleMarkerProxies));
         }
 
         if (endMarkerProxy != null) {

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/flow/FlowTextPainter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/flow/FlowTextPainter.java?rev=720261&r1=720260&r2=720261&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/flow/FlowTextPainter.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/flow/FlowTextPainter.java Mon Nov 24 11:13:01 2008
@@ -135,7 +135,7 @@
         // Make a list of the GlyphVectors so we can construct a
         // multiGlyphVector that makes them all look like one big
         // glyphVector
-        GVTGlyphVector [] gvs            = new GVTGlyphVector[acis.length];
+        GVTGlyphVector [] gvs            = new GVTGlyphVector[acis.length];       // todo - not used?
         WordInfo       [][] wordInfos    = new WordInfo[acis.length][];
         Iterator clIter = chunkLayouts.iterator();
 
@@ -190,7 +190,7 @@
 
                 while (!li.addWord(wi)) {
                     // step down 1/10 of a line height and try again.
-                    newY = li.getCurrentY()+lh*.1;
+                    newY = li.getCurrentY()+lh * 0.1;
                     if (li.gotoY(newY)) break;
                 }
                 if (fr.done()) break;
@@ -213,7 +213,7 @@
 
                     li = new LineInfo(fr, bi, false);
                     while (!li.addWord(wi)) {
-                        newY =li.getCurrentY()+lh*.1;
+                        newY =li.getCurrentY()+lh * 0.1;
                         if (li.gotoY(newY)) break;
                     }
                     if (fr.done()) break;

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/util/ParsedURL.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/util/ParsedURL.java?rev=720261&r1=720260&r2=720261&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/util/ParsedURL.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/util/ParsedURL.java Mon Nov 24 11:13:01 2008
@@ -22,6 +22,7 @@
 import java.io.InputStream;
 import java.net.URL;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
@@ -250,7 +251,7 @@
      * represented by this <code>ParsedURL</code>.  For HTTP URLs,
      * this will result in the post-redirect URL being returned.
      * If there was no redirect, or if this isn't an HTTP URL, the
-     * original URL is returned (the same string as {@link toString()}).
+     * original URL is returned (the same string as {@link #toString()}).
      */
     public String getPostConnectionURL() {
         return data.getPostConnectionURL();
@@ -470,8 +471,7 @@
      */
     public InputStream openStreamRaw(String [] mimeTypes) throws IOException {
         List mt = new ArrayList(mimeTypes.length);
-        for (int i=0; i<mimeTypes.length; i++)
-            mt.add(mimeTypes[i]);
+        mt.addAll(Arrays.asList(mimeTypes));
         return data.openStreamRaw(userAgent, mt.iterator());
     }
 

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/util/RunnableQueue.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/util/RunnableQueue.java?rev=720261&r1=720260&r2=720261&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/util/RunnableQueue.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/util/RunnableQueue.java Mon Nov 24 11:13:01 2008
@@ -331,7 +331,7 @@
             list.push(l);
             list.notify();
         }
-        l.lock();
+        l.lock();           // todo: the 'other side' of list may retrieve the l before it is locked...
     }
 
 
@@ -381,7 +381,7 @@
             preemptCount++;
             list.notify();
         }
-        l.lock();
+        l.lock();               // todo: the 'other side' of list may retrieve the l before it is locked...
     }
 
     public RunnableQueueState getQueueState() {