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


Java IntOpenHashSet.contains方法代码示例

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


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

示例1: getDEPTreeWithoutEdited

import com.carrotsearch.hppc.IntOpenHashSet; //导入方法依赖的package包/类
public DEPTree getDEPTreeWithoutEdited(CTTree cTree, DEPTree dTree)
{
	IntOpenHashSet set = new IntOpenHashSet();
	addEditedTokensAux(cTree.getRoot(), set);
	int i, j, size = dTree.size();
	DEPTree tree = new DEPTree();
	DEPNode node;
	
	for (i=1,j=1; i<size; i++)
	{
		if (!set.contains(i))
		{
			node = dTree.get(i);
			node.id = j++;
			removeEditedHeads(node.getXHeads(), set);
			removeEditedHeads(node.getSHeads(), set);
			tree.add(node);
		}
	}
	
	return (tree.size() == 1) ? null : tree;
}
 
开发者ID:clearnlp,项目名称:clearnlp,代码行数:23,代码来源:C2DConvertMulti.java

示例2: aug

import com.carrotsearch.hppc.IntOpenHashSet; //导入方法依赖的package包/类
private static boolean aug(ObjectOpenHashSet<Edge> edges, int white,
		IntOpenHashSet visitedBlack, IntIntOpenHashMap match,
		IntOpenHashSet blackSet) {
	for (IntCursor blackcur : blackSet) {
		boolean contains = false;
		final int black = blackcur.value;
		for (ObjectCursor<Edge> ecur : edges) {
			if ((white == ecur.value.from)
					&& (black == ecur.value.to)) {
				contains = true;
			}
		}
		if (contains && !visitedBlack.contains(black)) {
			visitedBlack.add(black);
			if (match.get(black) == -1L
					|| aug(edges, match.get(black), visitedBlack, match,
							blackSet)) {
				match.put(black, white);
				return true;
			}
		}
	}
	return false;
}
 
开发者ID:Friker,项目名称:min-dom-set,代码行数:25,代码来源:Utils.java

示例3: removeOldstatResults

import com.carrotsearch.hppc.IntOpenHashSet; //导入方法依赖的package包/类
protected IntObjectOpenHashMap<StatResult> removeOldstatResults(IntObjectOpenHashMap<StatResult> statResults) {
	// create mapping dataset -> statResults
	ObjectObjectOpenHashMap<String, StatResult> datasetStatResultsMapping = new ObjectObjectOpenHashMap<String, StatResult>();
	IntOpenHashSet removedStatResults = new IntOpenHashSet();
	StatResult statResult, statResult2;
	StatResultComparator comparator = new StatResultComparator();
	for (int i = 0; i < statResults.allocated.length; ++i) {
		if (statResults.allocated[i]) {
			statResult = (StatResult) ((Object[]) statResults.values)[i];
			if (datasetStatResultsMapping.containsKey(statResult.datasetUri)) {
				statResult2 = datasetStatResultsMapping.get(statResult.datasetUri);
				if (comparator.compare(statResult, statResult2) > 0) {
					datasetStatResultsMapping.put(statResult.datasetUri, statResult);
					removedStatResults.add(statResult2.id);
					// statResults.remove(statResult2.id);
				} else {
					// statResults.remove(statResult.id);
					removedStatResults.add(statResult.id);
				}
			} else {
				datasetStatResultsMapping.put(statResult.datasetUri, statResult);
			}
		}
	}
	datasetStatResultsMapping = null;
	IntObjectOpenHashMap<StatResult> newStatResults = new IntObjectOpenHashMap<StatResult>();
	for (int i = 0; i < statResults.allocated.length; ++i) {
		if (statResults.allocated[i]) {
			if (!removedStatResults.contains(statResults.keys[i])) {
				newStatResults.put(statResults.keys[i], (StatResult) ((Object[]) statResults.values)[i]);
			}
		}
	}
	return newStatResults;
}
 
开发者ID:dice-group,项目名称:Tapioca,代码行数:36,代码来源:StatResultsReader.java

示例4: removeOldstatResults

