Skip to content

Commit

Permalink
simplify calculateBitMask?
Browse files Browse the repository at this point in the history
  • Loading branch information
awildturtok committed Apr 10, 2024
1 parent f4aeaaa commit 14b4085
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -227,13 +227,15 @@ private static Map<String, Long> calculateConceptElementPathBloomFilter(int buck
* Calculates the bloom filter from the precomputed path to the most specific {@link ConceptTreeChild}.
*/
public static long calculateBitMask(int pathIndex, int[] mostSpecificChild) {
if (pathIndex < 0) {
return 0;
}
if (mostSpecificChild[pathIndex] < Long.SIZE) {
return 1L << mostSpecificChild[pathIndex];

for (int index = pathIndex; index > 0; index--) {
// TODO how could they be > Long.SIZE?
if (mostSpecificChild[index] < Long.SIZE) {
return 1L << mostSpecificChild[index];
}
}
return calculateBitMask(pathIndex - 1, mostSpecificChild);

return 0;
}

/**
Expand Down

0 comments on commit 14b4085

Please sign in to comment.