当前位置: 首页>>代码示例>>Java>>正文


Java ConstantCallSite.dynamicInvoker方法代码示例

本文整理汇总了Java中java.lang.invoke.ConstantCallSite.dynamicInvoker方法的典型用法代码示例。如果您正苦于以下问题:Java ConstantCallSite.dynamicInvoker方法的具体用法?Java ConstantCallSite.dynamicInvoker怎么用?Java ConstantCallSite.dynamicInvoker使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.lang.invoke.ConstantCallSite的用法示例。


在下文中一共展示了ConstantCallSite.dynamicInvoker方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: reduceBy

import java.lang.invoke.ConstantCallSite; //导入方法依赖的package包/类
/**
 * 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);
    }

}
 
开发者ID:advantageous,项目名称:boon,代码行数:33,代码来源:Lng.java

示例2: reduceBy

import java.lang.invoke.ConstantCallSite; //导入方法依赖的package包/类
/**
 * 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);
    }

}
 
开发者ID:advantageous,项目名称:boon,代码行数:33,代码来源:Flt.java

示例3: reduceBy

import java.lang.invoke.ConstantCallSite; //导入方法依赖的package包/类
/**
 * 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);
    }

}
 
开发者ID:advantageous,项目名称:boon,代码行数:33,代码来源:Int.java

示例4: reduceBy

import java.lang.invoke.ConstantCallSite; //导入方法依赖的package包/类
/**
 * 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);
    }

}
 
开发者ID:advantageous,项目名称:boon,代码行数:33,代码来源:Dbl.java


注:本文中的java.lang.invoke.ConstantCallSite.dynamicInvoker方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。