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


Java ForkJoinTask.join方法代码示例

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


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

示例1: helperBMain

import java.util.concurrent.ForkJoinTask; //导入方法依赖的package包/类
private int helperBMain(int goodFrom, int goodUntil, int weakFrom, int weakUntil, int obj, int tempFrom, int tempUntil) {
    int medianGood = ArrayHelper.transplant(transposedPoints[obj], indices, goodFrom, goodUntil, medianSwap, tempFrom);
    double goodMinObj = ArrayHelper.min(medianSwap, tempFrom, medianGood);
    int medianWeak = ArrayHelper.transplant(transposedPoints[obj], indices, weakFrom, weakUntil, medianSwap, medianGood);
    double weakMaxObj = ArrayHelper.max(medianSwap, medianGood, medianWeak);
    if (weakMaxObj < goodMinObj) {
        return weakUntil;
    }
    double goodMaxObj = ArrayHelper.max(medianSwap, tempFrom, medianGood);
    double weakMinObj = ArrayHelper.min(medianSwap, medianGood, medianWeak);
    if (goodMaxObj <= weakMinObj) {
        return helperB(goodFrom, goodUntil, weakFrom, weakUntil, obj - 1, tempFrom, tempUntil);
    }
    double median = ArrayHelper.destructiveMedian(medianSwap, tempFrom, medianWeak);
    long goodSplit = splitMerge.splitInThree(transposedPoints[obj], indices, tempFrom, goodFrom, goodUntil, median, goodMinObj, goodMaxObj);
    int goodMidL = SplitMergeHelper.extractMid(goodSplit);
    int goodMidR = SplitMergeHelper.extractRight(goodSplit);
    long weakSplit = splitMerge.splitInThree(transposedPoints[obj], indices, tempFrom, weakFrom, weakUntil, median, weakMinObj, weakMaxObj);
    int weakMidL = SplitMergeHelper.extractMid(weakSplit);
    int weakMidR = SplitMergeHelper.extractRight(weakSplit);
    int tempMid = (tempFrom + tempUntil) >>> 1;

    ForkJoinTask<Integer> newWeakMidLTask = null;
    if (pool != null && goodMidL - goodFrom + weakMidL - weakFrom > FORK_JOIN_THRESHOLD) {
        newWeakMidLTask = helperBAsync(goodFrom, goodMidL, weakFrom, weakMidL, obj, tempFrom, tempMid).fork();
    }
    int newWeakUntil = helperB(goodMidR, goodUntil, weakMidR, weakUntil, obj, tempMid, tempUntil);
    int newWeakMidL = newWeakMidLTask != null
            ? newWeakMidLTask.join()
            : helperB(goodFrom, goodMidL, weakFrom, weakMidL, obj, tempFrom, tempMid);

    splitMerge.mergeTwo(indices, tempFrom, goodFrom, goodMidL, goodMidL, goodMidR);
    newWeakUntil = splitMerge.mergeTwo(indices, tempFrom, weakMidL, weakMidR, weakMidR, newWeakUntil);
    newWeakUntil = helperB(goodFrom, goodMidR, weakMidL, newWeakUntil, obj - 1, tempFrom, tempUntil);
    splitMerge.mergeTwo(indices, tempFrom, goodFrom, goodMidR, goodMidR, goodUntil);
    return splitMerge.mergeTwo(indices, tempFrom, weakFrom, newWeakMidL, weakMidL, newWeakUntil);
}
 
开发者ID:mbuzdalov,项目名称:non-dominated-sorting,代码行数:38,代码来源:AbstractJFBSorting.java

示例2: sort

import java.util.concurrent.ForkJoinTask; //导入方法依赖的package包/类
/**
 * Sorts all the elements of the given array using the ForkJoin framework
 * @param array the array to sort
 */
public void sort(int[] array) {
    ForkJoinTask<Void> job = pool.submit(new MergeSortTask(array, 0, array.length));
    job.join();
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:9,代码来源:MergeSort.java


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