Uploaded image for project: 'Commons Collections'
  1. Commons Collections
  2. COLLECTIONS-817

BloomFilter: Converting Double to Int

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • None
    • 4.5
    • Collection

    Description

      https://github.com/Claudenw/commons-collections/blob/9f2945cc98747893456b73f42ab53f46a866ac37/src/main/java/org/apache/commons/collections4/bloomfilter/BloomFilter.java#L216-L251

      Should this be a double?

      Since this is a pass through method that is converting a precise value from the shape into an imprecise one I would recommend removing it. A paragraph can be added to the class javadoc on how to estimate N and also the size of the union and intersection with another filter. Those methods also suffer from the same inaccuracy. If this functionality was moved to class javadoc then it is clear to the user how to compute it and what the computation requires.

      Another issue is that the argument filter's shape is not checked. The merge should join the smaller filter into the bigger one and then the estimateN called on the larger filter. Otherwise this method is not symmetric. One way would be fine but the other would result in a merge error.

      If this is only intended for filters with the same number of bits then the expected result of a mismatch is not documented.

       

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              claude Claude Warren
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: