[
https://issues.apache.org/jira/browse/COLLECTIONS-728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16990888#comment-16990888
]
Claude Warren commented on COLLECTIONS-728:
-------------------------------------------
The idea of using ID's for each provider/hash function is interesting, but it
will require that a group (Apache Commons in the proposal) take the
responsibility for registering them. I don't know that Apache wants to take
that on.
Perhaps there is an interesting middle ground between the proposals from the 3
of us.
Change the HashFunction interface shown above to not extend ToLongBiFunction<>
but to contain a method `apply( byte[] buffer, int seed)`
Also add a method `long getSignature()` that will be implemented as:
{noformat}
public long getSignature() {
byte[] b = new byte[ getName().getBytes("UTF-8") ];
byte[] b2 = new byte[ b.length ];
b2[0] = (byte)((isIterative()?0x1:0) & (isUnsigned()?0x2:0));
System.arrayCopy( b1, 0, b2, 1, b1.length );
return apply( b, 0 );
}
{noformat}
Now, the value for the function is the function information hashed by the
function. A list of function names and flags with correct signature can be
provided and easily checked by implementers.
The interface could be changed to an abstract class and the getSignature()
listed above could be made final and implemented to store the signature in a
Long the first time it is calculated.
Now the getSignature() can be used to verify that the methods are the same, and
the name is still available for user display. The implementation checks can be
quickly added to the code base as a property file.
Might this be a compromise that works for all of us?
I think this means we still need to implement a JCA style factory and register
an Apache commons provider as default.
> BloomFilter contribution
> ------------------------
>
> Key: COLLECTIONS-728
> URL: https://issues.apache.org/jira/browse/COLLECTIONS-728
> Project: Commons Collections
> Issue Type: Task
> Reporter: Claude Warren
> Priority: Minor
> Attachments: BF_Func.md, BloomFilter.java, BloomFilterI2.java,
> Usage.md
>
>
> Contribution of BloomFilter library comprising base implementation and gated
> collections.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)