Class CountingPredicate<T>

java.lang.Object
org.apache.commons.collections4.bloomfilter.CountingPredicate<T>
Type Parameters:
T - the type of object being compared.
All Implemented Interfaces:
Predicate<T>

class CountingPredicate<T> extends Object implements Predicate<T>
A predicate that applies the test func to each member of the ary in sequence for each call to test(). if the ary is exhausted, the subsequent calls to test are executed with a null value. If the calls to test do not exhaust the ary the processRemaining method can be called to execute the @{code test} with a null value for each remaining idx value.
  • Field Details

    • idx

      private int idx
    • ary

      private final T[] ary
    • func

      private final BiPredicate<T,T> func
  • Constructor Details

    • CountingPredicate

      CountingPredicate(T[] ary, BiPredicate<T,T> func)
      Constructs an instance that will compare the elements in ary with the elements returned by func. function is called as func.test( idxValue, otherValue ). If there are more otherValue values than idxValues then func is called as func.test(null, otherValue).
      Parameters:
      ary - The array of long values to compare.
      func - The function to apply to the pairs of long values.
  • Method Details

    • processRemaining

      boolean processRemaining()
      Call BiPredicate<T, T> for each remaining unpaired <T> in the input array. This method should be invoked after the predicate has been passed to a Extractor.forEach<T>(BiPredicate<T, T>) to consume any unpaired <T>s. The second argument to the BiPredicate will be null.
      Returns:
      true if all calls to the predicate were successful
    • test

      public boolean test(T other)
      Specified by:
      test in interface Predicate<T>