commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1170779 - /commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalUnaryPredicate.java
Date Wed, 14 Sep 2011 19:16:47 GMT
Author: simonetripodi
Date: Wed Sep 14 19:16:47 2011
New Revision: 1170779

URL: http://svn.apache.org/viewvc?rev=1170779&view=rev
Log:
fixed checkstyle violation: '4' is a magic number.

Modified:
    commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalUnaryPredicate.java

Modified: commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalUnaryPredicate.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalUnaryPredicate.java?rev=1170779&r1=1170778&r2=1170779&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalUnaryPredicate.java
(original)
+++ commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/ConditionalUnaryPredicate.java
Wed Sep 14 19:16:47 2011
@@ -45,6 +45,9 @@ public final class ConditionalUnaryPredi
      * serialVersionUID declaration.
      */
     private static final long serialVersionUID = 1214714029872180155L;
+
+    /** Base hash integer used to shift hash */
+    private static final int HASH_SHIFT = 4;
     // attributes
     // ------------------------------------------------------------------------
     private final UnaryPredicate<? super A> ifPred;
@@ -104,15 +107,15 @@ public final class ConditionalUnaryPredi
     public int hashCode() {
         int hash = "ConditionalUnaryPredicate".hashCode();
         if (null != ifPred) {
-            hash <<= 4;
+            hash <<= HASH_SHIFT;
             hash ^= ifPred.hashCode();
         }
         if (null != thenPred) {
-            hash <<= 4;
+            hash <<= HASH_SHIFT;
             hash ^= thenPred.hashCode();
         }
         if (null != elsePred) {
-            hash <<= 4;
+            hash <<= HASH_SHIFT;
             hash ^= elsePred.hashCode();
         }
         return hash;



Mime
View raw message