import com.carrotsearch.hppc.IntOpenHashSet; //导入方法依赖的package包/类
/**
 * Filter StatResults.
 * 
 * @param statResults
 * @return filtered statResults
 */
protected IntObjectOpenHashMap<StatResult> removeOldstatResults(IntObjectOpenHashMap<StatResult> statResults) {
	// create mapping data set -> statResults
	ObjectObjectOpenHashMap<String, StatResult> datasetStatResultsMapping = new ObjectObjectOpenHashMap<String, StatResult>();
	IntOpenHashSet removedStatResults = new IntOpenHashSet();
	StatResult statResult, statResult2;
	StatResultComparator comparator = new StatResultComparator();
	for (int i = 0; i < statResults.allocated.length; ++i) {
		if (statResults.allocated[i]) {
			statResult = (StatResult) ((Object[]) statResults.values)[i];
			if (datasetStatResultsMapping.containsKey(statResult.datasetUri)) {
				statResult2 = datasetStatResultsMapping.get(statResult.datasetUri);
				if (comparator.compare(statResult, statResult2) > 0) {
					datasetStatResultsMapping.put(statResult.datasetUri, statResult);
					removedStatResults.add(statResult2.id);
					// statResults.remove(statResult2.id);
				} else {
					// statResults.remove(statResult.id);
					removedStatResults.add(statResult.id);
				}
			} else {
				datasetStatResultsMapping.put(statResult.datasetUri, statResult);
			}
		}
	}
	datasetStatResultsMapping = null;
	IntObjectOpenHashMap<StatResult> newStatResults = new IntObjectOpenHashMap<StatResult>();
	for (int i = 0; i < statResults.allocated.length; ++i) {
		if (statResults.allocated[i]) {
			if (!removedStatResults.contains(statResults.keys[i])) {
				newStatResults.put(statResults.keys[i], (StatResult) ((Object[]) statResults.values)[i]);
			}
		}
	}
	return newStatResults;
}
 
开发者ID:dice-group,项目名称:Tapioca,代码行数:42,代码来源:StatResultsReader.java

示例5: dfsBackward

import com.carrotsearch.hppc.IntOpenHashSet; //导入方法依赖的package包/类
private static void dfsBackward(MutableState state, IntOpenHashSet coaccessible) {
  coaccessible.add(state.getId());
  for (MutableState incoming : state.getIncomingStates()) {
    if (!coaccessible.contains(incoming.getId())) {
      dfsBackward(incoming, coaccessible);
    }
  }
}
 
开发者ID:steveash,项目名称:jopenfst,代码行数:9,代码来源:Connect.java

示例6: dfsForward

import com.carrotsearch.hppc.IntOpenHashSet; //导入方法依赖的package包/类
private static void dfsForward(MutableState start, IntOpenHashSet accessible) {
  accessible.add(start.getId());
  for (MutableArc arc : start.getArcs()) {
    MutableState nextState = arc.getNextState();
    if (!accessible.contains(nextState.getId())) {
      dfsForward(nextState, accessible);
    }
  }
}
 
开发者ID:steveash,项目名称:jopenfst,代码行数:10,代码来源:Connect.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: getArcs

import com.carrotsearch.hppc.IntOpenHashSet; //导入方法依赖的package包/类
@Deprecated
private List<DEPCountArc> getArcs(List<StringIntPair[]> lHeads, IntOpenHashSet T)
{
	Map<String,DEPCountArc> map = new HashMap<String,DEPCountArc>();
	int i, depId, len = size(), size = lHeads.size();
	DEPCountArc val;
	StringIntPair[] heads;
	StringIntPair head;
	String key;
	
	for (i=0; i<size; i++)
	{
		heads = lHeads.get(i);
		
		for (depId=1; depId<len; depId++)
		{
			head = heads[depId];
			
			if (head != null && T.contains(head.i) && !T.contains(depId))
			{
				key = depId+"_"+head.i+"_"+head.s;
				val = map.get(key);
					
				if (val == null)
				{
					val = new DEPCountArc(1, i, depId, head.i, head.s);
					map.put(key, val);
				}
				else
					val.count++;
				
				heads[depId] = null;	
			}
		}
	}
	
	return new ArrayList<DEPCountArc>(map.values());
}
 
