[ 
https://issues.apache.org/jira/browse/CLEREZZA-686?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13207603#comment-13207603
 ] 

Daniel Spicar commented on CLEREZZA-686:
----------------------------------------

Hmm that is true. But it means that that g and w are different graphs because:
- g does not equals w 
and 
- w does not equal g

An implementation according to this would be:

        public boolean equals(Object obj) {
                if(obj == null) {
                        return false;
                }
                if(obj == this) {
                        return true;
                }
                if(obj.getClass() != getClass()) {
                        return false;
                }
                
                LockableMGraphWrapper other = (LockableMGraphWrapper) obj;
                return wrapped.equals(other.wrapped);
        }

Now how would we test two graphs for graph equality (such that g and w are the 
same graph) while maintaining symmetry? If we had something like a graph ID in 
protected scope we could do that by persistently comparing the IDs in all equal 
implementations in all Graphs.

What do you think? Is it even necessary?
                
> LockableMGraphWrapper does not implement hashCode, equals and toString
> ----------------------------------------------------------------------
>
>                 Key: CLEREZZA-686
>                 URL: https://issues.apache.org/jira/browse/CLEREZZA-686
>             Project: Clerezza
>          Issue Type: Improvement
>          Components: rdf.core
>            Reporter: Rupert Westenthaler
>            Assignee: Daniel Spicar
>            Priority: Trivial
>         Attachments: 
> CLEREZZA-686_rdf.core-LockableMGraphWrapper-hasCode-equals-toString.patch
>
>
> LockableMGraphWrapper does not implement hashCode, equals and toString. This 
> is not a big issue, because MGraphs are rarely used with sets or maps, but it 
> is at least inconvenient for logging and debugging.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to