[ 
https://issues.apache.org/jira/browse/COLLECTIONS-728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17001015#comment-17001015
 ] 

Claude Warren commented on COLLECTIONS-728:
-------------------------------------------

The hash computation is used in the Hasher class.  It is generally only used 
when creating Bloom filters.  In some cases it is used when determining if an 
object is in the filter.

I originally implemented Serializable in several objects but that was removed 
early on.  As Sebb pointed out there are security issues with classes that 
implement Serializable[1].

Your description of how to add a hash function is basically correct.  However, 
I think there is a misunderstanding.

The `HashFunctionIdentity` provides the information necessary it identify the 
function.  it is used in the `Shape` class which in turn is used in the 
`BloomFilter` class.

The `HashFunction` interface is much as you suggest except that `HashFunction` 
extends `HashFunctionIdentity`.  So a user wanting to add a new hash function 
would create a HashFunction instance (MyHash) that identifies the function and 
contains a call to that function via the `compute()` method.

When Shapes or BloomFilters that were created with MyHash are serialized by the 
application (application responsibility) the HashFunctionIdentity will be 
serialized.  The application deserializing the HashFunctionIdentity will either 
need to have the MyHash class or another implementation of the same function.

I hope this helps.

 

[1] 
[https://lists.apache.org/thread.html/7a0bb63540e52b97f08c608f11c2fd9dd5b770c6f21cdc04a8c29e6d%40%3Cdev.commons.apache.org%3E]

> 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)

Reply via email to