Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
lemire committed Jun 20, 2024
1 parent 72912ac commit f172205
Show file tree
Hide file tree
Showing 84 changed files with 581 additions and 578 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Make sure to compare your version against the latest available version at https:

**Java version:**

Please tell us which Java version you are using.
Please tell us which Java version you are using.



2 changes: 1 addition & 1 deletion LICENSE-2.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2013-2016 the RoaringBitmap authors
Copyright 2013-2016 the RoaringBitmap authors

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ When the bitset approach is applicable, it can be orders of
magnitude faster than other possible implementation of a set (e.g., as a hash set)
while using several times less memory.

However, a bitset, even a compressed one is not always applicable. For example, if
However, a bitset, even a compressed one is not always applicable. For example, if
you have 1000 random-looking integers, then a simple array might be the best representation.
We refer to this case as the "sparse" scenario.

Expand Down Expand Up @@ -157,7 +157,7 @@ Software: Practice and Experience 46 (5), 2016. [arXiv:1402.6407](http://arxiv.o
Code sample
-------------

```java
```java
import org.roaringbitmap.RoaringBitmap;

public class Basic {
Expand Down Expand Up @@ -317,14 +317,14 @@ the most significant 32~bits of elements
whereas the values of the tree are 32-bit Roaring bitmaps. The 32-bit Roaring bitmaps represent the least significant
bits of a set of elements.

The newer `Roaring64Bitmap` approach relies on the ART data structure to hold the key/value pair. The key
The newer `Roaring64Bitmap` approach relies on the ART data structure to hold the key/value pair. The key
is made of the most significant 48~bits of elements whereas the values are 16-bit Roaring containers. It is inspired by
[The Adaptive Radix Tree: ARTful Indexing for Main-Memory Databases](https://db.in.tum.de/~leis/papers/ART.pdf) by Leis et al. (ICDE '13).

```java
import org.roaringbitmap.longlong.*;


// first Roaring64NavigableMap
LongBitmapDataProvider r = Roaring64NavigableMap.bitmapOf(1,2,100,1000);
r.addLong(1234);
Expand Down Expand Up @@ -360,12 +360,12 @@ Range Bitmaps
`RangeBitmap` is a succinct data structure supporting range queries.
Each value added to the bitmap is associated with an incremental identifier,
and queries produce a `RoaringBitmap` of the identifiers associated with values
that satisfy the query. Every value added to the bitmap is stored separately,
so that if a value is added twice, it will be stored twice, and if that value
that satisfy the query. Every value added to the bitmap is stored separately,
so that if a value is added twice, it will be stored twice, and if that value
is less than some threshold, there will be at least two integers in the resultant
`RoaringBitmap`.

It is more efficient - in terms of both time and space - to
It is more efficient - in terms of both time and space - to
provide a maximum value. If you don't know the maximum value,
provide a `Long.MAX_VALUE`. Unsigned order is used like elsewhere in
the library.
Expand Down Expand Up @@ -430,7 +430,7 @@ If your project depends on roaring, you can specify the dependency in the Mave

where you should replace the version number by the version you require.

[For up-to-date releases, we recommend configuring maven and gradle to depend on the Jitpack repository](https://jitpack.io/#RoaringBitmap/RoaringBitmap).
[For up-to-date releases, we recommend configuring maven and gradle to depend on the Jitpack repository](https://jitpack.io/#RoaringBitmap/RoaringBitmap).

Usage
------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1915,7 +1915,7 @@ public char next() {
public int nextAsInt() {
return next();
}

@Override
public void advanceIfNeeded(char maxval) {
if (maxval < (position + 1) * 64) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

/**
* Enable customizing the {@link BitmapDataProvider} used by {@link Roaring64NavigableMap}
*
*
* @author Benoit Lacelle
*
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
public interface CharIterator extends Cloneable {
/**
* Creates a copy of the iterator.
*
*
* @return a clone of the current iterator
*/
CharIterator clone();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
package org.roaringbitmap;

/**
*
*
* This interface allows you to iterate over the containers in a roaring bitmap.
*
*/
Expand All @@ -18,44 +18,44 @@ public interface ContainerPointer extends Comparable<ContainerPointer>, Cloneabl

/**
* Create a copy
*
*
* @return return a clone of this pointer
*/
ContainerPointer clone();
ContainerPointer clone();

Check notice

Code scanning / CodeQL

Missing Override annotation Note

This method overrides
Object.clone
; it is advisable to add an Override annotation.

/**
* Return the cardinality of the current container
*
*
* @return the cardinality
*/
int getCardinality();

/**
* This method can be used to check whether there is current a valid container as it returns null
* when there is not.
*
*
* @return null or the current container
*/
Container getContainer();

/**
* Check whether the current container is a bitmap container.
*
*
* @return whether it is a bitmap container
*/
boolean isBitmapContainer();

/**
* Check whether the current container is a run container.
*
*
* @return whether it is a run container
*/
boolean isRunContainer();

/**
* The key is a 16-bit integer that indicates the position of the container in the roaring bitmap.
* To be interpreted as an unsigned integer.
*
*
* @return the key
*/
char key();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ private static int horizontalOrCardinality(RoaringBitmap... bitmaps) {
public static RoaringBitmap workAndMemoryShyAnd(long[] buffer, RoaringBitmap... bitmaps) {
if(buffer.length < 1024) {
throw new IllegalArgumentException("buffer should have at least 1024 elements.");
}
}
long[] words = buffer;
RoaringBitmap first = bitmaps[0];
for (int i = 0; i < first.highLowContainer.size; ++i) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
/**
* This extends {@link RoaringBitmap} to provide better performance for .rank and .select
* operations, at the cost of maintain a cache of cardinalities.
*
*
* On {@link RoaringBitmap#select(int)} and {@link RoaringBitmap#rank(int)} operations,
* {@link RoaringBitmap} needs to iterate along all underlying buckets to cumulate their
* cardinalities. This may lead to sub-optimal performance for application doing a large amount of
* .rank/.select over read-only {@link RoaringBitmap}, especially if the {@link RoaringBitmap} holds
* a large number of underlying buckets.
*
*
* This implementation will discard the cache of cardinality on any write operations, and it will
* memoize the computed cardinalities on any .rank or .select operation
*
*
* @author Benoit Lacelle
*
*/
Expand Down Expand Up @@ -264,7 +264,7 @@ public int select(int j) {

return value;
}

@Override
public long getLongSizeInBytes() {
long size = 8;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public interface ImmutableBitmapDataProvider {
* @return the cardinality
*/
int getCardinality();

/**
* Returns the number of distinct integers added to the bitmap (e.g., number of bits set).
* This returns a full 64-bit result.
Expand All @@ -46,16 +46,16 @@ public interface ImmutableBitmapDataProvider {

/**
* Visit all values in the bitmap and pass them to the consumer.
*
* * Usage:
*
* * Usage:
* <pre>
* {@code
* bitmap.forEach(new IntConsumer() {
*
* {@literal @}Override
* public void accept(int value) {
* // do something here
*
*
* }});
* }
* }
Expand All @@ -79,9 +79,9 @@ public interface ImmutableBitmapDataProvider {
* @return an Ordered, Distinct, Sorted and Sized IntStream in ascending order
*/
public default IntStream stream() {
int characteristics = Spliterator.ORDERED | Spliterator.DISTINCT | Spliterator.SORTED
int characteristics = Spliterator.ORDERED | Spliterator.DISTINCT | Spliterator.SORTED
| Spliterator.SIZED;
Spliterator.OfInt x = Spliterators.spliterator(new RoaringOfInt(getIntIterator()),
Spliterator.OfInt x = Spliterators.spliterator(new RoaringOfInt(getIntIterator()),
getCardinality(), characteristics);
return StreamSupport.intStream(x, false);
}
Expand All @@ -91,11 +91,11 @@ public default IntStream stream() {
*/
public default IntStream reverseStream() {
int characteristics = Spliterator.ORDERED | Spliterator.DISTINCT | Spliterator.SIZED;
Spliterator.OfInt x = Spliterators.spliterator(new RoaringOfInt(getReverseIntIterator()),
Spliterator.OfInt x = Spliterators.spliterator(new RoaringOfInt(getReverseIntIterator()),
getCardinality(), characteristics);
return StreamSupport.intStream(x, false);
}

/**
* This iterator may be faster than others
* @return iterator which works on batches of data.
Expand All @@ -104,13 +104,13 @@ public default IntStream reverseStream() {

/**
* Estimate of the memory usage of this data structure.
*
*
* Internally, this is computed as a 64-bit counter.
*
* @return estimated memory usage.
*/
int getSizeInBytes();

/**
* Estimate of the memory usage of this data structure. Provides
* full 64-bit number.
Expand Down Expand Up @@ -138,44 +138,44 @@ public default IntStream reverseStream() {
* Rank returns the number of integers that are smaller or equal to x (rank(infinity) would be
* getCardinality()). If you provide the smallest value as a parameter, this function will
* return 1. If provide a value smaller than the smallest value, it will return 0.
*
*
* The value is internally computed as a 64-bit number.
*
*
* @param x upper limit
*
* @return the rank
* @see <a href="https://en.wikipedia.org/wiki/Ranking#Ranking_in_statistics">Ranking in statistics</a>
* @see <a href="https://en.wikipedia.org/wiki/Ranking#Ranking_in_statistics">Ranking in statistics</a>
*/
int rank(int x);

/**
* Rank returns the number of integers that are smaller or equal to x (rankLong(infinity) would be
* getLongCardinality()). If you provide the smallest value as a parameter, this function will
* return 1. If provide a value smaller than the smallest value, it will return 0.
* Same as "rank" but produces a full 64-bit value.
*
*
* @param x upper limit
*
* @return the rank
* @see <a href="https://en.wikipedia.org/wiki/Ranking#Ranking_in_statistics">Ranking in statistics</a>
* @see <a href="https://en.wikipedia.org/wiki/Ranking#Ranking_in_statistics">Ranking in statistics</a>
*/
long rankLong(int x);

/**
* Computes the number of values in the interval [start,end) where
* start is included and end excluded.
* rangeCardinality(0,0x100000000) provides the total cardinality (getLongCardinality).
* The answer is a 64-bit value between 1 and 0x100000000.
*
* The answer is a 64-bit value between 1 and 0x100000000.
*
* @param start lower limit (included)
* @param end upper limit (excluded)
* @return the number of elements in [start,end), between 0 and 0x100000000.
*/
long rangeCardinality(long start, long end);

/**
* Return the jth value stored in this bitmap. The provided value
* needs to be smaller than the cardinality otherwise an
* Return the jth value stored in this bitmap. The provided value
* needs to be smaller than the cardinality otherwise an
* IllegalArgumentException
* exception is thrown. The smallest value is at index 0.
* Note that this function differs in convention from the rank function which
Expand All @@ -184,7 +184,7 @@ public default IntStream reverseStream() {
* @param j index of the value
*
* @return the value
* @see <a href="https://en.wikipedia.org/wiki/Selection_algorithm">Selection algorithm</a>
* @see <a href="https://en.wikipedia.org/wiki/Selection_algorithm">Selection algorithm</a>
*/
int select(int j);

Expand Down Expand Up @@ -215,7 +215,7 @@ public default IntStream reverseStream() {
* or {@code -1} if there is no such value
*/
long nextValue(int fromValue);

/**
* Returns the first value less than or equal to the provided value
* (interpreted as an unsigned integer). If no such
Expand Down Expand Up @@ -263,11 +263,11 @@ public default IntStream reverseStream() {
/**
* Serialize this bitmap to a ByteBuffer.
* This is the preferred method
* to serialize to a byte array (byte[]) or to a String
* to serialize to a byte array (byte[]) or to a String
* (via Base64.getEncoder().encodeToString)..
*
*
* Irrespective of the endianess of the provided buffer, data is
*
* Irrespective of the endianess of the provided buffer, data is
* written using LITTlE_ENDIAN as per the RoaringBitmap specification.
*
* The current bitmap is not modified.
Expand Down Expand Up @@ -301,8 +301,8 @@ public default IntStream reverseStream() {
/**
* An internal class to help provide streams.
* Sad but true the interface of IntIterator and PrimitiveIterator.OfInt
* Does not match. Otherwise it would be easier to just make IntIterator
* implement PrimitiveIterator.OfInt.
* Does not match. Otherwise it would be easier to just make IntIterator
* implement PrimitiveIterator.OfInt.
*/
static final class RoaringOfInt implements PrimitiveIterator.OfInt {
private final IntIterator iterator;
Expand Down
Loading

0 comments on commit f172205

Please sign in to comment.