ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peterrei...@apache.org
Subject svn commit: r475076 - in /ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image: Arc.java BasicShape.java ColorMapper.java Draw.java Ellipse.java ImageOperation.java Rectangle.java Rotate.java Scale.java Text.java TransformOperation.java
Date Wed, 15 Nov 2006 00:10:28 GMT
Author: peterreilly
Date: Tue Nov 14 16:10:27 2006
New Revision: 475076

URL: http://svn.apache.org/viewvc?view=rev&rev=475076
Log:
checkstyle

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Arc.java
    ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/BasicShape.java
    ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/ColorMapper.java
    ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Draw.java
    ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Ellipse.java
    ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/ImageOperation.java
    ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Rectangle.java
    ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Rotate.java
    ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Scale.java
    ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Text.java
    ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/TransformOperation.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Arc.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Arc.java?view=diff&rev=475076&r1=475075&r2=475076
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Arc.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Arc.java Tue Nov 14
16:10:27 2006
@@ -23,30 +23,53 @@
 import java.awt.geom.Arc2D;
 import java.awt.image.BufferedImage;
 
+/**
+ * Draw an arc.
+ */
 public class Arc extends BasicShape implements DrawOperation {
+    // CheckStyle:VisibilityModifier OFF - bc
     protected int width = 0;
     protected int height = 0;
     protected int start = 0;
     protected int stop = 0;
     protected int type = Arc2D.OPEN;
+    // CheckStyle:VisibilityModifier ON
 
+    /**
+     * Set the width.
+     * @param width the width of the arc.
+     */
     public void setWidth(int width) {
         this.width = width;
     }
 
+    /**
+     * Set the height.
+     * @param height the height of the arc.
+     */
     public void setHeight(int height) {
         this.height = height;
     }
 
+    /**
+     * Set the start of the arc.
+     * @param start the start of the arc.
+     */
     public void setStart(int start) {
         this.start = start;
     }
 
+    /**
+     * Set the stop of the arc.
+     * @param stop the stop of the arc.
+     */
     public void setStop(int stop) {
         this.stop = stop;
     }
 
     /**
+     * Set the type of arc.
+     * @param strType the type to use - open, pie or chord.
      * @todo refactor using an EnumeratedAttribute
      */
     public void setType(String strType) {
@@ -59,6 +82,7 @@
         }
     }
 
