net.mintern.functions.ternary.LongIntDblToNil 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 (long, int, double) -> void}.
*
*/
@FunctionalInterface
public interface LongIntDblToNil extends
net.mintern.functions.ternary.checked.LongIntDblToNilE {
/**
* 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.LongIntDblToNilE#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 LongIntDblToNil unchecked(
java.util.function.Function super E, RuntimeException> toRuntime,
net.mintern.functions.ternary.checked.LongIntDblToNilE f) {
return (l, i, d) -> {
try {
f.call(l, i, d);
} 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 LongIntDblToNil unchecked(
net.mintern.functions.ternary.checked.LongIntDblToNilE 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 LongIntDblToNil uncheckedIO(
net.mintern.functions.ternary.checked.LongIntDblToNilE f) {
return unchecked(java.io.UncheckedIOException::new, f);
}
/**
* Binds {@code (l)} to the beginning of {@code f}, returning a new function
* of type {@code (int, double) -> void}.
*
* @param f the unbound function
* @param l argument 1
* @return a new function {@code (int i, double d) -> void} that calls
* {@code f.call(l, i, d)}.
*/
static net.mintern.functions.binary.IntDblToNil
bind(LongIntDblToNil f, long l) {
return (i, d) -> f.call(l, i, d);
}
/**
* Binds {@code (l)} to the beginning of {@code this}, returning a new function
* of type {@code (int, double) -> void}.
*
* @param l argument 1
* @return a new function {@code (int i, double d) -> void} that calls
* {@code this.call(l, i, d)}.
*/
@Override
default net.mintern.functions.binary.IntDblToNil bind(long l) {
return LongIntDblToNil.bind(this, l);
}
/**
* Binds {@code (i, d)} to the end of {@code f}, returning a new function
* of type {@code (long) -> void}.
*
* @param f the unbound function
* @param i argument 2
* @param d argument 3
* @return a new function {@code (long l) -> void} that calls
* {@code f.call(l, i, d)}.
*/
static net.mintern.functions.unary.LongToNil
rbind(LongIntDblToNil f, int i, double d) {
return (l) -> f.call(l, i, d);
}
/**
* Binds {@code (i, d)} to the end of {@code this}, returning a new function
* of type {@code (long) -> void}.
*
* @param i argument 2
* @param d argument 3
* @return a new function {@code (long l) -> void} that calls
* {@code this.call(l, i, d)}.
*/
@Override
default net.mintern.functions.unary.LongToNil rbind(int i, double d) {
return LongIntDblToNil.rbind(this, i, d);
}
/**
* Binds {@code (l, i)} to the beginning of {@code f}, returning a new function
* of type {@code (double) -> void}.
*
* @param f the unbound function
* @param l argument 1
* @param i argument 2
* @return a new function {@code (double d) -> void} that calls
* {@code f.call(l, i, d)}.
*/
static net.mintern.functions.unary.DblToNil
bind(LongIntDblToNil f, long l, int i) {
return (d) -> f.call(l, i, d);
}
/**
* Binds {@code (l, i)} to the beginning of {@code this}, returning a new function
* of type {@code (double) -> void}.
*
* @param l argument 1
* @param i argument 2
* @return a new function {@code (double d) -> void} that calls
* {@code this.call(l, i, d)}.
*/
@Override
default net.mintern.functions.unary.DblToNil bind(long l, int i) {
return LongIntDblToNil.bind(this, l, i);
}
/**
* Binds {@code (d)} to the end of {@code f}, returning a new function
* of type {@code (long, int) -> void}.
*
* @param f the unbound function
* @param d argument 3
* @return a new function {@code (long l, int i) -> void} that calls
* {@code f.call(l, i, d)}.
*/
static net.mintern.functions.binary.LongIntToNil
rbind(LongIntDblToNil f, double d) {
return (l, i) -> f.call(l, i, d);
}
/**
* Binds {@code (d)} to the end of {@code this}, returning a new function
* of type {@code (long, int) -> void}.
*
* @param d argument 3
* @return a new function {@code (long l, int i) -> void} that calls
* {@code this.call(l, i, d)}.
*/
@Override
default net.mintern.functions.binary.LongIntToNil rbind(double d) {
return LongIntDblToNil.rbind(this, d);
}
/**
* Binds {@code (l, i, d)} to {@code f}, returning a new function
* of type {@code () -> void}.
*
* @param f the unbound function
* @param l argument 1
* @param i argument 2
* @param d argument 3
* @return a new function {@code () -> void} that calls
* {@code f.call(l, i, d)}.
*/
static net.mintern.functions.nullary.NilToNil
bind(LongIntDblToNil f, long l, int i, double d) {
return () -> f.call(l, i, d);
}
/**
* Binds {@code (l, i, d)} to {@code this}, returning a new function
* of type {@code () -> void}.
*
* @param l argument 1
* @param i argument 2
* @param d argument 3
* @return a new function {@code () -> void} that calls
* {@code this.call(l, i, d)}.
*/
@Override
default net.mintern.functions.nullary.NilToNil bind(long l, int i, double d) {
return LongIntDblToNil.bind(this, l, i, d);
}
}