net.mintern.functions.binary.checked.LongObjToIntE Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of functions-binary-core Show documentation
Show all versions of functions-binary-core Show documentation
Provides functional interfaces for the most commonly used two-argument functions
The newest version!
package net.mintern.functions.binary.checked;
/**
* An operation of type {@code (long, U) -> int}.
*
* @param the type of argument 2
* @param the {@code Exception} type that the operation may throw
*/
@FunctionalInterface
public interface LongObjToIntE {
/**
* Performs this operation.
*
* @param l argument 1
* @param u argument 2
* @return the result of the operation
* @throws E if the operation cannot be completed
*/
int call(long l, U u) throws E;
/**
* Binds {@code (l)} to the beginning of {@code f}, returning a new function
* of type {@code (U) -> int}.
*
* @param the type of argument 2
* @param the {@code Exception} type that the operation may throw
* @param f the unbound function
* @param l argument 1
* @return a new function {@code (U u) -> int} that calls
* {@code f.call(l, u)} and returns the result.
*/
static net.mintern.functions.unary.checked.ObjToIntE
bind(LongObjToIntE f, long l) {
return (u) -> f.call(l, u);
}
/**
* Binds {@code (l)} to the beginning of {@code this}, returning a new function
* of type {@code (U) -> int}.
*
* @param l argument 1
* @return a new function {@code (U u) -> int} that calls
* {@code this.call(l, u)} and returns the result.
*/
default net.mintern.functions.unary.checked.ObjToIntE bind(long l) {
return LongObjToIntE.bind(this, l);
}
/**
* Binds {@code (u)} to the end of {@code f}, returning a new function
* of type {@code (long) -> int}.
*
* @param the type of argument 2
* @param the {@code Exception} type that the operation may throw
* @param f the unbound function
* @param u argument 2
* @return a new function {@code (long l) -> int} that calls
* {@code f.call(l, u)} and returns the result.
*/
static net.mintern.functions.unary.checked.LongToIntE
rbind(LongObjToIntE f, U u) {
return (l) -> f.call(l, u);
}
/**
* Binds {@code (u)} to the end of {@code this}, returning a new function
* of type {@code (long) -> int}.
*
* @param u argument 2
* @return a new function {@code (long l) -> int} that calls
* {@code this.call(l, u)} and returns the result.
*/
default net.mintern.functions.unary.checked.LongToIntE rbind(U u) {
return LongObjToIntE.rbind(this, u);
}
/**
* Binds {@code (l, u)} to {@code f}, returning a new function
* of type {@code () -> int}.
*
* @param the type of argument 2
* @param the {@code Exception} type that the operation may throw
* @param f the unbound function
* @param l argument 1
* @param u argument 2
* @return a new function {@code () -> int} that calls
* {@code f.call(l, u)} and returns the result.
*/
static net.mintern.functions.nullary.checked.NilToIntE
bind(LongObjToIntE f, long l, U u) {
return () -> f.call(l, u);
}
/**
* Binds {@code (l, u)} to {@code this}, returning a new function
* of type {@code () -> int}.
*
* @param l argument 1
* @param u argument 2
* @return a new function {@code () -> int} that calls
* {@code this.call(l, u)} and returns the result.
*/
default net.mintern.functions.nullary.checked.NilToIntE bind(long l, U u) {
return LongObjToIntE.bind(this, l, u);
}
}