You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sebb <se...@gmail.com> on 2011/10/09 14:12:29 UTC
Re: svn commit: r1180235 - /commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/composite/UnaryCompositeBinaryPredicate.java
On 7 October 2011 21:55, <si...@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