Skip to content

Commit

Permalink
Merge 1810431 into 9f2041e
Browse files Browse the repository at this point in the history
  • Loading branch information
lemire committed Dec 6, 2019
2 parents 9f2041e + 1810431 commit 2c7b1bc
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 7 deletions.
Expand Up @@ -363,6 +363,28 @@ private int getStartOfKeys() {
}
}


@Override
public boolean equals(Object o) {
if (o instanceof ImmutableRoaringArray) {
ImmutableRoaringArray srb = (ImmutableRoaringArray)o;
if (srb.size() != this.size()) {
return false;
}
MappeableContainerPointer cp = this.getContainerPointer();
MappeableContainerPointer cpo = srb.getContainerPointer();
while(cp.hasContainer() && cpo.hasContainer()) {
if(cp.key() != cpo.key()) {
return false;
}
if(!cp.getContainer().equals(cpo.getContainer())) {
return false;
}
}
}
return false;
}

@Override
public int hashCode() {
MappeableContainerPointer cp = this.getContainerPointer();
Expand Down
Expand Up @@ -555,6 +555,27 @@ public short getKeyAtIndex(int i) {
return this.keys[i];
}

@Override
public boolean equals(Object o) {
if (o instanceof ImmutableRoaringArray) {
ImmutableRoaringArray srb = (ImmutableRoaringArray)o;
if (srb.size() != this.size()) {
return false;
}
MappeableContainerPointer cp = this.getContainerPointer();
MappeableContainerPointer cpo = srb.getContainerPointer();
while(cp.hasContainer() && cpo.hasContainer()) {
if(cp.key() != cpo.key()) {
return false;
}
if(!cp.getContainer().equals(cpo.getContainer())) {
return false;
}
}
}
return false;
}

@Override
public int hashCode() {
int hashvalue = 0;
Expand Down
Expand Up @@ -1107,13 +1107,6 @@ public MutableRoaringArray getMappeableRoaringArray() {
return (MutableRoaringArray) highLowContainer;
}


@Override
public int hashCode() {
return highLowContainer.hashCode();
}


/**
* iterate over the positions of the true values.
*
Expand Down

0 comments on commit 2c7b1bc

Please sign in to comment.