/**
  * Returns a composed {@link BiDoubleToFloatFunction} that first applies the {@code before}
  * predicates to its input, and then applies this function to the result. If evaluation of either
  * operation throws an exception, it is relayed to the caller of the composed operation. This
  * method is just convenience, to provide the ability to execute an operation which accepts {@code
  * double} input, before this primitive function is executed.
  *
  * @param before1 The first predicate to apply before this function is applied
  * @param before2 The second predicate to apply before this function is applied
  * @return A composed {@code BiDoubleToFloatFunction} that first applies the {@code before}
  *     predicates to its input, and then applies this function to the result.
  * @throws NullPointerException If given argument is {@code null}
  * @implSpec The input argument of this method is a able to handle primitive values. In this case
  *     this is {@code double}.
  */
 @Nonnull
 default BiDoubleToFloatFunction composeFromDouble(
     @Nonnull final DoublePredicate before1, @Nonnull final DoublePredicate before2) {
   Objects.requireNonNull(before1);
   Objects.requireNonNull(before2);
   return (value1, value2) -> applyAsFloat(before1.test(value1), before2.test(value2));
 }
Example #2
0
 /**
  * Calls the given {@link DoublePredicate} with the given argument and returns its result.
  *
  * @param predicate The predicate to be called
  * @param value The argument to the predicate
  * @return The result from the given {@code DoublePredicate2}.
  * @throws NullPointerException If given argument is {@code null}
  */
 static boolean call(@Nonnull final DoublePredicate predicate, double value) {
   Objects.requireNonNull(predicate);
   return predicate.test(value);
 }
Example #3
0
 /**
  * Returns a composed predicate that represents a short-circuiting logical OR of this predicate
  * and another. When evaluating the composed predicate, if this predicate is {@code true}, then
  * the {@code other} predicate is not evaluated.
  *
  * <p>Any exceptions thrown during evaluation of either predicate are relayed to the caller; if
  * evaluation of this predicate throws an exception, the {@code other} predicate will not be
  * evaluated.
  *
  * @param other a predicate that will be logically-ORed with this predicate
  * @return a composed predicate that represents the short-circuiting logical OR of this predicate
  *     and the {@code other} predicate
  * @throws NullPointerException if other is null
  */
 default DoublePredicate or(DoublePredicate other) {
   Objects.requireNonNull(other);
   return (value) -> test(value) || other.test(value);
 }
Example #4
0
 /**
  * Returns a composed {@link DoublePredicate2} that represents a short-circuiting logical XOR of
  * this predicate and another. Any exceptions thrown during evaluation of either predicate is
  * relayed to the caller; if evaluation of this {@code DoublePredicate2} throws an exception, the
  * {@code other} predicate will not be evaluated.
  *
  * @param other A {@code DoublePredicate2} that will be logically-XORed with this one
  * @return A composed {@code DoublePredicate2} that represents the short-circuiting logical XOR of
  *     this predicate and the {@code other} predicate.
  * @throws NullPointerException If given argument is {@code null}
  * @see #and(DoublePredicate)
  * @see #or(DoublePredicate)
  */
 @Nonnull
 default DoublePredicate2 xor(@Nonnull final DoublePredicate other) {
   Objects.requireNonNull(other);
   return (value) -> test(value) ^ other.test(value);
 }