Revision: 748
Author: allain.lalonde
Date: Mon Oct 19 13:38:38 2009
Log: Fixing core CheckStyle warnings. All magic number warnings were on  
constant definitions. Cleaning them up would not have increased code  
clarity greatly enough to warrant it.
http://code.google.com/p/piccolo2d/source/detail?r=748

Modified:
  /piccolo2d.java/trunk/core/src/build/conf/checkstyle.xml
  /piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/PCanvas.java
   
/piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/activities/PTransformActivity.java
   
/piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/nodes/PPath.java
   
/piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/nodes/PText.java
   
/piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/util/PPaintContext.java
   
/piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/util/PPickPath.java

=======================================
--- /piccolo2d.java/trunk/core/src/build/conf/checkstyle.xml    Tue Oct 13  
09:36:51 2009
+++ /piccolo2d.java/trunk/core/src/build/conf/checkstyle.xml    Mon Oct 19  
13:38:38 2009
@@ -151,10 +151,13 @@
          </module>
          <module name="IllegalInstantiation"/>
          <module name="InnerAssignment"/>
-        <!--  TODO: Make this check ints and longs aswell -->
-        <module name="MagicNumber">
-               <property name="ignoreNumbers" value="0, 0.5, 2, 1, -1, 1000" />
+        <!-- 2.0:  Lots of enums are defined using constants, so until 2.0  
this needs to stay disabled. -->
+        <!--
+        <module name="MagicNumber">
+               <property name="ignoreNumbers" value="0, 0.5, 2, 1, -1, 1000, 
2, 3,  
4, 5, 6, 7, 8" />
          </module>
+       -->
+
          <module name="MissingSwitchDefault"/>
          <module name="RedundantThrows"/>
          <module name="SimplifyBooleanExpression"/>
=======================================
---  
/piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/PCanvas.java        
 
Mon Oct 12 18:58:11 2009
+++  
/piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/PCanvas.java        
 
Mon Oct 19 13:38:38 2009
@@ -154,6 +154,9 @@
       */
      private transient MouseMotionListener mouseMotionListener;

+    private static final int ALL_BUTTONS_MASK =  
InputEvent.BUTTON1_DOWN_MASK | InputEvent.BUTTON2_DOWN_MASK
+            | InputEvent.BUTTON3_DOWN_MASK;
+
      /**
       * Construct a canvas with the basic scene graph consisting of a root,
       * camera, and layer. Zooming and panning are automatically installed.
@@ -842,10 +845,6 @@

              sendInputEventToInputManager(event, MouseEvent.MOUSE_RELEASED);
          }
-
-        private boolean isAnyButtonDown(final MouseEvent e) {
-            return (e.getModifiersEx() & (InputEvent.BUTTON1_DOWN_MASK |  
InputEvent.BUTTON2_DOWN_MASK | InputEvent.BUTTON3_DOWN_MASK)) != 0;
-        }

          private MouseEvent copyButtonsFromModifiers(final MouseEvent  
rawEvent, final int eventType) {
              if (rawEvent.getButton() != MouseEvent.NOBUTTON) {
@@ -885,6 +884,10 @@
              sendInputEventToInputManager(retypedEvent, newType);
          }
      }
+
+    private boolean isAnyButtonDown(final MouseEvent e) {
+        return (e.getModifiersEx() & ALL_BUTTONS_MASK) != 0;
+    }

      /**
       * Class responsible for sending key events to the the InputManager.
@@ -904,6 +907,9 @@
          }
      }

+    /**
+     * Class responsible for sending mouse events to the the InputManager.
+     */
      private final class MouseWheelInputSourceListener implements  
MouseWheelListener {
          /** {...@inheritdoc} */
          public void mouseWheelMoved(final MouseWheelEvent e) {
=======================================
---  
/piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/activities/PTransformActivity.java
   
Tue Oct 13 09:36:51 2009
+++  
/piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/activities/PTransformActivity.java
   
Mon Oct 19 13:38:38 2009
@@ -43,8 +43,7 @@
   * @author Jesse Grosjean
   */
  public class PTransformActivity extends PInterpolatingActivity {
-
-    private static PAffineTransform STATIC_TRANSFORM = new  
PAffineTransform();
+    private static final PAffineTransform STATIC_TRANSFORM = new  
PAffineTransform();

      private final double[] source;
      private double[] destination;
=======================================
---  
/piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/nodes/PPath.java    
 
Tue Oct 13 09:36:51 2009
+++  
/piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/nodes/PPath.java    
 
Mon Oct 19 13:38:38 2009
@@ -521,7 +521,8 @@
       * @param x3 x component of point through which curve must pass
       * @param y3 y component of point through which curve must pass
       */
-    public void curveTo(final float x1, final float y1, final float x2,  
final float y2, final float x3, final float y3) {
+    public void curveTo(final float x1, final float y1, final float x2,  
final float y2,
+            final float x3, final float y3) {
          path.curveTo(x1, y1, x2, y2, x3, y3);
          firePropertyChange(PROPERTY_CODE_PATH, PROPERTY_PATH, null, path);
          updateBoundsFromPath();
=======================================
---  
/piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/nodes/PText.java    
 
Tue Oct 13 09:36:51 2009
+++  
/piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/nodes/PText.java    
 
Mon Oct 19 13:38:38 2009
@@ -164,6 +164,7 @@
       */
      public PText() {
          super();
+        setText(DEFAULT_TEXT);
      }

      /**
=======================================
---  
/piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/util/PPaintContext.java
      
Tue Oct 13 09:36:51 2009
+++  
/piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/util/PPaintContext.java
      
Mon Oct 19 13:38:38 2009
@@ -68,7 +68,7 @@
      public static PPaintContext CURRENT_PAINT_CONTEXT;

      /** Used while calculating scale at which rendering is occurring. */
-    private static double[] PTS = new double[4];
+    private static final double[] PTS = new double[4];

      /** PaintContext is associated with this graphics context. */
      private final Graphics2D graphics;
=======================================
---  
/piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/util/PPickPath.java 
 
Tue Oct 13 09:36:51 2009
+++  
/piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/util/PPickPath.java 
 
Mon Oct 19 13:38:38 2009
@@ -67,7 +67,7 @@
      public static PPickPath CURRENT_PICK_PATH;

      /** Used when calculating the scale. */
-    private static double[] PTS = new double[4];
+    private static final double[] PTS = new double[4];

      /** Stack of nodes representing all picked nodes. */
      private PStack nodeStack;

--~--~---------~--~----~------------~-------~--~----~
Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to