开发者ID:clearnlp,项目名称:clearnlp,代码行数:39,代码来源:DEPTree.java

示例9: removeEditedHeads

import com.carrotsearch.hppc.IntOpenHashSet; //导入方法依赖的package包/类
private <T extends DEPArc>void removeEditedHeads(List<T> heads, IntOpenHashSet set)
{
	List<T> remove = Lists.newArrayList();
	
	for (T arc : heads)
	{
		if (set.contains(arc.getNode().id))
			remove.add(arc);
	}
	
	heads.removeAll(remove);
}
 
开发者ID:clearnlp,项目名称:clearnlp,代码行数:13,代码来源:C2DConvertMulti.java

示例10: 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

示例11: 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

示例12: isMDS

import com.carrotsearch.hppc.IntOpenHashSet; //导入方法依赖的package包/类
@Override
public boolean isMDS(IntOpenHashSet mds) {
	IntOpenHashSet set = new IntOpenHashSet(maxVertexNumber);
	for (IntCursor v : mds) {
		set.addAll(getN1(v.value));
	}
	boolean isContained = true;
	for (int i = 1; i <= maxVertexNumber; i++) {
		if (!set.contains(i)) {
			isContained = false;
			break;
		}
	}
	return isContained;
}
 
开发者ID:Friker,项目名称:min-dom-set,代码行数:16,代码来源:CompactUndirectedGraph.java

示例13: isMDS

import com.carrotsearch.hppc.IntOpenHashSet; //导入方法依赖的package包/类
@Override
public boolean isMDS(IntOpenHashSet mds) {
	IntOpenHashSet set = new IntOpenHashSet(verticesCount);
	for (IntCursor v : mds) {
		set.addAll(getN1(v.value));
	}
	boolean isContained = true;
	for (Integer i : vertices) {
		if (!set.contains(i)) {
			isContained = false;
			break;
		}
	}
	return isContained;
}
 
开发者ID:Friker,项目名称:min-dom-set,代码行数:16,代码来源:UndirectedGraph.java

示例14: isMDS

import com.carrotsearch.hppc.IntOpenHashSet; //导入方法依赖的package包/类
@Override
public boolean isMDS(IntOpenHashSet mds) {
	IntOpenHashSet set = new IntOpenHashSet(verticesCount);
	for (IntCursor v : mds) {
		set.addAll(getN1(v.value));
	}
	boolean isContained = true;
	for (IntCursor icur : vertices) {
		if (!set.contains(icur.value)) {
			isContained = false;
			break;
		}
	}
	return isContained;
}
 
开发者ID:Friker,项目名称:min-dom-set,代码行数:16,代码来源:DirectedGraph.java

示例15: propagateAlongCasts

import com.carrotsearch.hppc.IntOpenHashSet; //导入方法依赖的package包/类
private void propagateAlongCasts() {
    ClassReaderSource classSource = dependencyInfo.getClassSource();

    for (ValueCast cast : casts) {
        int fromNode = nodeMapping[packNodeAndDegree(cast.fromVariable, 0)];
        if (!formerNodeChanged[fromNode] && !nodeChanged[fromNode]) {
            continue;
        }

        int toNode = nodeMapping[packNodeAndDegree(cast.toVariable, 0)];
        IntOpenHashSet targetTypes = getNodeTypes(toNode);

        for (IntCursor cursor : types[fromNode]) {
            if (targetTypes.contains(cursor.value)) {
                continue;
            }
            String className = typeList.get(cursor.value);

            ValueType type;
            if (className.startsWith("[")) {
                type = ValueType.parseIfPossible(className);
                if (type == null) {
                    type = ValueType.arrayOf(ValueType.object("java.lang.Object"));
                }
            } else {
                type = ValueType.object(className);
            }

            if (classSource.isSuperType(cast.targetType, type).orElse(false)) {
                changed = true;
                nodeChanged[toNode] = true;
                targetTypes.add(cursor.value);
            }
        }
    }
}
 
开发者ID:konsoletyper,项目名称:teavm,代码行数:37,代码来源:ClassInference.java


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