本文整理汇总了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;
}
}
}
示例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;
}
示例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;
}
}
}
示例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;
}