diff --git a/virtdata-api/src/main/java/io/nosqlbench/virtdata/api/bindings/AdaptFunctionsFlexibly.java b/virtdata-api/src/main/java/io/nosqlbench/virtdata/api/bindings/AdaptFunctionsFlexibly.java index a982c0254..d99e5085b 100644 --- a/virtdata-api/src/main/java/io/nosqlbench/virtdata/api/bindings/AdaptFunctionsFlexibly.java +++ b/virtdata-api/src/main/java/io/nosqlbench/virtdata/api/bindings/AdaptFunctionsFlexibly.java @@ -712,6 +712,9 @@ public class AdaptFunctionsFlexibly { return v->(long) (f.applyAsLong(v)); } + public static LongFunction adapt(Function f, Object i1, Class i2, LongFunction i3, Object i4) { + return f::apply; + } diff --git a/virtdata-api/src/main/java/io/nosqlbench/virtdata/api/bindings/VirtDataConversions.java b/virtdata-api/src/main/java/io/nosqlbench/virtdata/api/bindings/VirtDataConversions.java index 3c4696b41..02a728f3e 100644 --- a/virtdata-api/src/main/java/io/nosqlbench/virtdata/api/bindings/VirtDataConversions.java +++ b/virtdata-api/src/main/java/io/nosqlbench/virtdata/api/bindings/VirtDataConversions.java @@ -44,10 +44,10 @@ public class VirtDataConversions { } - public static List adaptList(F[] funcs, Class resultType, Class... resultSignature) { + public static List adaptFunctionList(F[] funcs, Class resultType, Class... resultSignature) { List functions = new ArrayList<>(); for (Object func : funcs) { - T adapted = adapt(func, resultType, resultSignature); + T adapted = adaptFunction(func, resultType, resultSignature); functions.add(adapted); } return functions; @@ -62,7 +62,7 @@ public class VirtDataConversions { * @param resultSignature The signature of all output types, linearized for use after type-erasure. * @return An instance of T */ - public static T adapt(F func, Class resultType, Class... resultSignature) { + public static T adaptFunction(F func, Class resultType, Class... resultSignature) { FuncType funcType = FuncType.valueOf(func.getClass()); List> signature = new ArrayList<>(); diff --git a/virtdata-api/src/test/java/io/nosqlbench/virtdata/api/bindings/VirtDataConversionsTest.java b/virtdata-api/src/test/java/io/nosqlbench/virtdata/api/bindings/VirtDataConversionsTest.java index c290d9e73..1726c2b23 100644 --- a/virtdata-api/src/test/java/io/nosqlbench/virtdata/api/bindings/VirtDataConversionsTest.java +++ b/virtdata-api/src/test/java/io/nosqlbench/virtdata/api/bindings/VirtDataConversionsTest.java @@ -89,40 +89,40 @@ public class VirtDataConversionsTest { @Test public void testFunctionConversions() { for (Object func : funcs) { - LongUnaryOperator f1 = VirtDataConversions.adapt(func, LongUnaryOperator.class); + LongUnaryOperator f1 = VirtDataConversions.adaptFunction(func, LongUnaryOperator.class); f1.applyAsLong(1); - LongToDoubleFunction f2 = VirtDataConversions.adapt(func, LongToDoubleFunction.class); + LongToDoubleFunction f2 = VirtDataConversions.adaptFunction(func, LongToDoubleFunction.class); f2.applyAsDouble(2); - LongToIntFunction f3 = VirtDataConversions.adapt(func, LongToIntFunction.class); + LongToIntFunction f3 = VirtDataConversions.adaptFunction(func, LongToIntFunction.class); f3.applyAsInt(3); - LongFunction f4 = VirtDataConversions.adapt(func, LongFunction.class, Double.class); + LongFunction f4 = VirtDataConversions.adaptFunction(func, LongFunction.class, Double.class); f4.apply(4L); - LongFunction f41 = VirtDataConversions.adapt(func, LongFunction.class, Object.class); + LongFunction f41 = VirtDataConversions.adaptFunction(func, LongFunction.class, Object.class); f41.apply(41L); - LongFunction f5 = VirtDataConversions.adapt(func, LongFunction.class, Integer.class); + LongFunction f5 = VirtDataConversions.adaptFunction(func, LongFunction.class, Integer.class); f5.apply(5L); - IntUnaryOperator f6 = VirtDataConversions.adapt(func, IntUnaryOperator.class); + IntUnaryOperator f6 = VirtDataConversions.adaptFunction(func, IntUnaryOperator.class); f6.applyAsInt(6); - IntFunction f7 = VirtDataConversions.adapt(func, IntFunction.class, Long.class); + IntFunction f7 = VirtDataConversions.adaptFunction(func, IntFunction.class, Long.class); f7.apply(7); - IntFunction f8 = VirtDataConversions.adapt(func,IntFunction.class, Integer.class); + IntFunction f8 = VirtDataConversions.adaptFunction(func,IntFunction.class, Integer.class); f8.apply(8); - IntFunction f9 = VirtDataConversions.adapt(func,IntFunction.class, Double.class); + IntFunction f9 = VirtDataConversions.adaptFunction(func,IntFunction.class, Double.class); f9.apply(9); - DoubleUnaryOperator f10 = VirtDataConversions.adapt(func, DoubleUnaryOperator.class); + DoubleUnaryOperator f10 = VirtDataConversions.adaptFunction(func, DoubleUnaryOperator.class); f10.applyAsDouble(10d); - LongFunction f11 = VirtDataConversions.adapt(func, LongFunction.class, Long.class); + LongFunction f11 = VirtDataConversions.adaptFunction(func, LongFunction.class, Long.class); f11.apply(11L); }