Comparing Two Iter Objects.
Tuesday, 24 February 2015 · 4 messages
AK
ankit kumar24 Feb 2015 14:44 #
Hi,
I want to compare equality for two Iter objects. Each contains a set of DBNodes in unordered manner. I have created a wrapper for Iter object. Can you please help me in defining equals and hashcode method for the wrapper.
Thanks
Ankit
CG
Christian Grün24 Feb 2015 14:48 #
Quoted text · ankit kumar · 2 lines
> Can > you please help me in defining equals and hashcode method for the wrapper.
This may help (it's the code used for the XQuery operator "is", which compares the node identity of two nodes for equality):
https://github.com/BaseXdb/basex/blob/master/basex-core/src/main/java/org/basex/query/value/node/DBNode.java#L200-L204
AK
ankit kumar24 Feb 2015 15:37 #
Hi ,
Thanks for the help.
We have two Result object, Both are pointing to the same set of nodes but having different order. We are trying to check whether two result are same using Result's sameAs() method but it is returning false when orders mismatch.
Thanks
Quoted text · Christian Grün · 12 lines
On 24 February 2015 at 19:18, Christian Grün <christian.gruen at gmail.com> wrote: > > Can > > you please help me in defining equals and hashcode method for the > wrapper. > > This may help (it's the code used for the XQuery operator "is", which > compares the node identity of two nodes for equality): > > > https://github.com/BaseXdb/basex/blob/master/basex-core/src/main/java/org/basex/query/value/node/DBNode.java#L200-L204 >
CG
Christian Grün24 Feb 2015 15:46 #
What about using XQuery?
let $a := ...
let $b := ...
return deep-equal($a/., $a/.)Quoted text · ankit kumar · 26 lines
On Tue, Feb 24, 2015 at 3:37 PM, ankit kumar <anky4bugs at gmail.com> wrote: > Hi , > > Thanks for the help. > > We have two Result object, Both are pointing to the same set of nodes but > having different order. We are trying to check whether two result are same > using Result's sameAs() method but it is returning false when orders > mismatch. > > Thanks > > On 24 February 2015 at 19:18, Christian Grün <christian.gruen at gmail.com> > wrote: >> >> > Can >> > you please help me in defining equals and hashcode method for the >> > wrapper. >> >> This may help (it's the code used for the XQuery operator "is", which >> compares the node identity of two nodes for equality): >> >> >> https://github.com/BaseXdb/basex/blob/master/basex-core/src/main/java/org/basex/query/value/node/DBNode.java#L200-L204 > >
Written for BaseX 8.0. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery