commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: svn commit: r1180235 - /commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/UnaryCompositeBinaryPredicate.java
Date Sun, 09 Oct 2011 12:12:29 GMT
On 7 October 2011 21:55,  <simonetripodi@apache.org> wrote:
> Author: simonetripodi
> Date: Fri Oct  7 20:55:23 2011
> New Revision: 1180235
>
> URL: http://svn.apache.org/viewvc?rev=1180235&view=rev
> Log:
> '4' is a magic number.
>
> Modified:
>    commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/UnaryCompositeBinaryPredicate.java
>
> Modified: commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/UnaryCompositeBinaryPredicate.java
> URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/UnaryCompositeBinaryPredicate.java?rev=1180235&r1=1180234&r2=1180235&view=diff
> ==============================================================================
> --- commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/UnaryCompositeBinaryPredicate.java
(original)
> +++ commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/UnaryCompositeBinaryPredicate.java
Fri Oct  7 20:55:23 2011
> @@ -44,6 +44,9 @@ public class UnaryCompositeBinaryPredica
>      */
>     private static final long serialVersionUID = 3841123079006929493L;
>
> +    /** Base hash integer used to shift hash. */
> +    private static final int HASH_SHIFT = 4;
> +

Same comment as for other instance of the magic number fixed recently.

Additionally, is it important that the two maghic numbers agree?

>     private static class Helper<G, H, L, R> implements BinaryPredicate<L,
R>, Serializable {
>         /**
>          * serialVersionUID declaration.
> @@ -129,11 +132,11 @@ public class UnaryCompositeBinaryPredica
>      */
>     public int hashCode() {
>         int hash = "UnaryCompositeBinaryPredicate".hashCode();
> -        hash <<= 4;
> +        hash <<= HASH_SHIFT;
>         hash ^= helper.f.hashCode();
> -        hash <<= 4;
> +        hash <<= HASH_SHIFT;
>         hash ^= helper.g.hashCode();
> -        hash <<= 4;
> +        hash <<= HASH_SHIFT;
>         hash ^= helper.h.hashCode();
>         return hash;
>     }
>
>
>

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


Mime
View raw message