Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add default implementation of bit vector. #3

Merged
merged 5 commits into from
Feb 17, 2014

Conversation

julianmendez
Copy link
Member

This implementation is based on an array of long, and does not include
'rank' and 'select' yet.

This implementation is based on an array of long, and does not include 
'rank' and 'select' yet.
@mkroetzsch
Copy link
Member

I added some comments. Not sure if you get any email notifications from the inline/commit comments I made (they do not seem to count as comments in the issue view), so I am posting another one here.

@julianmendez
Copy link
Member Author

I received all comments in separate e-mail messages.

Julian Mendez added 2 commits February 6, 2014 22:02
The changes commented in the code review are already applied.
*
* @return <code>true</code> if the element was successfully added.
*/
boolean add(boolean element);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be "addBit"? (to match "getBit" and "setBit")
Also, could we call the value "value" like in setBit()? Or maybe best call it "bit" in all locations. The RankedBitVector uses "bit" already. setBit uses "value", add uses "element". I think "bit" is clearest.

@mkroetzsch
Copy link
Member

I reviewed the new code. Mainly small comments about parameter naming based on our new style conventions (I guess my code also needs to be updated for this now ;-). Also some remarks on equals(). Rest looking good. Nice touch testing with the pseudo-random bits.

Btw, if you want to continue with the ranked vector, maybe make a new branch so that this one can be merged soon; I guess it's ok to branch off from a feature branch that gets merged.

@coveralls
Copy link

Coverage Status

Coverage decreased (-6.65%) when pulling cb86fed on implementation-of-bit-vector into b29626b on master.


for (int i = 0; ret && (i < arraySize); i++) {
ret = ret
&& (this.arrayOfBits[i] == otherBitVectorImpl.arrayOfBits[i]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can get rid of ret completely by replacing this line by
if (this.arrayOfBits[i] == otherBitVectorImpl.arrayOfBits[i]) return false;
(and similarly below). Then the last return ret just becomes return true. This improves efficiency since it stops scanning the vector as soon as a difference is found.

@mkroetzsch
Copy link
Member

Looks good. I just have one last comment regarding efficiency of equals().

mkroetzsch added a commit that referenced this pull request Feb 17, 2014
Add default implementation of bit vector.
@mkroetzsch mkroetzsch merged commit 2065a67 into master Feb 17, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants