net.mintern.functions.ternary.DblIntLongToBool Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of functions-ternary-core Show documentation
Show all versions of functions-ternary-core Show documentation
Provides functional interfaces for the most commonly used two-argument functions
package net.mintern.functions.ternary;
/**
* An operation of type {@code (double, int, long) -> boolean}.
*
*/
@FunctionalInterface
public interface DblIntLongToBool extends
net.mintern.functions.ternary.checked.DblIntLongToBoolE {
/**
* Returns a wrapped version of {@code f} that uses {@code toRuntime} to convert any checked
* {@code Exception} to a {@code RuntimeException}.
*
* @param the {@code Exception} type that the operation may throw
* @param toRuntime if a checked exception is thrown from
* {@link net.mintern.functions.ternary.checked.DblIntLongToBoolE#call}, then this function
* is called in in order to convert it to a {@code RuntimeException}
* @param f the operation to wrap
* @return a wrapped version of {@code f} that does not throw checked exceptions
*/
@SuppressWarnings("unchecked")
static DblIntLongToBool unchecked(
java.util.function.Function super E, RuntimeException> toRuntime,
net.mintern.functions.ternary.checked.DblIntLongToBoolE f) {
return (d, i, l) -> {
try {
return f.call(d, i, l);
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw toRuntime.apply((E) e);
}
};
}
/**
* Returns a wrapped version of {@code f} that wraps any checked {@code Exception} with a
* {@code RuntimeException}.
*
* @param the {@code Exception} type that the operation may throw
* @param f the operation to wrap
* @return a wrapped version of {@code f} that does not throw checked exceptions
*/
static DblIntLongToBool unchecked(
net.mintern.functions.ternary.checked.DblIntLongToBoolE f) {
return unchecked(RuntimeException::new, f);
}
/**
* Returns a wrapped version of {@code f} that wraps any {@code IOException} with an
* {@link java.io.UncheckedIOException}.
*
* @param the {@code Exception} type that the operation may throw
* @param f the operation to wrap
* @return a wrapped version of {@code f} that throws {@code UncheckedIOException} instead of
* {@code IOException}
*/
static DblIntLongToBool uncheckedIO(
net.mintern.functions.ternary.checked.DblIntLongToBoolE f) {
return unchecked(java.io.UncheckedIOException::new, f);
}
/**
* Binds {@code (d)} to the beginning of {@code f}, returning a new function
* of type {@code (int, long) -> boolean}.
*
* @param f the unbound function
* @param d argument 1
* @return a new function {@code (int i, long l) -> boolean} that calls
* {@code f.call(d, i, l)} and returns the result.
*/
static net.mintern.functions.binary.IntLongToBool
bind(DblIntLongToBool f, double d) {
return (i, l) -> f.call(d, i, l);
}
/**
* Binds {@code (d)} to the beginning of {@code this}, returning a new function
* of type {@code (int, long) -> boolean}.
*
* @param d argument 1
* @return a new function {@code (int i, long l) -> boolean} that calls
* {@code this.call(d, i, l)} and returns the result.
*/
@Override
default net.mintern.functions.binary.IntLongToBool bind(double d) {
return DblIntLongToBool.bind(this, d);
}
/**
* Binds {@code (i, l)} to the end of {@code f}, returning a new function
* of type {@code (double) -> boolean}.
*
* @param f the unbound function
* @param i argument 2
* @param l argument 3
* @return a new function {@code (double d) -> boolean} that calls
* {@code f.call(d, i, l)} and returns the result.
*/
static net.mintern.functions.unary.DblToBool
rbind(DblIntLongToBool f, int i, long l) {
return (d) -> f.call(d, i, l);
}
/**
* Binds {@code (i, l)} to the end of {@code this}, returning a new function
* of type {@code (double) -> boolean}.
*
* @param i argument 2
* @param l argument 3
* @return a new function {@code (double d) -> boolean} that calls
* {@code this.call(d, i, l)} and returns the result.
*/
@Override
default net.mintern.functions.unary.DblToBool rbind(int i, long l) {
return DblIntLongToBool.rbind(this, i, l);
}
/**
* Binds {@code (d, i)} to the beginning of {@code f}, returning a new function
* of type {@code (long) -> boolean}.
*
* @param f the unbound function
* @param d argument 1
* @param i argument 2
* @return a new function {@code (long l) -> boolean} that calls
* {@code f.call(d, i, l)} and returns the result.
*/
static net.mintern.functions.unary.LongToBool
bind(DblIntLongToBool f, double d, int i) {
return (l) -> f.call(d, i, l);
}
/**
* Binds {@code (d, i)} to the beginning of {@code this}, returning a new function
* of type {@code (long) -> boolean}.
*
* @param d argument 1
* @param i argument 2
* @return a new function {@code (long l) -> boolean} that calls
* {@code this.call(d, i, l)} and returns the result.
*/
@Override
default net.mintern.functions.unary.LongToBool bind(double d, int i) {
return DblIntLongToBool.bind(this, d, i);
}
/**
* Binds {@code (l)} to the end of {@code f}, returning a new function
* of type {@code (double, int) -> boolean}.
*
* @param f the unbound function
* @param l argument 3
* @return a new function {@code (double d, int i) -> boolean} that calls
* {@code f.call(d, i, l)} and returns the result.
*/
static net.mintern.functions.binary.DblIntToBool
rbind(DblIntLongToBool f, long l) {
return (d, i) -> f.call(d, i, l);
}
/**
* Binds {@code (l)} to the end of {@code this}, returning a new function
* of type {@code (double, int) -> boolean}.
*
* @param l argument 3
* @return a new function {@code (double d, int i) -> boolean} that calls
* {@code this.call(d, i, l)} and returns the result.
*/
@Override
default net.mintern.functions.binary.DblIntToBool rbind(long l) {
return DblIntLongToBool.rbind(this, l);
}
/**
* Binds {@code (d, i, l)} to {@code f}, returning a new function
* of type {@code () -> boolean}.
*
* @param f the unbound function
* @param d argument 1
* @param i argument 2
* @param l argument 3
* @return a new function {@code () -> boolean} that calls
* {@code f.call(d, i, l)} and returns the result.
*/
static net.mintern.functions.nullary.NilToBool
bind(DblIntLongToBool f, double d, int i, long l) {
return () -> f.call(d, i, l);
}
/**
* Binds {@code (d, i, l)} to {@code this}, returning a new function
* of type {@code () -> boolean}.
*
* @param d argument 1
* @param i argument 2
* @param l argument 3
* @return a new function {@code () -> boolean} that calls
* {@code this.call(d, i, l)} and returns the result.
*/
@Override
default net.mintern.functions.nullary.NilToBool bind(double d, int i, long l) {
return DblIntLongToBool.bind(this, d, i, l);
}
}