+    /** {@inheritDoc}. */
     public PlanarImage executeDrawOperation() {
         BufferedImage bi = new BufferedImage(width + (stroke_width * 2),
             height + (stroke_width * 2), BufferedImage.TYPE_4BYTE_ABGR_PRE);

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/BasicShape.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/BasicShape.java?view=diff&rev=475076&r1=475075&r2=475076
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/BasicShape.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/BasicShape.java Tue
Nov 14 16:10:27 2006
@@ -17,20 +17,38 @@
  */
 package org.apache.tools.ant.types.optional.image;
 
+
+/** Draw a basic shape */
 public abstract class BasicShape extends ImageOperation implements DrawOperation {
+    // CheckStyle:VisibilityModifier OFF - bc
+    // CheckStyle:MemberNameCheck OFF - bc
     protected int stroke_width = 0;
+    // CheckStyle:MemberNameCheck ON
     protected String fill = "transparent";
     protected String stroke = "black";
+    // CheckStyle:VisibilityModifier ON
 
 
+    /**
+     * Set the fill attribute.
+     * @param col the color value to use.
+     */
     public void setFill(String col) {
         fill = col;
     }
 
+    /**
+     * Set the stroke attribute.
+     * @param col the color value to use.
+     */
     public void setStroke(String col) {
         stroke = col;
     }
 
+    /**
+     * Set the stroke width attribute.
+     * @param width the value to use.
+     */
     public void setStrokewidth(int width) {
         stroke_width = width;
     }

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/ColorMapper.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/ColorMapper.java?view=diff&rev=475076&r1=475075&r2=475076
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/ColorMapper.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/ColorMapper.java Tue
Nov 14 16:10:27 2006
@@ -24,6 +24,10 @@
  * @see org.apache.tools.ant.taskdefs.optional.image.Image
  */
 public final class ColorMapper {
+    /** private constructor for Utility class */
+    private ColorMapper() {
+    }
+
     /** black string */
     public static final String COLOR_BLACK = "black";
     /** blue string */
@@ -59,6 +63,9 @@
     public static final String COLOR_YELLOW = "yellow";
 
     /**
+     * Convert a color name to a color value.
+     * @param colorName a string repr of the color.
+     * @return the color value.
      * @todo refactor to use an EnumeratedAttribute (maybe?)
      */
     public static Color getColorByName(String colorName) {

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Draw.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Draw.java?view=diff&rev=475076&r1=475075&r2=475076
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Draw.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Draw.java Tue Nov 14
16:10:27 2006
@@ -26,34 +26,54 @@
  * @see org.apache.tools.ant.taskdefs.optional.image.Image
  */
 public class Draw extends TransformOperation {
+    // CheckStyle:VisibilityModifier OFF - bc
     protected int xloc = 0;
     protected int yloc = 0;
+    // CheckStyle:VisibilityModifier ON
 
+    /**
+     * Set the X location.
+     * @param x the value to use.
+     */
     public void setXloc(int x) {
         xloc = x;
     }
 
+    /**
+     * Set the Y location.
+     * @param y the value to use.
+     */
     public void setYloc(int y) {
         yloc = y;
     }
 
+    /** {@inheritDoc}. */
     public void addRectangle(Rectangle rect) {
         instructions.add(rect);
     }
 
+    /** {@inheritDoc}. */
     public void addText(Text text) {
         instructions.add(text);
     }
 
+    /**
+     * Add an ellipse.
+     * @param elip the ellipse to add.
+     */
     public void addEllipse(Ellipse elip) {
         instructions.add(elip);
     }
 
+    /**
+     * Add an arc.
+     * @param arc the arc to add.
+     */
     public void addArc(Arc arc) {
         instructions.add(arc);
     }
 
-
+    /** {@inheritDoc}. */
     public PlanarImage executeTransformOperation(PlanarImage image) {
         BufferedImage bi = image.getAsBufferedImage();
         Graphics2D graphics = (Graphics2D) bi.getGraphics();

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Ellipse.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Ellipse.java?view=diff&rev=475076&r1=475075&r2=475076
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Ellipse.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Ellipse.java Tue Nov
14 16:10:27 2006
@@ -24,21 +24,32 @@
 import java.awt.image.BufferedImage;
 
 /**
- *
+ * Draw an ellipse.
  * @see org.apache.tools.ant.taskdefs.optional.image.Image
  */
 public class Ellipse extends BasicShape implements DrawOperation {
+    // CheckStyle:VisibilityModifier OFF - bc
     protected int width = 0;
     protected int height = 0;
+    // CheckStyle:VisibilityModifier ON
 
+    /**
+     * Set the width.
+     * @param width the width of the elipse.
+     */
     public void setWidth(int width) {
         this.width = width;
     }
 
+    /**
+     * Set the height.
+     * @param height the height of the elipse.
+     */
     public void setHeight(int height) {
         this.height = height;
     }
 
+    /** {@inheritDoc}. */
     public PlanarImage executeDrawOperation() {
         BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR_PRE);
 

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/ImageOperation.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/ImageOperation.java?view=diff&rev=475076&r1=475075&r2=475076
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/ImageOperation.java
(original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/ImageOperation.java
Tue Nov 14 16:10:27 2006
@@ -25,25 +25,47 @@
  * @see org.apache.tools.ant.taskdefs.optional.image.Image
  */
 public abstract class ImageOperation extends DataType {
+     // CheckStyle:VisibilityModifier OFF - bc
     protected Vector instructions = new Vector();
+     // CheckStyle:VisibilityModifier ON
 
+    /**
+     * Add a rotate to the operation.
+     * @param instr the rotate to add.
+     */
     public void addRotate(Rotate instr) {
         instructions.add(instr);
     }
 
+    /**
+     * Add a draw to the operation.
+     * @param instr the draw to add.
+     */
     public void addDraw(Draw instr) {
         instructions.add(instr);
     }
 
+    /**
+     * Add a rectangle to the operation.
+     * @param instr the rectangle to add.
+     */
     public void addRectangle(Rectangle instr) {
         instructions.add(instr);
     }
 
+    /**
+     * Add text to the operation.
+     * @param instr the text to add.
+     */
     public void addText(Text instr) {
         instructions.add(instr);
     }
 
+    /**
+     * Add a scale to the operation.
+     * @param instr the scale to add.
+     */
     public void addScale(Scale instr) {
         instructions.add(instr);
     }
-}
\ No newline at end of file
+}

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Rectangle.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Rectangle.java?view=diff&rev=475076&r1=475075&r2=475076
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Rectangle.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Rectangle.java Tue Nov
14 16:10:27 2006
@@ -27,27 +27,46 @@
  * @see org.apache.tools.ant.taskdefs.optional.image.Image
  */
 public class Rectangle extends BasicShape implements DrawOperation {
+    // CheckStyle:VisibilityModifier OFF - bc
     protected int width = 0;
     protected int height = 0;
     protected int arcwidth = 0;
     protected int archeight = 0;
+    // CheckStyle:VisibilityModifier ON
 
+    /**
+     * Set the width.
+     * @param w the value to use.
+     */
     public void setWidth(int w) {
         width = w;
     }
 
+    /**
+     * Set the height.
+     * @param h the value to use.
+     */
     public void setHeight(int h) {
         height = h;
     }
 
+    /**
+     * Set the arc width.
+     * @param w the value to use.
+     */
     public void setArcwidth(int w) {
         arcwidth = w;
     }
 
+    /**
+     * Set the arc height.
+     * @param h the value to use.
+     */
     public void setArcheight(int h) {
         archeight = h;
     }
 
+    /** {@inheritDoc}. */
     public PlanarImage executeDrawOperation() {
         log("\tCreating Rectangle w=" + width + " h=" + height + " arcw="
             + arcwidth + " arch=" + archeight);

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Rotate.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Rotate.java?view=diff&rev=475076&r1=475075&r2=475076
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Rotate.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Rotate.java Tue Nov
14 16:10:27 2006
@@ -30,7 +30,11 @@
  * @see org.apache.tools.ant.taskdefs.optional.image.Image
  */
 public class Rotate extends TransformOperation implements DrawOperation {
+    private static final float HALF_CIRCLE = 180.0F;
+
+    // CheckStyle:VisibilityModifier OFF - bc
     protected float angle = 0.0F;
+    // CheckStyle:VisibilityModifier ON
 
     /**
      * Sets the angle of rotation in degrees.
@@ -41,8 +45,9 @@
     }
 
 
+    /** {@inheritDoc}. */
     public PlanarImage performRotate(PlanarImage image) {
-        float tAngle = (float) (angle * (Math.PI / 180.0F));
+        float tAngle = (float) (angle * (Math.PI / HALF_CIRCLE));
         ParameterBlock pb = new ParameterBlock();
         pb.addSource(image);
         pb.add(0.0F);
@@ -54,8 +59,9 @@
 
 
     /**
-     *  Performs the image rotation when being handled as a TransformOperation.
+     * Performs the image rotation when being handled as a TransformOperation.
      * @param image The image to perform the transformation on.
+     * @return the transformed image.
      */
     public PlanarImage executeTransformOperation(PlanarImage image) {
         BufferedImage bi = null;
@@ -89,6 +95,7 @@
      *  It absolutely requires that there be a DrawOperation nested beneath it,
      *  but only the FIRST DrawOperation will be handled since it can only return
      *  ONE image.
+     * @return the image.
      */
     public PlanarImage executeDrawOperation() {
         for (int i = 0; i < instructions.size(); i++) {

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Scale.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Scale.java?view=diff&rev=475076&r1=475075&r2=475076
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Scale.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Scale.java Tue Nov 14
16:10:27 2006
@@ -29,6 +29,7 @@
  * @see org.apache.tools.ant.taskdefs.optional.image.Image
  */
 public class Scale extends TransformOperation implements DrawOperation {
+    private static final int HUNDRED = 100;
 
     private String widthStr = "100%";
     private String heightStr = "100%";
@@ -36,7 +37,9 @@
     private boolean yPercent = true;
     private String proportions = "ignore";
 
+    /** Enumerated class for proportions attribute. */
     public static class ProportionsAttribute extends EnumeratedAttribute {
+        /** {@inheritDoc}. */
         public String[] getValues() {
             return new String[] {"ignore", "width", "height", "cover", "fit"};
         }
@@ -44,13 +47,16 @@
 
     /**
      *  Sets the behaviour regarding the image proportions.
+     * @param pa the enumerated value.
      */
     public void setProportions(ProportionsAttribute pa) {
         proportions = pa.getValue();
     }
 
     /**
-     *  Sets the width of the image, either as an integer or a %.  Defaults to 100%.
+     * Sets the width of the image, either as an integer or a %.
+     * Defaults to 100%.
+     * @param width the value to use.
      */
     public void setWidth(String width) {
         widthStr = width;
@@ -58,36 +64,46 @@
 
     /**
      *  Sets the height of the image, either as an integer or a %.  Defaults to 100%.
+     * @param height the value to use.
      */
     public void setHeight(String height) {
         heightStr = height;
     }
 
+    /**
+     * Get the width.
+     * @return the value converted from the width string.
+     */
     public float getWidth() {
         float width = 0.0F;
         int percIndex = widthStr.indexOf('%');
         if (percIndex > 0) {
             width = Float.parseFloat(widthStr.substring(0, percIndex));
             xPercent = true;
-            return width / 100;
+            return width / HUNDRED;
         } else {
             xPercent = false;
             return Float.parseFloat(widthStr);
         }
     }
 
+    /**
+     * Get the height.
+     * @return the value converted from the height string.
+     */
     public float getHeight() {
         int percIndex = heightStr.indexOf('%');
         if (percIndex > 0) {
             float height = Float.parseFloat(heightStr.substring(0, percIndex));
             yPercent = true;
-            return height / 100;
+            return height / HUNDRED;
         } else {
             yPercent = false;
             return Float.parseFloat(heightStr);
         }
     }
 
+    /** {@inheritDoc}. */
     public PlanarImage performScale(PlanarImage image) {
         ParameterBlock pb = new ParameterBlock();
         pb.addSource(image);
@@ -116,12 +132,14 @@
         pb.add(new Float(xFl));
         pb.add(new Float(yFl));
 
-        log("\tScaling to " + (xFl * 100) + "% x " + (yFl * 100) + "%");
+        log("\tScaling to " + (xFl * HUNDRED) + "% x "
+            + (yFl * HUNDRED) + "%");
 
         return JAI.create("scale", pb);
     }
 
 
+    /** {@inheritDoc}. */
     public PlanarImage executeTransformOperation(PlanarImage image) {
         BufferedImage bi = null;
         for (int i = 0; i < instructions.size(); i++) {
@@ -139,6 +157,7 @@
     }
 
 
+    /** {@inheritDoc}. */
     public PlanarImage executeDrawOperation() {
         for (int i = 0; i < instructions.size(); i++) {
             ImageOperation instr = ((ImageOperation) instructions.elementAt(i));

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Text.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Text.java?view=diff&rev=475076&r1=475075&r2=475076
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Text.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/Text.java Tue Nov 14
16:10:27 2006
@@ -30,31 +30,50 @@
  * @see org.apache.tools.ant.taskdefs.optional.image.Image
  */
 public class Text extends ImageOperation implements DrawOperation {
+    private static final int DEFAULT_POINT = 10;
+
     private String strText = "";
     private String font = "Arial";
-    private int point = 10;
+    private int point = DEFAULT_POINT;
     private boolean bold = false;
     private boolean italic = false;
     private String color = "black";
 
+    /**
+     * Set the string to be used as text.
+     * @param str the string to be used.
+     */
     public void setString(String str) {
         strText = str;
     }
 
+    /**
+     * Set the font to be used to draw the text.
+     * @param f the font to be used.
+     */
     public void setFont(String f) {
         font = f;
     }
 
+    /**
+     * Set the number of points to be used.
+     * @param p an integer value as a string.
+     */
     public void setPoint(String p) {
         point = Integer.parseInt(p);
     }
 
+    /**
+     * Set the color of the text.
+     * @param c the color name.
+     */
     public void setColor(String c) {
         color = c;
     }
 
     /**
      * @todo is this used?
+     * @param state not used at the moment.
      */
     public void setBold(boolean state) {
         bold = state;
@@ -62,11 +81,16 @@
 
     /**
      * @todo is this used?
+     * @param state not used at the moment.
      */
     public void setItalic(boolean state) {
         italic = state;
     }
 
+    /**
+     * Draw the text.
+     * @return the resultant image.
+     */
     public PlanarImage executeDrawOperation() {
         log("\tCreating Text \"" + strText + "\"");
 

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/TransformOperation.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/TransformOperation.java?view=diff&rev=475076&r1=475075&r2=475076
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/TransformOperation.java
(original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/optional/image/TransformOperation.java
Tue Nov 14 16:10:27 2006
@@ -23,10 +23,15 @@
  * @see org.apache.tools.ant.taskdefs.optional.image.Image
  */
 public abstract class TransformOperation extends ImageOperation {
+    /**
+     * Performs the transformations.
+     * @param img The image to perform the transformation on.
+     * @return the transformed image.
+     */
     public abstract PlanarImage executeTransformOperation(PlanarImage img);
 
+     /** {@inheritDoc}. */
     public void addRectangle(Rectangle instr) {
         instructions.add(instr);
     }
-
-}
\ No newline at end of file
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message