All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.nosqlbench.virtdata.api.bindings.AdaptFunctionsFlexibly Maven / Gradle / Ivy

There is a newer version: 4.15.102
Show newest version
package io.nosqlbench.virtdata.api.bindings;

import java.util.function.*;

/**
 * 

Synopsis

*

Static methods on this class are intended to adapt one java Functional type to another. * The fill-in logic which bridges functions in this class are intended to be flexible, but this means that strict data * type handling will be secondary to having functions that will return a value even when an overflow would normally * occur. *

* *

Handling Overflow

*

* In any case where an overflow error would occur, or a loss of numeric precision due to a narrowing conversion, the * value which is too large for the smaller register is reduced in magnitude to fit into the smaller data type using * modulo division by the maximum positive value of the smaller type. *

* This is suitable for testing cases where you need voliminous data according to a sketch or recipe, but it is not * appropriate for use in rigorous mathematical or algebraic scenarios. Use these methods appropriately, i.e. for * generating bulk test data only. *

* *

Method Naming

*

* The method naming used in this class follows a pattern to make reflective lookup easy and type aware. However, the * second and subsequent parameters are not used in the call to the function. The will be null. This allows for explicit * method matching, including with respect to variant types within generic parameters in target types. Thus, target * types with one generic parameter will have a signature like {@code (func, targetclass, generic0)} while those with * two generic parameters will have a signature like {@code (func, targetclass, generic0, generic1)}. What matters is * that the return type is accurate and type compatible with the actual function that is returned. *

* Alternative methods were explored, but this method works well and is actually easier to follow than most other * methods considered. *

* * To ensure coverage of function types, add to the VirtDataConversionsTest class. */ public class AdaptFunctionsFlexibly { public static LongUnaryOperator adapt(LongToDoubleFunction f, LongUnaryOperator placeholder) { return v -> (long) (f.applyAsDouble(v) % Long.MAX_VALUE); } public static LongToIntFunction adapt(LongToDoubleFunction f, LongToIntFunction placeholder) { return v -> (int) (f.applyAsDouble(v) % Integer.MAX_VALUE); } public static LongFunction adapt(LongToDoubleFunction f, LongFunction placeholder, Double output) { return f::applyAsDouble; } public static LongFunction adapt(LongToDoubleFunction f, LongFunction ignore0, Long ignore1) { return v -> (long) (f.applyAsDouble(v) % Long.MAX_VALUE); } public static LongFunction adapt(LongToDoubleFunction f, LongFunction ignore0, Integer ignore1) { return v -> (int) (f.applyAsDouble(v) % Integer.MAX_VALUE); } public static LongUnaryOperator adapt(LongToIntFunction f, LongUnaryOperator ignore0) { return f::applyAsInt; } public static LongToDoubleFunction adapt(LongToIntFunction f, LongToDoubleFunction ignore0) { return f::applyAsInt; } public static LongFunction adapt(LongToIntFunction f, LongFunction ignore0, Double ignore1) { return v -> (double) f.applyAsInt(v); } public static LongFunction adapt(LongToIntFunction f, LongFunction ignore0, Long ignore1) { return v -> (long) f.applyAsInt(v); } public static LongFunction adapt(LongToIntFunction f, LongFunction ignore0, Integer ignore1) { return f::applyAsInt; } public static LongToDoubleFunction adapt(LongUnaryOperator f, LongToDoubleFunction ignore0) { return f::applyAsLong; } public static LongToIntFunction adapt(LongUnaryOperator f, LongToIntFunction ignore0) { return v -> (int) (f.applyAsLong(v) % Integer.MAX_VALUE); } public static LongFunction adapt(LongUnaryOperator f, LongFunction ignore0, Double ignore1) { return v -> (double) f.applyAsLong(v); } public static LongFunction adapt(LongUnaryOperator f, LongFunction ignore0, Long ignore1) { return f::applyAsLong; } public static LongFunction adapt(LongUnaryOperator f, LongFunction ignore0, Integer ignore1) { return v -> (int) (f.applyAsLong(v) % Integer.MAX_VALUE); } public static LongUnaryOperator adapt(LongFunction f, String i1, LongUnaryOperator i2) { return v -> Long.parseLong(f.apply(v)); } public static LongToDoubleFunction adapt(LongFunction f, String i1, LongToDoubleFunction i2) { return v -> Double.parseDouble(f.apply(v)); } public static LongToIntFunction adapt(LongFunction f, String i1, LongToIntFunction i2) { return v -> Integer.parseInt(f.apply(v)); } public static LongUnaryOperator adapt(LongFunction f, Double i1, LongUnaryOperator i2) { return v -> (long) (f.apply(v) % Long.MAX_VALUE); } public static LongToDoubleFunction adapt(LongFunction f, Double i1, LongToDoubleFunction i2) { return f::apply; } public static LongToIntFunction adapt(LongFunction f, Double i1, LongToIntFunction i2) { return v -> (int) (f.apply(v) % Integer.MAX_VALUE); } public static LongUnaryOperator adapt(IntFunction f, Integer i1, LongUnaryOperator i2) { return v -> (long) (f.apply((int) (v % Integer.MAX_VALUE))); } public static LongToDoubleFunction adapt(IntFunction f, Integer i1, LongToDoubleFunction i2) { return v -> (double) (f.apply((int) (v % Integer.MAX_VALUE))); } public static LongToIntFunction adapt(IntFunction f, Integer i1, LongToIntFunction i2) { return v -> (int) (f.apply((int) (v % Integer.MAX_VALUE))); } public static LongUnaryOperator adapt(IntFunction f, Double i1, LongUnaryOperator i2) { return v -> (long) ((f.apply((int) (v % Integer.MAX_VALUE))) % Long.MAX_VALUE); } public static LongToDoubleFunction adapt(IntFunction f, Double i1, LongToDoubleFunction i2) { return v -> (double) (f.apply((int) (v % Integer.MAX_VALUE))); } public static LongToIntFunction adapt(IntFunction f, Double i1, LongToIntFunction i2) { return v -> (int) ((f.apply((int) (v % Integer.MAX_VALUE))) % Integer.MAX_VALUE); } public static LongUnaryOperator adapt(IntUnaryOperator f, LongUnaryOperator i1) { return v -> (long) f.applyAsInt((int) (v % Integer.MAX_VALUE)); } public static LongToDoubleFunction adapt(IntUnaryOperator f, LongToDoubleFunction i1) { return v -> (double) (f.applyAsInt((int) (v % Integer.MAX_VALUE))); } public static LongToIntFunction adapt(IntUnaryOperator f, LongToIntFunction i1) { return v -> (int) (f.applyAsInt((int) (v % Integer.MAX_VALUE))); } public static LongUnaryOperator adapt(DoubleUnaryOperator f, LongUnaryOperator i1) { return v -> (long) (f.applyAsDouble(v) % Long.MAX_VALUE); } public static LongToDoubleFunction adapt(DoubleUnaryOperator f, LongToDoubleFunction i1) { return f::applyAsDouble; } public static LongToIntFunction adapt(DoubleUnaryOperator f, LongToIntFunction i1) { return v -> (int) (f.applyAsDouble(v) % Integer.MAX_VALUE); } public static LongFunction adapt(LongFunction f, String i1, LongFunction i2, Double i3) { return v -> Double.parseDouble(f.apply(v)); } public static LongFunction adapt(IntFunction f, Integer i1, LongFunction i2, Double i3) { return v -> (double) (f.apply((int) (v % Integer.MAX_VALUE))); } public static LongFunction adapt(IntFunction f, Double i1, LongFunction i2, Double i3) { return v -> f.apply((int) (v % Integer.MAX_VALUE)); } public static LongFunction adapt(IntUnaryOperator f, LongFunction i1, Double i2) { return v -> (double) (f.applyAsInt((int) (v % Integer.MAX_VALUE))); } public static LongFunction adapt(DoubleUnaryOperator f, LongFunction i1, Double i2) { return f::applyAsDouble; } public static LongFunction adapt(LongFunction f, String i1, LongFunction i2, Integer i3) { return v -> (int) Integer.parseInt((f.apply(v))); } public static LongFunction adapt(LongFunction f, Double i1, LongFunction i2, Integer i3) { return v -> (int) ((f.apply(v)) % Integer.MAX_VALUE); } public static LongFunction adapt(IntFunction f, Integer i1, LongFunction i2, Integer i3) { return v -> (int) ((f.apply((int) (v % Integer.MAX_VALUE)))); } public static LongFunction adapt(IntFunction f, Double i1, LongFunction i2, Integer i3) { return v -> (int) ((f.apply((int) (v % Integer.MAX_VALUE))) % Integer.MAX_VALUE); } public static LongFunction adapt(IntUnaryOperator f, LongFunction i1, Integer i2) { return v -> (int) (f.applyAsInt((int) (v % Integer.MAX_VALUE))); } public static LongFunction adapt(DoubleUnaryOperator f, LongFunction i1, Integer i2) { return v -> (int) ((f.applyAsDouble(v)) % Integer.MAX_VALUE); } public static IntUnaryOperator adapt(LongFunction f, String i1, IntUnaryOperator i2) { return v -> Integer.parseInt(f.apply(v)); } public static IntFunction adapt(LongFunction f, String i1, IntFunction i2, Long i3) { return v -> Long.parseLong(f.apply(v)); } public static IntFunction adapt(LongFunction f, String i1, IntFunction i2, Integer i3) { return v -> Integer.parseInt(f.apply(v)); } public static IntFunction adapt(LongFunction f, String i1, IntFunction i2, Double i3) { return v -> Double.parseDouble(f.apply(v)); } public static DoubleUnaryOperator adapt(LongFunction f, String i1, DoubleUnaryOperator i2) { return v -> Double.parseDouble(f.apply((long) (v % Long.MAX_VALUE))); } public static IntUnaryOperator adapt(LongFunction f, Double i1, IntUnaryOperator i2) { return v -> (int) ((f.apply(v)) % Integer.MAX_VALUE); } public static IntFunction adapt(LongFunction f, Double i1, IntFunction i2, Long i3) { return v -> (long) ((f.apply(v)) % Long.MAX_VALUE); } public static IntFunction adapt(LongFunction f, Double i1, IntFunction i2, Integer i3) { return v -> (int) ((f.apply(v)) % Integer.MAX_VALUE); } public static IntFunction adapt(LongFunction f, Double i1, IntFunction i2, Double i3) { return v -> (double) (f.apply(v)); } public static DoubleUnaryOperator adapt(LongFunction f, Double i1, DoubleUnaryOperator i2) { return v -> (double) (f.apply((long) (v % Long.MAX_VALUE))); } public static IntUnaryOperator adapt(LongToDoubleFunction f, IntUnaryOperator i1) { return v -> (int) ((f.applyAsDouble(v)) % Integer.MAX_VALUE); } public static IntFunction adapt(LongToDoubleFunction f, IntFunction i1, Long i2) { return v -> (long) (f.applyAsDouble(v)); } public static IntFunction adapt(LongToDoubleFunction f, IntFunction i1, Integer i2) { return v -> (int) ((f.applyAsDouble(v)) % Integer.MAX_VALUE); } public static IntFunction adapt(LongToDoubleFunction f, IntFunction i1, Double i2) { return v -> (double) f.applyAsDouble(v); } public static DoubleUnaryOperator adapt(LongToDoubleFunction f, DoubleUnaryOperator i1) { return v -> (double) (f.applyAsDouble((long) (v % Long.MAX_VALUE))); } public static IntUnaryOperator adapt(LongToIntFunction f, IntUnaryOperator i1) { return f::applyAsInt; } public static IntFunction adapt(LongToIntFunction f, IntFunction i1, Long i2) { return v -> (long) (f.applyAsInt(v)); } public static IntFunction adapt(LongToIntFunction f, IntFunction i1, Integer i2) { return v -> (int) (f.applyAsInt(v)); } public static IntFunction adapt(LongToIntFunction f, IntFunction i1, Double i2) { return v -> (double) (f.applyAsInt(v)); } public static DoubleUnaryOperator adapt(LongToIntFunction f, DoubleUnaryOperator i1) { return v -> (double) (f.applyAsInt((long) (v % Long.MAX_VALUE))); } public static IntUnaryOperator adapt(LongUnaryOperator f, IntUnaryOperator i1) { return v -> (int) (f.applyAsLong(v)); } public static IntFunction adapt(LongUnaryOperator f, IntFunction i1, Long i2) { return f::applyAsLong; } public static IntFunction adapt(LongUnaryOperator f, IntFunction i1, Integer i2) { return v -> (int) ((f.applyAsLong(v)) % Integer.MAX_VALUE); } public static IntFunction adapt(LongUnaryOperator f, IntFunction i1, Double i2) { return v -> (double) (f.applyAsLong(v)); } public static DoubleUnaryOperator adapt(LongUnaryOperator f, DoubleUnaryOperator i1) { return v -> (double) (f.applyAsLong((long) (v % Long.MAX_VALUE))); } public static IntUnaryOperator adapt(IntFunction f, Integer i1, IntUnaryOperator i2) { return f::apply; } public static IntFunction adapt(IntFunction f, Integer i1, IntFunction i2, Long i3) { return v -> (long) (f.apply(v)); } public static IntFunction adapt(IntFunction f, Integer i1, IntFunction i2, Double i3) { return v -> (double) (f.apply(v)); } public static DoubleUnaryOperator adapt(IntFunction f, Integer i1, DoubleUnaryOperator i2) { return v -> (double) (f.apply((int) (v % Integer.MAX_VALUE))); } public static IntUnaryOperator adapt(IntFunction f, Double i1, IntUnaryOperator i2) { return v -> (int) ((f.apply(v)) % Integer.MAX_VALUE); } public static IntFunction adapt(IntFunction f, Double i1, IntFunction i2, Long i3) { return v -> (long) ((f.apply(v)) % Long.MAX_VALUE); } public static IntFunction adapt(IntFunction f, Double i1, IntFunction i2, Integer i3) { return v -> (int) ((f.apply(v)) % Integer.MAX_VALUE); } public static DoubleUnaryOperator adapt(IntFunction f, Double i1, DoubleUnaryOperator i2) { return v -> (double) (f.apply((int) (v % Integer.MAX_VALUE))); } public static IntFunction adapt(IntUnaryOperator f, IntFunction i1, Long i2) { return v -> (long) (f.applyAsInt(v)); } public static IntFunction adapt(IntUnaryOperator f, IntFunction i1, Integer i2) { return f::applyAsInt; } public static IntFunction adapt(IntUnaryOperator f, IntFunction i1, Double i2) { return v -> (double) (f.applyAsInt(v)); } public static DoubleUnaryOperator adapt(IntUnaryOperator f, DoubleUnaryOperator i1) { return v -> (double) (f.applyAsInt((int) (v % Integer.MAX_VALUE))); } public static IntUnaryOperator adapt(DoubleUnaryOperator f, IntUnaryOperator i1) { return v -> (int) ((f.applyAsDouble(v)) % Integer.MAX_VALUE); } public static IntFunction adapt(DoubleUnaryOperator f, IntFunction i1, Long i2) { return v -> (long) ((f.applyAsDouble(v)) % Long.MAX_VALUE); } public static IntFunction adapt(DoubleUnaryOperator f, IntFunction i1, Integer i2) { return v -> (int) ((f.applyAsDouble(v)) % Integer.MAX_VALUE); } public static IntFunction adapt(DoubleUnaryOperator f, IntFunction i1, Double i2) { return v -> (double) (f.applyAsDouble(v)); } // to DoubleFunction public static LongUnaryOperator adapt(DoubleFunction f, Double i1, LongUnaryOperator i2) { return v -> (long) ((f.apply(v)) % Long.MAX_VALUE); } public static LongToDoubleFunction adapt(DoubleFunction f, Double i1, LongToDoubleFunction i2) { return f::apply; } public static LongToIntFunction adapt(DoubleFunction f, Double i1, LongToIntFunction i2) { return v -> (int) ((f.apply(v)) % Integer.MAX_VALUE); } public static LongFunction adapt(DoubleFunction f, Double i1, LongFunction i2, Double i3) { return f::apply; } public static LongFunction adapt(DoubleFunction f, Double i1, LongFunction i2, Integer i3) { return v -> (int) ((f.apply(v)) % Integer.MAX_VALUE); } public static IntUnaryOperator adapt(DoubleFunction f, Double i1, IntUnaryOperator i2) { return v -> (int) ((f.apply(v)) % Integer.MAX_VALUE); } public static IntFunction adapt(DoubleFunction f, Double i1, IntFunction i2, Long i3) { return v -> (long) ((f.apply(v)) % Long.MAX_VALUE); } public static IntFunction adapt(DoubleFunction f, Double i1, IntFunction i2, Integer i3) { return v -> (int) ((f.apply(v)) % Integer.MAX_VALUE); } public static IntFunction adapt(DoubleFunction f, Double i1, IntFunction i2, Double i3) { return v -> (double) (f.apply(v)); } public static DoubleUnaryOperator adapt(DoubleFunction f, Double i1, DoubleUnaryOperator i2) { return f::apply; } // LongFunction public static LongFunction adapt(LongFunction f, String i1, LongFunction i2, Long i3) { return v -> Long.parseLong(f.apply(v)); } public static LongFunction adapt(LongFunction f, Double i1, LongFunction i2, Long i3) { return v -> (long) ((f.apply(v)) % Long.MAX_VALUE); } public static LongFunction adapt(IntFunction f, Integer i1, LongFunction i2, Long i3) { return v -> (long) (f.apply((int) (v % Integer.MAX_VALUE))); } public static LongFunction adapt(IntFunction f, Double i1, LongFunction i2, Long i3) { return v -> (long) ((f.apply((int) (v % Integer.MAX_VALUE))) % Long.MAX_VALUE); } public static LongFunction adapt(IntUnaryOperator f, LongFunction i1, Long i2) { return v -> (long) (f.applyAsInt((int) (v % Integer.MAX_VALUE))); } public static LongFunction adapt(DoubleUnaryOperator f, LongFunction i1, Long i2) { return v -> (long) ((f.applyAsDouble(v)) % Long.MAX_VALUE); } public static LongFunction adapt(DoubleFunction f, Double i1, LongFunction i2, Long i3) { return v -> (long) ((f.apply(v)) % Long.MAX_VALUE); } public static LongFunction adapt(LongUnaryOperator f, LongFunction i1, Object i2) { return f::applyAsLong; } public static LongUnaryOperator adapt(LongFunction f, Long i1, LongUnaryOperator i2) { return f::apply; } public static LongToDoubleFunction adapt(LongFunction f, Long i1, LongToDoubleFunction i2) { return f::apply; } public static LongToIntFunction adapt(LongFunction f, Long i1, LongToIntFunction i2) { return v -> (int) (f.apply(v) % Integer.MAX_VALUE); } public static LongFunction adapt(LongFunction f, Long i1, LongFunction i2, Double i3) { return v -> (double) (f.apply(v)); } public static LongFunction adapt(LongFunction f, Long i1, LongFunction i2, Integer i3) { return v -> (int) ((f.apply(v)) % Integer.MAX_VALUE); } public static IntUnaryOperator adapt(LongFunction f, Long i1, IntUnaryOperator i2) { return v -> (int) ((f.apply(v)) % Integer.MAX_VALUE); } public static IntFunction adapt(LongFunction f, Long i1, IntFunction i2, Long i3) { return f::apply; } public static IntFunction adapt(LongFunction f, Long i1, IntFunction i2, Integer i3) { return v -> (int) ((f.apply(v)) % Integer.MAX_VALUE); } public static IntFunction adapt(LongFunction f, Long i1, IntFunction i2, Double i3) { return v -> (double) (f.apply(v)); } public static DoubleUnaryOperator adapt(LongFunction f, Long i1, DoubleUnaryOperator i2) { return v -> (double) (f.apply((long) (v % Long.MAX_VALUE))); } public static LongUnaryOperator adapt(LongFunction f, Integer i1, LongUnaryOperator i2) { return f::apply; } public static LongToDoubleFunction adapt(LongFunction f, Integer i1, LongToDoubleFunction i2) { return f::apply; } public static LongToIntFunction adapt(LongFunction f, Integer i1, LongToIntFunction i2) { return f::apply; } public static LongFunction adapt(LongFunction f, Integer i1, LongFunction i2, Double i3) { return v -> (double) (f.apply(v)); } public static IntUnaryOperator adapt(LongFunction f, Integer i1, IntUnaryOperator i2) { return f::apply; } public static IntFunction adapt(LongFunction f, Integer i1, IntFunction i2, Long i3) { return v -> (long) (f.apply(v)); } public static IntFunction adapt(LongFunction f, Integer i1, IntFunction i2, Integer i3) { return f::apply; } public static IntFunction adapt(LongFunction f, Integer i1, IntFunction i2, Double i3) { return v -> (double) (f.apply(v)); } public static DoubleUnaryOperator adapt(LongFunction f, Integer i1, DoubleUnaryOperator i2) { return v -> (double) (f.apply((long) (v % Long.MAX_VALUE))); } public static LongFunction adapt(LongFunction f, Integer i1, LongFunction i2, Long i3) { return v -> (long) (f.apply(v)); } // to IntFunction public static LongUnaryOperator adapt(IntFunction f, String i1, LongUnaryOperator i2) { return v -> Long.parseLong(f.apply((int) (v % Integer.MAX_VALUE))); } public static LongToDoubleFunction adapt(IntFunction f, String i1, LongToDoubleFunction i2) { return v -> (double) Double.parseDouble(f.apply((int) (v % Integer.MAX_VALUE))); } public static LongToIntFunction adapt(IntFunction f, String i1, LongToIntFunction i2) { return v -> (int) Integer.parseInt(f.apply((int) (v % Integer.MAX_VALUE))); } public static LongFunction adapt(IntFunction f, String i1, LongFunction i2, Double i3) { return v -> Double.parseDouble(f.apply((int) (v % Integer.MAX_VALUE))); } public static LongFunction adapt(IntFunction f, String i1, LongFunction i2, Integer i3) { return v -> Integer.parseInt(f.apply((int) (v % Integer.MAX_VALUE))); } public static IntUnaryOperator adapt(IntFunction f, String i1, IntUnaryOperator i2) { return v -> Integer.parseInt(f.apply(v)); } public static IntFunction adapt(IntFunction f, String i1, IntFunction i2, Long i3) { return v -> Long.parseLong(f.apply(v)); } public static IntFunction adapt(IntFunction f, String i1, IntFunction i2, Integer i3) { return v -> Integer.parseInt(f.apply(v)); } public static IntFunction adapt(IntFunction f, String i1, IntFunction i2, Double i3) { return v -> Double.parseDouble(f.apply(v)); } public static DoubleUnaryOperator adapt(IntFunction f, String i1, DoubleUnaryOperator i2) { return v -> Double.parseDouble(f.apply((int) v % Integer.MAX_VALUE)); } public static LongFunction adapt(IntFunction f, String i1, LongFunction i2, Long i3) { return v -> Long.parseLong(f.apply((int) (v % Integer.MAX_VALUE))); } // to DoubleFunction public static LongUnaryOperator adapt(DoubleFunction f, String i1, LongUnaryOperator i2) { return v -> (long) (Double.parseDouble(f.apply(v)) % Long.MAX_VALUE); } public static LongToDoubleFunction adapt(DoubleFunction f, String i1, LongToDoubleFunction i2) { return v -> Double.parseDouble(f.apply(v)); } public static LongToIntFunction adapt(DoubleFunction f, String i1, LongToIntFunction i2) { return v -> (int) (Double.parseDouble(f.apply(v)) % Integer.MAX_VALUE); } public static LongFunction adapt(DoubleFunction f, String i1, LongFunction i2, Double i3) { return v -> Double.parseDouble(f.apply(v)); } public static LongFunction adapt(DoubleFunction f, String i1, LongFunction i2, Integer i3) { return v -> (int) (Double.parseDouble(f.apply(v)) % Integer.MAX_VALUE); } public static IntUnaryOperator adapt(DoubleFunction f, String i1, IntUnaryOperator i2) { return v -> (int) (Double.parseDouble(f.apply(v)) % Integer.MAX_VALUE); } public static IntFunction adapt(DoubleFunction f, String i1, IntFunction i2, Long i3) { return v -> (long) (Double.parseDouble(f.apply(v)) % Long.MAX_VALUE); } public static IntFunction adapt(DoubleFunction f, String i1, IntFunction i2, Integer i3) { return v -> (int) (Double.parseDouble(f.apply(v)) % Integer.MAX_VALUE); } public static IntFunction adapt(DoubleFunction f, String i1, IntFunction i2, Double i3) { return v -> Double.parseDouble(f.apply(v)); } public static DoubleUnaryOperator adapt(DoubleFunction f, String i1, DoubleUnaryOperator i2) { return v -> Double.parseDouble(f.apply(v)); } public static LongFunction adapt(DoubleFunction f, String i1, LongFunction i2, Long i3) { return v -> (long) (Double.parseDouble(f.apply(v)) % Long.MAX_VALUE); } public static LongFunction adapt(LongToDoubleFunction f, LongFunction i1, Object i2) { return f::applyAsDouble; } public static LongFunction adapt(LongToIntFunction f, LongFunction i1, Object i2) { return f::applyAsInt; } public static LongFunction adapt(DoubleUnaryOperator f, LongFunction i1, Object i2) { return f::applyAsDouble; } public static LongFunction adapt(IntUnaryOperator f, LongFunction i1, Object i2) { return v -> f.applyAsInt((int) (v % Integer.MAX_VALUE)); } public static LongFunction adapt(IntFunction f, Integer i1, LongFunction i2, Object i3) { return v -> f.apply((int) (v % Integer.MAX_VALUE)); } public static LongFunction adapt(IntFunction f, Double i1, LongFunction i2, Object i3) { return v -> f.apply((int) (v % Integer.MAX_VALUE)); } public static LongFunction adapt(IntFunction f, String i1, LongFunction i2, Object i3) { return v -> f.apply((int) (v % Integer.MAX_VALUE)); } public static LongFunction adapt(DoubleFunction f, Double i1, LongFunction i2, Object i3) { return f::apply; } public static LongFunction adapt(DoubleFunction f, String i1, LongFunction i2, Object i3) { return f::apply; } public static LongFunction adapt(DoubleToLongFunction f, LongFunction i1, Object i2) { return f::applyAsLong; } public static LongUnaryOperator adapt(DoubleToLongFunction f, LongUnaryOperator i1) { return v -> (long) (f.applyAsLong(v)); } public static LongToDoubleFunction adapt(DoubleToLongFunction f, LongToDoubleFunction i1) { return v -> (double) f.applyAsLong(v); } public static LongToIntFunction adapt(DoubleToLongFunction f, LongToIntFunction i1) { return v -> (int) ((f.applyAsLong(v)) % Integer.MAX_VALUE); } public static LongFunction adapt(DoubleToLongFunction f, LongFunction i1, Double i2) { return v -> (double) f.applyAsLong(v); } public static LongFunction adapt(DoubleToLongFunction f, LongFunction i1, Integer i2) { return v -> (int) ((f.applyAsLong(v)) % Integer.MAX_VALUE); } public static IntUnaryOperator adapt(DoubleToLongFunction f, IntUnaryOperator i1) { return v -> (int) ((f.applyAsLong(v)) % Integer.MAX_VALUE); } public static IntFunction adapt(DoubleToLongFunction f, IntFunction i1, Long i2) { return v -> (long) f.applyAsLong(v); } public static IntFunction adapt(DoubleToLongFunction f, IntFunction i1, Integer i2) { return v->(int) ((int)f.applyAsLong(v)%Integer.MAX_VALUE); } public static IntFunction adapt(DoubleToLongFunction f, IntFunction i1, Double i2) { return v->(double) (f.applyAsLong(v)); } public static DoubleUnaryOperator adapt(DoubleToLongFunction f, DoubleUnaryOperator i1) { return v->(double)(f.applyAsLong(v)); } public static LongFunction adapt(DoubleToLongFunction f, LongFunction i1, Long i2) { return v->(long) (f.applyAsLong(v)); } public static LongFunction adapt(Function f, Object i1, Class i2, LongFunction i3, Object i4) { return f::apply; } }