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


Java IntOpenHashSet.toArray方法代码示例

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


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

示例1: CollapsingScoreCollector

import com.carrotsearch.hppc.IntOpenHashSet; //导入方法依赖的package包/类
public CollapsingScoreCollector(int maxDoc,
                                int segments,
                                SortedDocValues values,
                                int nullPolicy,
                                IntIntOpenHashMap boostDocs) {
  this.maxDoc = maxDoc;
  this.contexts = new AtomicReaderContext[segments];
  this.collapsedSet = new FixedBitSet(maxDoc);
  this.boostDocs = boostDocs;
  if(this.boostDocs != null) {
    //Set the elevated docs now.
    IntOpenHashSet boostG = new IntOpenHashSet();
    Iterator<IntIntCursor> it = this.boostDocs.iterator();
    while(it.hasNext()) {
      IntIntCursor cursor = it.next();
      int i = cursor.key;
      this.collapsedSet.set(i);
      int ord = values.getOrd(i);
      if(ord > -1) {
        boostG.add(ord);
      }
    }
    boostOrds = boostG.toArray();
    Arrays.sort(boostOrds);
  }
  this.values = values;
  int valueCount = values.getValueCount();
  this.ords = new int[valueCount];
  Arrays.fill(this.ords, -1);
  this.scores = new float[valueCount];
  Arrays.fill(this.scores, -Float.MAX_VALUE);
  this.nullPolicy = nullPolicy;
  if(nullPolicy == CollapsingPostFilter.NULL_POLICY_EXPAND) {
    nullScores = new FloatArrayList();
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:37,代码来源:CollapsingQParserPlugin.java

示例2: FieldValueCollapse

import com.carrotsearch.hppc.IntOpenHashSet; //导入方法依赖的package包/类
public FieldValueCollapse(int maxDoc,
                          String field,
                          int nullPolicy,
                          boolean max,
                          boolean needsScores,
                          IntIntOpenHashMap boostDocs,
                          SortedDocValues values) {
  this.field = field;
  this.nullPolicy = nullPolicy;
  this.max = max;
  this.needsScores = needsScores;
  this.collapsedSet = new FixedBitSet(maxDoc);
  this.boostDocs = boostDocs;
  if(this.boostDocs != null) {
    IntOpenHashSet boostG = new IntOpenHashSet();
    Iterator<IntIntCursor> it = boostDocs.iterator();
    while(it.hasNext()) {
      IntIntCursor cursor = it.next();
      int i = cursor.key;
      this.collapsedSet.set(i);
      int ord = values.getOrd(i);
      if(ord > -1) {
        boostG.add(ord);
      }
    }
    this.boostOrds = boostG.toArray();
    Arrays.sort(this.boostOrds);
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:30,代码来源:CollapsingQParserPlugin.java

示例3: listAdditionalResultIds

import com.carrotsearch.hppc.IntOpenHashSet; //导入方法依赖的package包/类
public int[] listAdditionalResultIds(List<ExperimentTaskResult> results) {
    IntOpenHashSet ids = new IntOpenHashSet();
    for (ExperimentTaskResult result : results) {
        if (result.hasAdditionalResults()) {
            ids.addAll(result.getAdditionalResults().keys());
        }
    }
    int idArray[] = ids.toArray();
    Arrays.sort(idArray);
    return idArray;
}
 
开发者ID:dice-group,项目名称:gerbil,代码行数:12,代码来源:ResultNameToIdMapping.java

示例4: getSortedTerminalIdList

import com.carrotsearch.hppc.IntOpenHashSet; //导入方法依赖的package包/类
/**
 * Returns the sorted list of terminal IDs belonging to this argument give the specific tree.
 * @param tree the constituent tree.
 * @return the sorted list of terminal IDs belonging to this argument give the specific tree.
 */
public int[] getSortedTerminalIdList(CTTree tree)
{
	IntOpenHashSet set = getTerminalIdSet(tree);
	int[] ids = set.toArray();
	
	Arrays.sort(ids);
	return ids;
}
 
开发者ID:clearnlp,项目名称:clearnlp,代码行数:14,代码来源:PBArg.java

示例5: getSpan

import com.carrotsearch.hppc.IntOpenHashSet; //导入方法依赖的package包/类
private int[] getSpan(DEPNode pred, DEPNode arg)
{
	IntOpenHashSet sArg = arg .getSubIdSet();
	
	if (pred.isDescendentOf(arg))
		sArg.removeAll(pred.getSubIdSet());			
	
	int[] span = sArg.toArray();
	return span;
}
 
开发者ID:clearnlp,项目名称:clearnlp,代码行数:11,代码来源:SRLExpand.java

示例6: getSubIdArray

import com.carrotsearch.hppc.IntOpenHashSet; //导入方法依赖的package包/类
/**
 * Returns an array of IDs from the subtree of this node, including the ID of this node.
 * The array is sorted in ascending order.
 * @return an array of IDs from the subtree of this node, including the ID of this node.
 */
public int[] getSubIdArray()
{
	IntOpenHashSet set = getSubIdSet();
	int[] list = set.toArray();
	Arrays.sort(list);
	
	return list;
}
 
开发者ID:clearnlp,项目名称:clearnlp,代码行数:14,代码来源:DEPNode.java

示例7: assign

import com.carrotsearch.hppc.IntOpenHashSet; //导入方法依赖的package包/类
public void assign(String depFile, String tpcFile, String outFile, int threshold) throws IOException
{
	List<List<String[]>> topics = getTopics(tpcFile, threshold);
	DEPReader reader = new DEPReader(0, 1, 2, 3, 4, 5, 6);
	reader.open(UTInput.createBufferedFileReader(depFile));
	PrintStream fout = UTOutput.createPrintBufferedFileStream(outFile);
	IntOpenHashSet[] sets;
	StringBuilder build;
	IntOpenHashSet set;
	int[] indices;
	DEPTree tree;
	int i, size;
	
	while ((tree = reader.next()) != null)
	{
		sets  = assignTopics(topics, tree);
		size  = sets.length;
		build = new StringBuilder();
		
		for (i=1; i<size; i++)
		{
			set = sets[i];
			
			if (set.isEmpty())
			{
				build.append("_");
			}
			else
			{
				indices = set.toArray();
				Arrays.sort(indices);
				build.append("tpc=");
				build.append(UTArray.join(indices, ","));
			}
			
			build.append("\n");
		}
		
		fout.println(build.toString());
	}
	
	fout.close();
}
 
开发者ID:clearnlp,项目名称:clearnlp,代码行数:44,代码来源:TopicAssigner.java

示例8: markFlowers

import com.carrotsearch.hppc.IntOpenHashSet; //导入方法依赖的package包/类
private void markFlowers() {
	Integer[] sortedByDegree = new Integer[W.size()];
	BitSet markedAsFlower = new BitSet(W.size());
	int j = 0;
	for (int i = 0; i < W.allocated.length; i++) {
		if (W.allocated[i]) {
			sortedByDegree[j] = W.keys[i];
			j = j + 1;
		}
	}
	Arrays.sort(sortedByDegree, new LessByN1HComparator(neig));

	definiteFlowers = new IntOpenHashSet();
	int indexInSorted = 0;
	// vertices that create component on their own are flowers
	while ((indexInSorted < sortedByDegree.length)
			&& (neig.get(sortedByDegree[indexInSorted]).size() == 1)) {
		definiteFlowers.add(sortedByDegree[indexInSorted]);
		markedAsFlower.set(sortedByDegree[indexInSorted]);
		indexInSorted = indexInSorted + 1;
	}
	// vertices with degree 2 can grants definite flower status
	IntOpenHashSet skaredaPremenna;
	System.out.print(indexInSorted + "\t");
	while ((indexInSorted < sortedByDegree.length)
			&& ((skaredaPremenna = neig.get(sortedByDegree[indexInSorted]))
					.size() == 2)) {
		int[] vertices = skaredaPremenna.toArray();
		if (sortedByDegree[indexInSorted] == vertices[0]) {
			definiteFlowers.add(vertices[1]);
			markedAsFlower.set(vertices[1]);
			if (neig.get(vertices[1]).size() == 2) {
				others.add(vertices[1]);
			}
		} else {
			definiteFlowers.add(vertices[0]);
			markedAsFlower.set(vertices[0]);
			if (neig.get(vertices[0]).size() == 2) {
				others.add(vertices[0]);
			}
		}
		indexInSorted = indexInSorted + 1;
	}
	System.out.print(indexInSorted + "\t");

	while (indexInSorted < sortedByDegree.length) {
		// leave out already marked flowers
		int grants = sortedByDegree[indexInSorted];
		if (true /*!markedAsFlower.get(grants)*/) {
			IntOpenHashSet neighs = neig.get(grants);
			for (IntCursor neighscur : neighs) {
				int granted = neighscur.value;
				if (grants != granted
						&& Utils.containsAll(neig.get(granted), neighs)) {
					// a potential flower founded
					// System.out.println(grants + "->" + granted);
					potentialFlowers.add(granted);
					keyGrantsFlowerToValues.get(grants).add(granted);
					keyHasGrantedFlowerByValues.get(granted).add(grants);
					markedAsFlower.set(granted);
				}
			}
		}
		indexInSorted = indexInSorted + 1;
	}
	System.out.print(indexInSorted + "\n");
	System.out.println("Definite flowers: " + definiteFlowers.size() + " "
			+ definiteFlowers);
	System.out.println("Potential flowers: " + potentialFlowers.size()
			+ " " + potentialFlowers);
}
 
开发者ID:Friker,项目名称:min-dom-set,代码行数:72,代码来源:FlowerMacoAlgorithm.java

示例9: markFlowers

import com.carrotsearch.hppc.IntOpenHashSet; //导入方法依赖的package包/类
private void markFlowers() {
	Integer[] sortedByDegree = new Integer[W.size()];
	BitSet markedAsFlower = new BitSet(W.size());
	int j = 0;
	for (int i = 0; i < W.allocated.length; i++) {
		if (W.allocated[i]) {
			sortedByDegree[j] = W.keys[i];
			j = j + 1;
		}
	}
	Arrays.sort(sortedByDegree, new LessByN1HComparator(neig));

	definiteFlowers = new IntOpenHashSet();
	int indexInSorted = 0;
	// vertices that create component on their own are flowers
	while ((indexInSorted < sortedByDegree.length)
			&& (neig.get(sortedByDegree[indexInSorted]).size() == 1)) {
		definiteFlowers.add(sortedByDegree[indexInSorted]);
		markedAsFlower.set(sortedByDegree[indexInSorted]);
		indexInSorted = indexInSorted + 1;
	}
	// vertices with degree 2 can grant definite flower status
	IntOpenHashSet skaredaPremenna;
	System.out.print(indexInSorted + "\t");
	while ((indexInSorted < sortedByDegree.length)
			&& ((skaredaPremenna = neig.get(sortedByDegree[indexInSorted]))
					.size() == 2)) {
		int[] vertices = skaredaPremenna.toArray();
		if (sortedByDegree[indexInSorted] == vertices[0]) {
			definiteFlowers.add(vertices[1]);
			markedAsFlower.set(vertices[1]);
			if (neig.get(vertices[1]).size() == 2) {
				others.add(vertices[1]);
			}
		} else {
			definiteFlowers.add(vertices[0]);
			markedAsFlower.set(vertices[0]);
			if (neig.get(vertices[0]).size() == 2) {
				others.add(vertices[0]);
			}
		}
		indexInSorted = indexInSorted + 1;
	}
	System.out.print(indexInSorted + "\t");

	while (indexInSorted < sortedByDegree.length) {
		// leave out already marked flowers
		int grants = sortedByDegree[indexInSorted];
		if (true /*!markedAsFlower.get(grants)*/) {
			IntOpenHashSet neighs = neig.get(grants);
			for (IntCursor neighscur : neighs) {
				int granted = neighscur.value;
				if (grants != granted
						&& Utils.containsAll(neig.get(granted), neighs)) {
					// a potential flower founded
					// System.out.println(grants + "->" + granted);
					potentialFlowers.add(granted);
					keyGrantsFlowerToValues.get(grants).add(granted);
					keyHasGrantedFlowerByValues.get(granted).add(grants);
					markedAsFlower.set(granted);
				}
			}
		}
		indexInSorted = indexInSorted + 1;
	}
	System.out.print(indexInSorted + "\n");
	System.out.println("Definite flowers: " + definiteFlowers.size() + " "
			+ definiteFlowers);
	System.out.println("Potential flowers: " + potentialFlowers.size()
			+ " " + potentialFlowers);
}
 
开发者ID:Friker,项目名称:min-dom-set,代码行数:72,代码来源:FlowerFullAlgorithm.java


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