You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@clerezza.apache.org by "Reto Bachmann-Gmür (JIRA)" <ji...@apache.org> on 2013/01/10 11:38:12 UTC

[jira] [Resolved] (CLEREZZA-727) Error in hashCode implementation in org.apache.clerezza.rdf.core.impl.TripleImpl

     [ https://issues.apache.org/jira/browse/CLEREZZA-727?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Reto Bachmann-Gmür resolved CLEREZZA-727.
-----------------------------------------

    Resolution: Fixed
      Assignee: Reto Bachmann-Gmür

Fixed definition and implementation. This should make clerezz faster! Thanks for reporting!
                
> Error in hashCode implementation in org.apache.clerezza.rdf.core.impl.TripleImpl
> --------------------------------------------------------------------------------
>
>                 Key: CLEREZZA-727
>                 URL: https://issues.apache.org/jira/browse/CLEREZZA-727
>             Project: Clerezza
>          Issue Type: Bug
>          Components: rdf.core
>            Reporter: Giuseppe Miscione
>            Assignee: Reto Bachmann-Gmür
>            Priority: Minor
>              Labels: performance
>
> hashCode of --- class is implemented as
> public int hashCode() {
>     return (subject.hashCode() >> 1) ^ subject.hashCode() ^ (subject.hashCode() << 1);
> }
> and it's using only the subject part of the triple. It's correct implementation should be:
> public int hashCode() {
>     return (subject.hashCode() >> 1) ^ predicate.hashCode() ^ (object.hashCode() << 1);
> }
> The actual implementation works well with its corresponding equals method (the methods are coherent) but it can yield to performance degradation when using a lot of TripleImpl objects with the same subject as HashMap key.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira