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


Java IntOpenHashSet.size方法代码示例

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


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

示例1: GroupExpandCollector

import com.carrotsearch.hppc.IntOpenHashSet; //导入方法依赖的package包/类
public GroupExpandCollector(SortedDocValues docValues, FixedBitSet groupBits, IntOpenHashSet collapsedSet, int limit, Sort sort) throws IOException {
  int numGroups = collapsedSet.size();
  groups = new IntObjectOpenHashMap<>(numGroups * 2);
  collectors = new ArrayList<>();
  DocIdSetIterator iterator = groupBits.iterator();
  int group;
  while ((group = iterator.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
    Collector collector = (sort == null) ? TopScoreDocCollector.create(limit, true) : TopFieldCollector.create(sort, limit, false, false, false, true);
    groups.put(group, collector);
    collectors.add(collector);
  }

  this.collapsedSet = collapsedSet;
  this.groupBits = groupBits;
  this.docValues = docValues;
}
 
开发者ID:europeana,项目名称:search,代码行数:17,代码来源:ExpandComponent.java

示例2: createBitSets

import com.carrotsearch.hppc.IntOpenHashSet; //导入方法依赖的package包/类
private BitSet[] createBitSets(IntOpenHashSet hashSets[],
        IntOpenHashSet mergedHashSet) {
    BitSet bitSets[] = new BitSet[hashSets.length];
    for (int i = 0; i < bitSets.length; ++i) {
        bitSets[i] = new BitSet(mergedHashSet.size());
    }

    int pos = 0;
    for (int i = 0; i < mergedHashSet.keys.length; i++) {
        if (mergedHashSet.allocated[i]) {
            for (int j = 0; j < bitSets.length; ++j) {
                if (hashSets[j].contains(mergedHashSet.keys[i])) {
                    bitSets[j].set(pos);
                }
            }
            ++pos;
        }
    }

    return bitSets;
}
 
开发者ID:dice-group,项目名称:Palmetto,代码行数:22,代码来源:BitSetBasedBooleanDocumentFrequencyDeterminer.java

示例3: initCentroids

import com.carrotsearch.hppc.IntOpenHashSet; //导入方法依赖的package包/类
/** Initializes random centroids. */
private void initCentroids()
{
	IntOpenHashSet set = new IntOpenHashSet();
	Random rand = new Random(RAND_SEED);
	d_centroid  = new double[K*D];
	d_scala     = new double[K];
	
	while (set.size() < K)
		set.add(rand.nextInt(N));

	int[] unit;
	int k = 0;
	
	for (IntCursor cur : set)
	{
		unit = v_units.get(cur.value);
		
		for (int index : unit)
			d_centroid[getCentroidIndex(k, index)] = 1;
		
		d_scala[k++] = Math.sqrt(unit.length);
	}
}
 
开发者ID:clearnlp,项目名称:clearnlp,代码行数:25,代码来源:Kmeans.java

示例4: largeCollectionToString

import com.carrotsearch.hppc.IntOpenHashSet; //导入方法依赖的package包/类
public static <T> String largeCollectionToString(IntOpenHashSet collection) {
	StringBuilder sb = new StringBuilder();
	if (collection.size() < TEXT_SPLITTING_CONSTANT) {
		sb.append(collection.toString());
	} else {
		sb.append("[");
		int a = 0;
		for (IntCursor cursor : collection) {
			a++;
			if (a < TEXT_SPLITTING_CONSTANT
					|| a > collection.size() - TEXT_SPLITTING_CONSTANT / 3) {
				sb.append(cursor.value);
				sb.append(", ");
			} else if (a == TEXT_SPLITTING_CONSTANT) {
				sb.append("    .    .    .    ");
			}
		}
		sb.append("]");
	}
	return sb.toString();
}
 
开发者ID:Friker,项目名称:min-dom-set,代码行数:22,代码来源:Utils.java

示例5: DirectedGraph

import com.carrotsearch.hppc.IntOpenHashSet; //导入方法依赖的package包/类
public DirectedGraph(ArrayList<Edge> edges) {
	ObjectArrayList<Edge> gedges = new ObjectArrayList<>(edges.size());
	for (Edge edge : edges) {
		gedges.add(edge);
	}
	this.edges = gedges;
	this.neighboursOf = new IntObjectOpenHashMap<>(edges.size());
	IntOpenHashSet vertices = new IntOpenHashSet();
	for (ObjectCursor<Edge> ecur : getEdges()) {
		vertices.add(ecur.value.from);
		vertices.add(ecur.value.to);
		IntOpenHashSet a = neighboursOf.getOrDefault(ecur.value.from, IntOpenHashSet.newInstance());
		a.add(ecur.value.to);
		neighboursOf.put(ecur.value.from, a);
	}
	this.vertices = vertices;
	this.verticesCount = vertices.size();
}
 
开发者ID:Friker,项目名称:min-dom-set,代码行数:19,代码来源:DirectedGraph.java

示例6: getDistinctValues

import com.carrotsearch.hppc.IntOpenHashSet; //导入方法依赖的package包/类
/**
 * Returns the distinct values.
 *
 * @param level
 * @return
 */
public int[] getDistinctValues(final int level) {

    final IntOpenHashSet vals = new IntOpenHashSet();
    for (int k = 0; k < map.length; k++) {
        vals.add(map[k][level]);
    }

    final int[] result = new int[vals.size()];
    final int[] keys = vals.keys;
    final boolean[] allocated = vals.allocated;
    int index = 0;
    for (int i = 0; i < allocated.length; i++) {
        if (allocated[i]) {
            result[index++] = keys[i];
        }
    }
    return result;
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:25,代码来源:GeneralizationHierarchy.java

示例7: intersectionWithNeighbors

import com.carrotsearch.hppc.IntOpenHashSet; //导入方法依赖的package包/类
public IntOpenHashSet intersectionWithNeighbors(IntOpenHashSet source, int onlyIncludeNeighborsOf) {
    if (source.isEmpty()) return SetUtils.emptySet();

    IntOpenHashSet copy = new IntOpenHashSet(source.size());
    for (int i = 0; i < verticies.size(); i++) {
        if (onlyIncludeNeighborsOf == i) continue;
        if (weights.weight(onlyIncludeNeighborsOf, i) > 0) {
            if (source.contains(i)) {
                copy.add(i);
            }
        }
    }
    return copy;
}
 
开发者ID:steveash,项目名称:maxclique,代码行数:15,代码来源:Graph.java

示例8: requestDocFreq

import com.carrotsearch.hppc.IntOpenHashSet; //导入方法依赖的package包/类
@RequestMapping(value = "df")
public ResponseEntity<byte[]> requestDocFreq(@RequestParam(value = "words") String words) {
    if (luceneAdapter instanceof BooleanDocumentSupportingAdapter) {
        String array[] = words.split(WORD_SEPARATOR);
        IntOpenHashSet documentIds = new IntOpenHashSet();
        IntBuffer buffers[] = new IntBuffer[array.length];
        int completeLength = 0;
        for (int j = 0; j < array.length; ++j) {
            documentIds.clear();
            ((BooleanDocumentSupportingAdapter) luceneAdapter).getDocumentsWithWordAsSet(array[j], documentIds);
            completeLength += (4 * documentIds.size()) + 4;
            buffers[j] = IntBuffer.allocate(documentIds.size());
            if (documentIds.size() > 0) {
                for (int i = 0; i < documentIds.keys.length; ++i) {
                    if (documentIds.allocated[i]) {
                        buffers[j].put(documentIds.keys[i]);
                    }
                }
            }
        }
        ByteBuffer response = ByteBuffer.allocate(completeLength);
        IntBuffer intView = response.asIntBuffer();
        for (int j = 0; j < buffers.length; ++j) {
            intView.put(buffers[j].capacity());
            intView.put(buffers[j].array());
        }
        return new ResponseEntity<byte[]>(response.array(), HttpStatus.OK);
    } else {
        return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
    }
}
 
开发者ID:dice-group,项目名称:Palmetto,代码行数:32,代码来源:PalmettoApplication.java

示例9: candidateForGreedy

import com.carrotsearch.hppc.IntOpenHashSet; //导入方法依赖的package包/类
private ResultHolder candidateForGreedy(int oldMax) {
	ResultHolder rh = new ResultHolder();
	int max = -1;
	int maxCount = -1;
	int maxSweep = -1;
	rh.skipped = 0;
	int iterations = 0;
	for (IntCursor current : W) {
		iterations = iterations + 1;
		int currentCount = neigNonG.get(current.value).size();
		IntOpenHashSet nn = neigNonG.get(current.value);
		int sweepCardinality = 0;
		for (IntCursor nncur : nn) {
			IntOpenHashSet nnn = neigNonG.get(nncur.value);
			if (nnn.size() == 1 && nnn.contains(current.value)) {
				sweepCardinality = sweepCardinality + 1;
			} else if (nnn.size() == 2 && nnn.contains(nncur.value) && nnn.contains(current.value)) {
				sweepCardinality = sweepCardinality + 1;
			}
		}
		if ((currentCount > maxCount)
				|| (currentCount == maxCount && sweepCardinality > maxSweep)) {
			max = current.value;
			maxCount = currentCount;
			maxSweep = sweepCardinality;
		}
	}
	rh.result = max;
	rh.neighCount = maxCount;
	rh.iterations = iterations;
	return rh;
}
 
开发者ID:Friker,项目名称:min-dom-set,代码行数:33,代码来源:FlowerMacoAlgorithm.java

示例10: clearEmptyFlowers

import com.carrotsearch.hppc.IntOpenHashSet; //导入方法依赖的package包/类
private void clearEmptyFlowers() {
	IntOpenHashSet emptyFlowers = new IntOpenHashSet();
	for (IntCursor potcur : potentialFlowers) {
		int potF = potcur.value;
		if (neigNonG.get(potF).size() == 0) {
			emptyFlowers.add(potF);
		}
		IntOpenHashSet fs = keyHasGrantedFlowerByValues.get(potF);
		if (fs == null || fs.size() == 0) {
			emptyFlowers.add(potF);
		}
	}
	potentialFlowers.removeAll(emptyFlowers);
}
 
开发者ID:Friker,项目名称:min-dom-set,代码行数:15,代码来源:FlowerMacoAlgorithm.java

示例11: gms

import com.carrotsearch.hppc.IntOpenHashSet; //导入方法依赖的package包/类
private IntOpenHashSet gms(IntArrayList choiceVertex,
		IntOpenHashSet chosenVertices, Graph g) {
	if (choiceVertex.size() == 0) {
		// we have made our choice - let's compute it
		IntOpenHashSet neighbours = new IntOpenHashSet(chosenVertices.size() << 1);
		for (IntCursor vertex : chosenVertices) {
			neighbours.addAll(g.getN1(vertex.value));
		}
		/*
		 * for (Integer l : chosenVertices) { System.out.print(l);
		 * System.out.print(" "); } System.out.print(" --> "); for (Integer l :
		 * neighbours) { System.out.print(l); System.out.print(" "); }
		 */
		if (neighbours.size() == g.getNumberOfVertices()) {
			// System.out.println("*");
			return chosenVertices;
		} else {
			// System.out.println("");
			return null;
		}
	} else {
		int v = choiceVertex.get(choiceVertex.size() - 1);
		IntArrayList ch = new IntArrayList(choiceVertex);
		ch.remove(choiceVertex.size() - 1);

		// choose vertices
		// don't choose current
		IntOpenHashSet set1 = gms(ch, chosenVertices, g);
		// choose current
		IntOpenHashSet chV = new IntOpenHashSet(chosenVertices);
		chV.add(v);
		IntOpenHashSet set2 = gms(ch, chV, g);
		if (set1 == null)
			return set2;
		if ((set2 != null) && (set2.size() <= set1.size()))
			return set2;
		return set1;
	}
}
 
开发者ID:Friker,项目名称:min-dom-set,代码行数:40,代码来源:NaiveAlgorithm.java

示例12: containsAll

import com.carrotsearch.hppc.IntOpenHashSet; //导入方法依赖的package包/类
/** Is small set contained in big set? */
public static boolean containsAll(IntOpenHashSet bigSet,
		IntOpenHashSet smallSet) {
	if (smallSet.size() > bigSet.size()) {
		return false;
	}
	boolean isContained = true;
	for (IntCursor smallcur : smallSet) {
		if (!bigSet.contains(smallcur.value)) {
			isContained = false;
			break;
		}
	}
	return isContained;
}
 
开发者ID:Friker,项目名称:min-dom-set,代码行数:16,代码来源:Utils.java

示例13: getDel

import com.carrotsearch.hppc.IntOpenHashSet; //导入方法依赖的package包/类
private ObjectArrayList<RepresentedSet> getDel(RepresentedSet set,
		ObjectArrayList<RepresentedSet> sets) {
	ObjectArrayList<RepresentedSet> result = new ObjectArrayList<>();
	for (ObjectCursor<RepresentedSet> rscur : sets) {
		IntOpenHashSet ss = new IntOpenHashSet(rscur.value.getSet());
		ss.removeAll(set.getSet());
		if (ss.size() > 0) {
			RepresentedSet ns = new RepresentedSet(
					rscur.value.getRepresentant(), ss);
			result.add(ns);
		}
	}
	return result;
}
 
开发者ID:Friker,项目名称:min-dom-set,代码行数:15,代码来源:AlgorithmMSCFNaive.java

示例14: doPartialRetry

import com.carrotsearch.hppc.IntOpenHashSet; //导入方法依赖的package包/类
public static Collection<KVPair> doPartialRetry(BulkWrite bulkWrite,BulkWriteResult response,long id) throws Exception{
    IntOpenHashSet notRunRows=response.getNotRunRows();
    IntObjectOpenHashMap<WriteResult> failedRows=response.getFailedRows();
    Collection<KVPair> toRetry=new ArrayList<>(failedRows.size()+notRunRows.size());
    List<String> errorMsgs= Lists.newArrayListWithCapacity(failedRows.size());
    int i=0;
    Collection<KVPair> allWrites=bulkWrite.getMutations();
    for(KVPair kvPair : allWrites){
        if(notRunRows.contains(i))
            toRetry.add(kvPair);
        else{
            WriteResult writeResult=failedRows.get(i);
            if(writeResult!=null){
                errorMsgs.add(writeResult.getErrorMessage());
                if(writeResult.canRetry())
                    toRetry.add(kvPair);
            }
        }
        i++;
    }
    if(LOG.isTraceEnabled()){
        int[] errorCounts=new int[11];
        for(IntObjectCursor<WriteResult> failedCursor : failedRows){
            errorCounts[failedCursor.value.getCode().ordinal()]++;
        }
        SpliceLogUtils.trace(LOG,"[%d] %d failures with types: %s",id,failedRows.size(),Arrays.toString(errorCounts));
    }

    return toRetry;
}
 
开发者ID:splicemachine,项目名称:spliceengine,代码行数:31,代码来源:PipelineUtils.java

示例15: candidateForPotentialFlower

import com.carrotsearch.hppc.IntOpenHashSet; //导入方法依赖的package包/类
private ResultHolder candidateForPotentialFlower(int oldMax) {
	ResultHolder rh = new ResultHolder();
	int max = -1;
	int maxCount = -1;
	int maxCar = Integer.MAX_VALUE;
	// int maxCar = -1;
	int maxSweep = -1;
	rh.skipped = 0;
	int iterations = 0;
	for (IntCursor potcur : potentialFlowers) {
		iterations = iterations + 1;
		// System.out.println(potcur.value);
		int flowerCardinality = keyHasGrantedFlowerByValues.get(
				potcur.value).size();
		IntOpenHashSet nn = neigNonG.get(potcur.value);
		int vertexCardinality = nn.size();
		int sweepCardinality = 0;
		for (IntCursor nncur : nn) {
			IntOpenHashSet nnn = neigNonG.get(nncur.value);
			if (nnn.size() == 1 && nnn.contains(nncur.value)) {
				sweepCardinality = sweepCardinality + 1;
			} else if (nnn.size() == 2 && nnn.contains(nncur.value) && nnn.contains(potcur.value)) {
				sweepCardinality = sweepCardinality + 1;
			}
		}
		if ((flowerCardinality > maxCount)
				|| ((flowerCardinality == maxCount) && (sweepCardinality > maxSweep))
				|| ((flowerCardinality == maxCount)
						&& (sweepCardinality == maxSweep) && (vertexCardinality < maxCar))) {
			max = potcur.value;
			maxCount = flowerCardinality;
			maxCar = vertexCardinality;
			maxSweep = sweepCardinality;
		}
		// if (oldMax == flowerCardinality) {
		// rh.skipped = 1;
		// break;
		// }
	}
	rh.result = max;
	rh.neighCount = maxCount;
	rh.iterations = iterations;
	return rh;
}
 
开发者ID:Friker,项目名称:min-dom-set,代码行数:45,代码来源:FlowerMacoAlgorithm.java


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