You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2022/11/11 14:40:20 UTC
[GitHub] [commons-collections] Claudenw opened a new pull request, #361: Removed HasherCollection
Claudenw opened a new pull request, #361:
URL: https://github.com/apache/commons-collections/pull/361
Fix for COLLECTIONS-836
Removed HasherCollection
Moved multiple hashing functions into TestingHashers.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [commons-collections] codecov-commenter commented on pull request #361: Removed HasherCollection
Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #361:
URL: https://github.com/apache/commons-collections/pull/361#issuecomment-1312492882
# [Codecov](https://codecov.io/gh/apache/commons-collections/pull/361?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#361](https://codecov.io/gh/apache/commons-collections/pull/361?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (5b181b3) into [master](https://codecov.io/gh/apache/commons-collections/commit/69cad46a9249d7f0308547e2a0bfd5c959872feb?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (69cad46) will **decrease** coverage by `0.01%`.
> The diff coverage is `n/a`.
```diff
@@ Coverage Diff @@
## master #361 +/- ##
============================================
- Coverage 81.11% 81.10% -0.02%
+ Complexity 4601 4592 -9
============================================
Files 289 288 -1
Lines 13452 13407 -45
Branches 1979 1975 -4
============================================
- Hits 10912 10874 -38
+ Misses 1939 1935 -4
+ Partials 601 598 -3
```
| [Impacted Files](https://codecov.io/gh/apache/commons-collections/pull/361?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [.../collections4/bloomfilter/CountingBloomFilter.java](https://codecov.io/gh/apache/commons-collections/pull/361/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2NvbW1vbnMvY29sbGVjdGlvbnM0L2Jsb29tZmlsdGVyL0NvdW50aW5nQmxvb21GaWx0ZXIuamF2YQ==) | `100.00% <ø> (ø)` | |
| [...commons/collections4/map/AbstractReferenceMap.java](https://codecov.io/gh/apache/commons-collections/pull/361/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2NvbW1vbnMvY29sbGVjdGlvbnM0L21hcC9BYnN0cmFjdFJlZmVyZW5jZU1hcC5qYXZh) | `76.22% <0.00%> (+2.44%)` | :arrow_up: |
:mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [commons-collections] Claudenw commented on a diff in pull request #361: Removed HasherCollection
Posted by GitBox <gi...@apache.org>.
Claudenw commented on code in PR #361:
URL: https://github.com/apache/commons-collections/pull/361#discussion_r1020766634
##########
src/test/java/org/apache/commons/collections4/bloomfilter/TestingHashers.java:
##########
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections4.bloomfilter;
+/**
+ * A collection of methods and statics that represent standard hashers in testing.
+ */
+public class TestingHashers {
+ /**
+ * Hasher that increments from 1
+ */
+ public static final Hasher from1 = new IncrementingHasher(1, 1);
+
+ /**
+ * Hasher that increments from 11
+ */
+ public static final Hasher from11 = new IncrementingHasher(11, 1);
+
+ /**
+ * Do not instantiate
+ */
+ private TestingHashers() {}
+
+ /**
+ * Merge several Hashers together into a single Bloom filter.
+ * @param <T> The type of bloom filter.
+ * @param filter The Bloom filter to populate
+ * @param hashers The hashers to merge
+ * @return {@code filter} for chaining
+ */
+ public static <T extends BloomFilter> T mergeHashers(T filter, Hasher...hashers) {
+ for (Hasher h : hashers) {
+ filter.merge(h);
+ }
+ return filter;
+ }
+
+ /**
+ * Merge {@code from1} and {@code from11} into a single Bloom filter.
+ * @param <T> The type of bloom filter.
+ * @param filter The Bloom filter to populate
+ * @return {@code filter} for chaining
+ */
+ public static <T extends BloomFilter> T bigHasher(T filter) {
+ return mergeHashers(filter, from1, from11);
+ }
+
+ /**
+ * Create a hasher that fills the entire range.
+ * @param <T> the Bloom filter type.
+ * @param filter the Bloom filter to populate
+ * @return {@code filter} for chaining
+ */
+ public static <T extends BloomFilter> T fullHasher(T filter) {
+ for (int i=0; i<filter.getShape().getNumberOfBits(); i+=filter.getShape().getNumberOfHashFunctions()) {
Review Comment:
fixed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [commons-collections] Claudenw commented on a diff in pull request #361: Removed HasherCollection
Posted by GitBox <gi...@apache.org>.
Claudenw commented on code in PR #361:
URL: https://github.com/apache/commons-collections/pull/361#discussion_r1020766201
##########
src/test/java/org/apache/commons/collections4/bloomfilter/TestingHashers.java:
##########
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections4.bloomfilter;
+/**
+ * A collection of methods and statics that represent standard hashers in testing.
+ */
+public class TestingHashers {
Review Comment:
made package private
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [commons-collections] aherbert commented on a diff in pull request #361: Removed HasherCollection
Posted by GitBox <gi...@apache.org>.
aherbert commented on code in PR #361:
URL: https://github.com/apache/commons-collections/pull/361#discussion_r1020361357
##########
src/test/java/org/apache/commons/collections4/bloomfilter/TestingHashers.java:
##########
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections4.bloomfilter;
+/**
+ * A collection of methods and statics that represent standard hashers in testing.
+ */
+public class TestingHashers {
Review Comment:
No requirement for `public` in the class or any methods.
##########
src/test/java/org/apache/commons/collections4/bloomfilter/TestingHashers.java:
##########
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections4.bloomfilter;
+/**
Review Comment:
Add an empty line
##########
src/test/java/org/apache/commons/collections4/bloomfilter/TestingHashers.java:
##########
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections4.bloomfilter;
+/**
+ * A collection of methods and statics that represent standard hashers in testing.
+ */
+public class TestingHashers {
+ /**
+ * Hasher that increments from 1
+ */
+ public static final Hasher from1 = new IncrementingHasher(1, 1);
+
+ /**
+ * Hasher that increments from 11
+ */
+ public static final Hasher from11 = new IncrementingHasher(11, 1);
+
+ /**
+ * Do not instantiate
+ */
+ private TestingHashers() {}
+
+ /**
+ * Merge several Hashers together into a single Bloom filter.
+ * @param <T> The type of bloom filter.
+ * @param filter The Bloom filter to populate
+ * @param hashers The hashers to merge
+ * @return {@code filter} for chaining
+ */
+ public static <T extends BloomFilter> T mergeHashers(T filter, Hasher...hashers) {
+ for (Hasher h : hashers) {
+ filter.merge(h);
+ }
+ return filter;
+ }
+
+ /**
+ * Merge {@code from1} and {@code from11} into a single Bloom filter.
+ * @param <T> The type of bloom filter.
+ * @param filter The Bloom filter to populate
+ * @return {@code filter} for chaining
+ */
+ public static <T extends BloomFilter> T bigHasher(T filter) {
+ return mergeHashers(filter, from1, from11);
+ }
+
+ /**
+ * Create a hasher that fills the entire range.
+ * @param <T> the Bloom filter type.
+ * @param filter the Bloom filter to populate
+ * @return {@code filter} for chaining
+ */
+ public static <T extends BloomFilter> T fullHasher(T filter) {
+ for (int i=0; i<filter.getShape().getNumberOfBits(); i+=filter.getShape().getNumberOfHashFunctions()) {
Review Comment:
Whitespace:
```Java
int n = filter.getShape().getNumberOfBits();
int k = filter.getShape().getNumberOfHashFunctions();
for (int i = 0; i < n; i += k) {
##########
src/test/java/org/apache/commons/collections4/bloomfilter/TestingHashers.java:
##########
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections4.bloomfilter;
+/**
+ * A collection of methods and statics that represent standard hashers in testing.
+ */
+public class TestingHashers {
+ /**
+ * Hasher that increments from 1
+ */
+ public static final Hasher from1 = new IncrementingHasher(1, 1);
Review Comment:
Naming conventions: `FROM1`
##########
src/test/java/org/apache/commons/collections4/bloomfilter/TestingHashers.java:
##########
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections4.bloomfilter;
+/**
+ * A collection of methods and statics that represent standard hashers in testing.
+ */
+public class TestingHashers {
+ /**
+ * Hasher that increments from 1
+ */
+ public static final Hasher from1 = new IncrementingHasher(1, 1);
+
+ /**
+ * Hasher that increments from 11
Review Comment:
Full stop
##########
src/test/java/org/apache/commons/collections4/bloomfilter/TestingHashers.java:
##########
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections4.bloomfilter;
+/**
+ * A collection of methods and statics that represent standard hashers in testing.
+ */
+public class TestingHashers {
+ /**
+ * Hasher that increments from 1
+ */
+ public static final Hasher from1 = new IncrementingHasher(1, 1);
+
+ /**
+ * Hasher that increments from 11
+ */
+ public static final Hasher from11 = new IncrementingHasher(11, 1);
Review Comment:
Naming conventions: `FROM11`
##########
src/test/java/org/apache/commons/collections4/bloomfilter/TestingHashers.java:
##########
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections4.bloomfilter;
+/**
+ * A collection of methods and statics that represent standard hashers in testing.
+ */
+public class TestingHashers {
+ /**
+ * Hasher that increments from 1
+ */
+ public static final Hasher from1 = new IncrementingHasher(1, 1);
+
+ /**
+ * Hasher that increments from 11
+ */
+ public static final Hasher from11 = new IncrementingHasher(11, 1);
+
+ /**
+ * Do not instantiate
Review Comment:
Full stop
##########
src/test/java/org/apache/commons/collections4/bloomfilter/TestingHashers.java:
##########
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections4.bloomfilter;
+/**
+ * A collection of methods and statics that represent standard hashers in testing.
+ */
+public class TestingHashers {
+ /**
+ * Hasher that increments from 1
+ */
+ public static final Hasher from1 = new IncrementingHasher(1, 1);
+
+ /**
+ * Hasher that increments from 11
+ */
+ public static final Hasher from11 = new IncrementingHasher(11, 1);
+
+ /**
+ * Do not instantiate
+ */
+ private TestingHashers() {}
+
+ /**
+ * Merge several Hashers together into a single Bloom filter.
+ * @param <T> The type of bloom filter.
+ * @param filter The Bloom filter to populate
+ * @param hashers The hashers to merge
+ * @return {@code filter} for chaining
+ */
+ public static <T extends BloomFilter> T mergeHashers(T filter, Hasher...hashers) {
+ for (Hasher h : hashers) {
+ filter.merge(h);
+ }
+ return filter;
+ }
+
+ /**
+ * Merge {@code from1} and {@code from11} into a single Bloom filter.
+ * @param <T> The type of bloom filter.
+ * @param filter The Bloom filter to populate
+ * @return {@code filter} for chaining
+ */
+ public static <T extends BloomFilter> T bigHasher(T filter) {
Review Comment:
A self-documenting name would be useful here: `mergeHasherFrom1AndHasherFrom11`
##########
src/test/java/org/apache/commons/collections4/bloomfilter/TestingHashers.java:
##########
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.collections4.bloomfilter;
+/**
+ * A collection of methods and statics that represent standard hashers in testing.
+ */
+public class TestingHashers {
+ /**
+ * Hasher that increments from 1
Review Comment:
Full stop.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [commons-collections] aherbert merged pull request #361: Removed HasherCollection
Posted by GitBox <gi...@apache.org>.
aherbert merged PR #361:
URL: https://github.com/apache/commons-collections/pull/361
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org