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


Java IntIntOpenHashMap.size方法代码示例

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


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

示例1: BoostedComp

import com.carrotsearch.hppc.IntIntOpenHashMap; //导入方法依赖的package包/类
public BoostedComp(IntIntOpenHashMap boostedDocs, ScoreDoc[] scoreDocs, float maxScore) {
  this.boostedMap = new IntFloatOpenHashMap(boostedDocs.size()*2);

  for(int i=0; i<scoreDocs.length; i++) {
    if(boostedDocs.containsKey(scoreDocs[i].doc)) {
      boostedMap.put(scoreDocs[i].doc, maxScore+boostedDocs.lget());
    } else {
      break;
    }
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:12,代码来源:ReRankQParserPlugin.java

示例2: merge

import com.carrotsearch.hppc.IntIntOpenHashMap; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
protected List<T> merge(List<T> spans) {
    Span spanArray[] = spans.toArray(new Span[spans.size()]);
    Arrays.sort(spanArray, this);
    IntIntOpenHashMap enclosedByMap = new IntIntOpenHashMap();
    boolean isEnclosed;
    for (int i = 0; i < spanArray.length; ++i) {
        isEnclosed = false;
        for (int j = spanArray.length - 1; (j > i) && (!isEnclosed); --j) {
            // if spanArray[i] is enclosed by spanArray[j]
            if ((spanArray[i].getStartPosition() >= spanArray[j].getStartPosition())
                    && ((spanArray[i].getStartPosition() + spanArray[i].getLength()) <= (spanArray[j]
                            .getStartPosition() + spanArray[j].getLength()))) {
                enclosedByMap.put(i, j);
                isEnclosed = true;
            }
        }
    }
    // if no match could be found
    if (enclosedByMap.size() == 0) {
        return spans;
    }

    List<T> mergedMarkings = new ArrayList<T>(spans.size());
    // starting with the smallest span, check if a span is enclosed by
    // another
    int largerSpanId;
    for (int i = 0; i < spanArray.length; ++i) {
        if (enclosedByMap.containsKey(i)) {
            largerSpanId = enclosedByMap.lget();
            spanArray[largerSpanId] = merge(spanArray[i], spanArray[largerSpanId]);
        } else {
            mergedMarkings.add((T) spanArray[i]);
        }
    }
    return mergedMarkings;
}
 
开发者ID:dice-group,项目名称:gerbil,代码行数:38,代码来源:SpanMergingEvaluatorDecorator.java

示例3: BoostedComp

import com.carrotsearch.hppc.IntIntOpenHashMap; //导入方法依赖的package包/类
public BoostedComp(IntIntOpenHashMap boostedDocs, ScoreDoc[] scoreDocs, float maxScore) {
    this.boostedMap = new IntFloatOpenHashMap(boostedDocs.size()*2);

    for(int i=0; i<scoreDocs.length; i++) {
        if(boostedDocs.containsKey(scoreDocs[i].doc)) {
            boostedMap.put(scoreDocs[i].doc, maxScore+boostedDocs.lget());
        } else {
            break;
        }
    }
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:12,代码来源:AlfrescoReRankQParserPlugin.java

示例4: convertAndAnalyze

import com.carrotsearch.hppc.IntIntOpenHashMap; //导入方法依赖的package包/类
/**
 * Convert and analyze
 * 
 * @param grouped
 * @param stop
 * @param progress
 */
private void convertAndAnalyze(IntIntOpenHashMap grouped,
                               final WrappedBoolean stop,
                               final WrappedInteger progress) {

    // Convert
    int[][] temp = new int[grouped.size()][2];
    int idx = 0;
    final int[] values2 = grouped.values;
    final int[] keys2 = grouped.keys;
    final boolean[] states2 = grouped.allocated;
    for (int i = 0; i < states2.length; i++) {
        if (states2[i]) {
            temp[idx++] = new int[] { keys2[i], values2[i] };
        }
        if (stop.value) { throw new ComputationInterruptedException(); }
    }
    grouped = null;

    // Sort ascending by size
    Arrays.sort(temp, new Comparator<int[]>() {
        public int compare(int[] o1, int[] o2) {
            if (stop.value) { throw new ComputationInterruptedException(); }
            return Integer.compare(o1[0], o2[0]);
        }
    });

    // Convert and analyze
    int numClasses = 0;
    int numTuples = 0;
    this.equivalenceClasses = new int[temp.length * 2];
    idx = 0;
    for (int[] entry : temp) {
        this.equivalenceClasses[idx++] = entry[0];
        this.equivalenceClasses[idx++] = entry[1];
        numClasses += entry[1];
        numTuples += entry[0] * entry[1];
        if (stop.value) { throw new ComputationInterruptedException(); }
    }
    this.numRecords = numTuples;
    this.numClasses = numClasses;
    this.avgClassSize = this.numRecords / this.numClasses;
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:50,代码来源:RiskModelHistogram.java


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