/** * Reduce by functional support for int arrays. * @param array array of items to reduce by * @param object object that contains the reduce by function * @param <T> the type of object * @return the final reduction */ public static <T> long reduceBy( final long[] array, T object ) { if (object.getClass().isAnonymousClass()) { return reduceByR(array, object ); } try { ConstantCallSite callSite = Invoker.invokeReducerLongIntReturnLongMethodHandle(object); MethodHandle methodHandle = callSite.dynamicInvoker(); try { long sum = 0; for ( long v : array ) { sum = (long) methodHandle.invokeExact( sum, v ); } return sum; } catch (Throwable throwable) { return handle(Long.class, throwable, "Unable to perform reduceBy"); } } catch (Exception ex) { return reduceByR(array, object); } }
/** * Reduce by functional support for int arrays. * @param array array of items to reduce by * @param object object that contains the reduce by function * @param <T> the type of object * @return the final reduction */ public static <T> long reduceBy( final int[] array, T object ) { if (object.getClass().isAnonymousClass()) { return reduceByR(array, object ); } try { ConstantCallSite callSite = Invoker.invokeReducerLongIntReturnLongMethodHandle(object); MethodHandle methodHandle = callSite.dynamicInvoker(); try { long sum = 0; for ( int v : array ) { sum = (long) methodHandle.invokeExact( sum, v ); } return sum; } catch (Throwable throwable) { return handle(Long.class, throwable, "Unable to perform reduceBy"); } } catch (Exception ex) { return reduceByR(array, object); } }
/** * Reduce by functional support for int arrays. * @param array array of items to reduce by * @param object object that contains the reduce by function * @param <T> the type of object * @return the final reduction */ public static <T> long reduceBy( final long[] array, T object, String methodName ) { if (object.getClass().isAnonymousClass()) { return reduceByR(array, object, methodName); } try { ConstantCallSite callSite = Invoker.invokeReducerLongIntReturnLongMethodHandle(object, methodName); MethodHandle methodHandle = callSite.dynamicInvoker(); try { long sum = 0; for ( long v : array ) { sum = (long) methodHandle.invokeExact( sum, v ); } return sum; } catch (Throwable throwable) { return handle(Long.class, throwable, "Unable to perform reduceBy"); } } catch (Exception ex) { return reduceByR(array, object, methodName); } }
/** * Reduce by functional support for int arrays. * @param array array of items to reduce by * @param object object that contains the reduce by function * @param <T> the type of object * @return the final reduction */ public static <T> long reduceBy( final int[] array, T object ) { if (object.getClass().isAnonymousClass()) { return reduceByR(array, object ); } try { ConstantCallSite callSite = Invoker.invokeReducerLongIntReturnLongMethodHandle(object); MethodHandle methodHandle = callSite.dynamicInvoker(); try { long sum = 0; for ( int v : array ) { sum = (long) methodHandle.invokeExact( sum, v ); } return sum; } catch (Throwable throwable) { return handle(Long.class, throwable, "Unable to perform reduceBy"); } } catch (Exception ex) { return reduceByR(array, object); } }
/** * Reduce by functional support for int arrays. * @param array array of items to reduce by * @param object object that contains the reduce by function * @param <T> the type of object * @return the final reduction */ public static <T> double reduceBy( final double[] array, T object ) { if (object.getClass().isAnonymousClass()) { return reduceByR(array, object ); } try { ConstantCallSite callSite = Invoker.invokeReducerLongIntReturnLongMethodHandle(object); MethodHandle methodHandle = callSite.dynamicInvoker(); try { double sum = 0; for ( double v : array ) { sum = (double) methodHandle.invokeExact( sum, v ); } return sum; } catch (Throwable throwable) { return Exceptions.handle(Long.class, throwable, "Unable to perform reduceBy"); } } catch (Exception ex) { return reduceByR(array, object); } }
/** * Reduce by functional support for int arrays. * @param array array of items to reduce by * @param object object that contains the reduce by function * @param <T> the type of object * @return the final reduction */ public static <T> long reduceBy( final long[] array, T object ) { if (object.getClass().isAnonymousClass()) { return reduceByR(array, object ); } try { ConstantCallSite callSite = Invoker.invokeReducerLongIntReturnLongMethodHandle(object); MethodHandle methodHandle = callSite.dynamicInvoker(); try { long sum = 0; for ( long v : array ) { sum = (long) methodHandle.invokeExact( sum, v ); } return sum; } catch (Throwable throwable) { return handle(Long.class, throwable, "Unable to perform reduceBy"); } } catch (Exception ex) { return reduceByR(array, object); } }
/** * Reduce By * @param array array of items to reduce by * @param length where to end in the array * @param object function * @return reduction */ public static double reduceBy( final double[] array, int length, Object object ) { if (object.getClass().isAnonymousClass()) { return reduceByR(array, length, object ); } try { ConstantCallSite callSite = Invoker.invokeReducerLongIntReturnLongMethodHandle(object ); MethodHandle methodHandle = callSite.dynamicInvoker(); try { double sum = 0; for (int index=0; index < length; index++) { double v = array[index]; sum = (double) methodHandle.invokeExact( sum, v ); } return sum; } catch (Throwable throwable) { return Exceptions.handle(Long.class, throwable, "Unable to perform reduceBy"); } } catch (Exception ex) { return reduceByR(array, length, object ); } }
/** * Reduce By * @param array array of items to reduce by * @param length where to end in the array * @param object function * @return reduction */ public static long reduceBy( final long[] array, int length, Object object ) { if (object.getClass().isAnonymousClass()) { return reduceByR(array, length, object ); } try { ConstantCallSite callSite = Invoker.invokeReducerLongIntReturnLongMethodHandle(object ); MethodHandle methodHandle = callSite.dynamicInvoker(); try { long sum = 0; for (int index=0; index < length; index++) { long v = array[index]; sum = (long) methodHandle.invokeExact( sum, v ); } return sum; } catch (Throwable throwable) { return handle(Long.class, throwable, "Unable to perform reduceBy"); } } catch (Exception ex) { return reduceByR(array, length, object ); } }
/** * Reduce By * @param array array of items to reduce by * @param length where to end in the array * @param object function * @return reduction */ public static double reduceBy( final double[] array, int length, Object object ) { if (object.getClass().isAnonymousClass()) { return reduceByR(array, length, object ); } try { ConstantCallSite callSite = Invoker.invokeReducerLongIntReturnLongMethodHandle(object ); MethodHandle methodHandle = callSite.dynamicInvoker(); try { double sum = 0; for (int index=0; index < length; index++) { double v = array[index]; sum = (double) methodHandle.invokeExact( sum, v ); } return sum; } catch (Throwable throwable) { return Exceptions.handle(Long.class, throwable, "Unable to perform reduceBy"); } } catch (Exception ex) { return reduceByR(array, length, object ); } }
/** * Reduce by functional support for int arrays. * @param array array of items to reduce by * @param object object that contains the reduce by function * @param <T> the type of object * @return the final reduction */ public static <T> long reduceBy( final int[] array, T object, String methodName ) { if (object.getClass().isAnonymousClass()) { return reduceByR(array, object, methodName); } try { ConstantCallSite callSite = Invoker.invokeReducerLongIntReturnLongMethodHandle(object, methodName); MethodHandle methodHandle = callSite.dynamicInvoker(); try { long sum = 0; for ( int v : array ) { sum = (long) methodHandle.invokeExact( sum, v ); } return sum; } catch (Throwable throwable) { return handle(Long.class, throwable, "Unable to perform reduceBy"); } } catch (Exception ex) { return reduceByR(array, object, methodName); } }
/** * Reduce by functional support for int arrays. * @param array array of items to reduce by * @param object object that contains the reduce by function * @param <T> the type of object * @return the final reduction */ public static <T> double reduceBy( final float[] array, T object ) { if (object.getClass().isAnonymousClass()) { return reduceByR(array, object ); } try { ConstantCallSite callSite = Invoker.invokeReducerLongIntReturnLongMethodHandle(object); MethodHandle methodHandle = callSite.dynamicInvoker(); try { double sum = 0; for ( float v : array ) { sum = (double) methodHandle.invokeExact( sum, v ); } return sum; } catch (Throwable throwable) { return Exceptions.handle(Long.class, throwable, "Unable to perform reduceBy"); } } catch (Exception ex) { return reduceByR(array, object); } }
/** * Reduce by functional support for int arrays. * @param array array of items to reduce by * @param object object that contains the reduce by function * @param <T> the type of object * @return the final reduction */ public static <T> double reduceBy( final float[] array, T object ) { if (object.getClass().isAnonymousClass()) { return reduceByR(array, object ); } try { ConstantCallSite callSite = Invoker.invokeReducerLongIntReturnLongMethodHandle(object); MethodHandle methodHandle = callSite.dynamicInvoker(); try { double sum = 0; for ( float v : array ) { sum = (double) methodHandle.invokeExact( sum, v ); } return sum; } catch (Throwable throwable) { return Exceptions.handle(Long.class, throwable, "Unable to perform reduceBy"); } } catch (Exception ex) { return reduceByR(array, object); } }
/** * Reduce by functional support for int arrays. * @param array array of items to reduce by * @param object object that contains the reduce by function * @param <T> the type of object * @return the final reduction */ public static <T> double reduceBy( final double[] array, T object ) { if (object.getClass().isAnonymousClass()) { return reduceByR(array, object ); } try { ConstantCallSite callSite = Invoker.invokeReducerLongIntReturnLongMethodHandle(object); MethodHandle methodHandle = callSite.dynamicInvoker(); try { double sum = 0; for ( double v : array ) { sum = (double) methodHandle.invokeExact( sum, v ); } return sum; } catch (Throwable throwable) { return Exceptions.handle(Long.class, throwable, "Unable to perform reduceBy"); } } catch (Exception ex) { return reduceByR(array, object); } }
/** * Reduce by functional support for int arrays. * @param array array of items to reduce by * @param object object that contains the reduce by function * @param <T> the type of object * @return the final reduction */ public static <T> double reduceBy( final float[] array, T object, String methodName ) { if (object.getClass().isAnonymousClass()) { return reduceByR(array, object, methodName); } try { ConstantCallSite callSite = Invoker.invokeReducerLongIntReturnLongMethodHandle(object, methodName); MethodHandle methodHandle = callSite.dynamicInvoker(); try { double sum = 0; for ( float v : array ) { sum = (double) methodHandle.invokeExact( sum, v ); } return sum; } catch (Throwable throwable) { return Exceptions.handle(Long.class, throwable, "Unable to perform reduceBy"); } } catch (Exception ex) { return reduceByR(array, object, methodName); } }
/** * Reduce by functional support for int arrays. * @param array array of items to reduce by * @param object object that contains the reduce by function * @param <T> the type of object * @return the final reduction */ public static <T> double reduceBy( final float[] array, T object, String methodName ) { if (object.getClass().isAnonymousClass()) { return reduceByR(array, object, methodName); } try { ConstantCallSite callSite = Invoker.invokeReducerLongIntReturnLongMethodHandle(object, methodName); MethodHandle methodHandle = callSite.dynamicInvoker(); try { double sum = 0; for ( float v : array ) { sum = (double) methodHandle.invokeExact( sum, v ); } return sum; } catch (Throwable throwable) { return Exceptions.handle(Long.class, throwable, "Unable to perform reduceBy"); } } catch (Exception ex) { return reduceByR(array, object, methodName); } }
/** * Reduce by functional support for int arrays. * @param array array of items to reduce by * @param object object that contains the reduce by function * @param <T> the type of object * @return the final reduction */ public static <T> long reduceBy( final long[] array, T object, String methodName ) { if (object.getClass().isAnonymousClass()) { return reduceByR(array, object, methodName); } try { ConstantCallSite callSite = Invoker.invokeReducerLongIntReturnLongMethodHandle(object, methodName); MethodHandle methodHandle = callSite.dynamicInvoker(); try { long sum = 0; for ( long v : array ) { sum = (long) methodHandle.invokeExact( sum, v ); } return sum; } catch (Throwable throwable) { return handle(Long.class, throwable, "Unable to perform reduceBy"); } } catch (Exception ex) { return reduceByR(array, object, methodName); } }
/** * Reduce by functional support for int arrays. * @param array array of items to reduce by * @param object object that contains the reduce by function * @param <T> the type of object * @return the final reduction */ public static <T> long reduceBy( final int[] array, T object, String methodName ) { if (object.getClass().isAnonymousClass()) { return reduceByR(array, object, methodName); } try { ConstantCallSite callSite = Invoker.invokeReducerLongIntReturnLongMethodHandle(object, methodName); MethodHandle methodHandle = callSite.dynamicInvoker(); try { long sum = 0; for ( int v : array ) { sum = (long) methodHandle.invokeExact( sum, v ); } return sum; } catch (Throwable throwable) { return handle(Long.class, throwable, "Unable to perform reduceBy"); } } catch (Exception ex) { return reduceByR(array, object, methodName); } }
/** * Reduce By * @param array array of items to reduce by * @param length where to end in the array * @param function function * @param functionName functionName * @return reduction */ public static double reduceBy( final double[] array, int length, Object function, String functionName ) { if (function.getClass().isAnonymousClass()) { return reduceByR(array, length, function, functionName ); } try { ConstantCallSite callSite = Invoker.invokeReducerLongIntReturnLongMethodHandle(function, functionName ); MethodHandle methodHandle = callSite.dynamicInvoker(); try { double sum = 0; for (int index=0; index < length; index++) { double v = array[index]; sum = (double) methodHandle.invokeExact( sum, v ); } return sum; } catch (Throwable throwable) { return Exceptions.handle(Long.class, throwable, "Unable to perform reduceBy"); } } catch (Exception ex) { return reduceByR(array, length, function, functionName ); } }
/** * Reduce By * @param array array of items to reduce by * @param length where to end in the array * @param object function * @param start start * @return reduction */ public static double reduceBy( final double[] array, int start, int length, Object object ) { if (object.getClass().isAnonymousClass()) { return reduceByR(array, object ); } try { ConstantCallSite callSite = Invoker.invokeReducerLongIntReturnLongMethodHandle(object ); MethodHandle methodHandle = callSite.dynamicInvoker(); try { double sum = 0; for (int index=start; index < length; index++) { double v = array[index]; sum = (double) methodHandle.invokeExact( sum, v ); } return sum; } catch (Throwable throwable) { return Exceptions.handle(Long.class, throwable, "Unable to perform reduceBy"); } } catch (Exception ex) { return reduceByR(array, object ); } }
/** * Reduce By * @param array array of items to reduce by * @param length where to end in the array * @param object function * @return reduction */ public static long reduceBy( final long[] array, int start, int length, Object object ) { if (object.getClass().isAnonymousClass()) { return reduceByR(array, object ); } try { ConstantCallSite callSite = Invoker.invokeReducerLongIntReturnLongMethodHandle(object ); MethodHandle methodHandle = callSite.dynamicInvoker(); try { long sum = 0; for (int index=start; index < length; index++) { long v = array[index]; sum = (long) methodHandle.invokeExact( sum, v ); } return sum; } catch (Throwable throwable) { return handle(Long.class, throwable, "Unable to perform reduceBy"); } } catch (Exception ex) { return reduceByR(array, object ); } }