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


Java TreeSet.contains方法代码示例

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


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

示例1: expandMethodLevelCluster2Bodies

import java.util.TreeSet; //导入方法依赖的package包/类
private TreeSet<LSDFact> expandMethodLevelCluster2Bodies (PrintStream p, List<LSDFact> methodLevelCluster) { 
	TreeSet<LSDFact> ontheflyDeltaKB = new TreeSet<LSDFact>(); 
	TreeSet<String> methodConstants = null; 
	if (methodLevelCluster!=null) { 
		methodConstants= new TreeSet<String>(); 
		for (LSDFact methodF: methodLevelCluster) { 
			methodConstants.add(methodF.getBindings().get(0).getGroundConst());
		}
	}

	for (LSDFact fact:originalDeltaKB) {
		String involvedMethod =null;  
		if (fact.getPredicate().getName().indexOf("_calls")>0) { 
			involvedMethod= fact.getBindings().get(0).getGroundConst(); 
		}
		else if (fact.getPredicate().getName().indexOf("_accesses")>0) { 
			involvedMethod = fact.getBindings().get(1).getGroundConst(); 
		}
		if (involvedMethod!=null && (methodConstants==null || methodConstants.contains(involvedMethod))){
			if (p!=null) p.println("\t\t\t"+ fact); 
			ontheflyDeltaKB.add(fact);
		}
	}
	return ontheflyDeltaKB;
}
 
开发者ID:aserg-ufmg,项目名称:RefDiff,代码行数:26,代码来源:LSdiffHierarchialDeltaKB.java

示例2: contract

import java.util.TreeSet; //导入方法依赖的package包/类
/**
 * Contracts a population vector to the necessary size depending on partially covered classes in smallPcs.
 * @param largePopVec The population vector containing populations for each class in largePcs.
 * @param largePcs The set of partially covered classes corresponding to the largePopVec.
 * @param smallPcs The set of partially covered classes we want to find populations for.
 * @return The population vector containing populations for each class in smallPcs.
 */
public PopulationVector contract(
	PopulationVector largePopVec,
	TreeSet<Integer> largePcs,
	TreeSet<Integer> smallPcs) {
		
	PopulationVector contracted = new PopulationVector(0, smallPcs.size());
	int smallIdx = 0;
	int largeIdx = 0;
	for (int k : largePcs) {
		if (smallPcs.contains(k)) {
			contracted.set(smallIdx, largePopVec.get(largeIdx));
			smallIdx++;
		}
		largeIdx++;
	}
	
	return contracted;
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:26,代码来源:ClassCoverageUtils.java

示例3: setIndexRelations

import java.util.TreeSet; //导入方法依赖的package包/类
/**
 * set user-defined index relationships, only available for tables with user-defined index
 *
 * @param list
 * @throws IllegalIndexException
 */
public void setIndexRelations(List<IndexRelationship> list) throws IllegalIndexException {
  if (!IndexType.isUserDefinedIndex(indexType)) {
    throw new IllegalIndexException(tableName, indexType,
        "should not has user-defined index table");
  }
  if (list == null || list.isEmpty()) indexRelations = null;
  else {
    indexRelations = list;
    // check relations
    for (IndexRelationship one : list) {
      indexFamilyMap = new TreeMap<>(Bytes.BYTES_COMPARATOR);
      byte[] family = one.getMainColumn().getFamily();
      TreeSet<byte[]> set = indexFamilyMap.get(family);
      if (set == null) {
        set = new TreeSet<>(Bytes.BYTES_COMPARATOR);
        indexFamilyMap.put(family, set);
      }
      if (set.contains(one.getMainColumn().getQualifier()))
        throw new IllegalIndexException(tableName, indexType,
            " should not contain different index relations on the same column: " + ColumnInfo
                .transToString(family, one.getMainColumn().getQualifier()));
      set.add(one.getMainColumn().getQualifier());
    }
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:32,代码来源:IndexTableRelation.java

示例4: addBlockingRegion

import java.util.TreeSet; //导入方法依赖的package包/类
/**
 * Adds a new blocking region with unique name to current model
 * @return search's key for created blocking region
 */
public Object addBlockingRegion() {
	long num = 0L;
	String baseName = Defaults.get("blockingRegionName");

	// Gets all blocking region names to find an unique name
	TreeSet<String> names = new TreeSet<String>();
	Vector keys = getRegionKeys();
	for (int i = 0; i < keys.size(); i++) {
		names.add(getRegionName(keys.get(i)));
	}

	String name = baseName + num;
	while (names.contains(name)) {
		name = baseName + (++num);
	}

	return addBlockingRegion(name, Defaults.get("blockingRegionType"));
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:23,代码来源:JMODELModel.java

示例5: isIndexColumn

import java.util.TreeSet; //导入方法依赖的package包/类
public boolean isIndexColumn(byte[] f, byte[] q) {
  if (indexType == IndexType.NoIndex) return false;
  if (IndexType.isUserDefinedIndex(indexType)) {
    for (IndexRelationship relationship : indexRelations) {
      if (relationship.getMainColumn().isSameColumn(f, q)) return true;
    }
    return false;
  } else {
    TreeSet<byte[]> set = indexFamilyMap.get(f);
    if (set == null) return false;
    return set.contains(q);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:14,代码来源:IndexTableRelation.java

示例6: dependsOnTransitively

import java.util.TreeSet; //导入方法依赖的package包/类
private boolean dependsOnTransitively(String kit1, String kit2, 
    TreeMap<String, TreeSet<String>> dependingKits) {
    TreeSet<String> kits = dependingKits.get(kit1);
    if (kits == null) {
        return false;
    }
    return kits.contains(kit2);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:ModuleDependencies.java

示例7: expandTypeLevelCluster2Methods

import java.util.TreeSet; //导入方法依赖的package包/类
private TreeSet<LSDFact> expandTypeLevelCluster2Methods (PrintStream p, List<LSDFact> typeLevelCluster) { 	
	TreeSet<LSDFact> ontheflyDeltaKB = new TreeSet<LSDFact>(); 
	TreeSet<String> typeConstants = null; 
	TreeSet<String> methodConstants = new TreeSet<String>(); 
	if (typeLevelCluster!=null) { 
		typeConstants= new TreeSet<String>(); 
		for (LSDFact typeF: typeLevelCluster) { 
			typeConstants.add(typeF.getBindings().get(0).getGroundConst());
		}
	}
	for (String kind: methodLevel.keySet()) { 
		for (LSDFact methodF: methodLevel.get(kind)) { 
			String containerType = methodF.getBindings().get(2).getGroundConst(); 
			if (typeConstants==null || typeConstants.contains(containerType)){
				if (p!=null) p.println("\t\t"+methodF);
				ontheflyDeltaKB.add(methodF);	
				methodConstants.add(methodF.getBindings().get(0).getGroundConst());
			}
		}
	}
	// add _return facts that are related to added method level facts. 
	for (LSDFact fact : originalDeltaKB) { 
		if (fact.getPredicate().getName().indexOf("_return") > 0) { 
			String involvedMethod =  fact.getBindings().get(0).getGroundConst();
			if (methodConstants.contains(involvedMethod)) { 
				ontheflyDeltaKB.add(fact);

			}
		}
	}	
	return ontheflyDeltaKB; 
}
 
开发者ID:aserg-ufmg,项目名称:RefDiff,代码行数:33,代码来源:LSdiffHierarchialDeltaKB.java

示例8: getCommonSet

import java.util.TreeSet; //导入方法依赖的package包/类
/**
 * get common keys from two sets
 *
 * @param larger
 * @param smaller
 * @return
 */
private static TreeSet<byte[]> getCommonSet(TreeSet<byte[]> larger, TreeSet<byte[]> smaller) {
  if (larger.size() < smaller.size()) return getCommonSet(smaller, larger);
  TreeSet<byte[]> commonSet = new TreeSet<>(Bytes.BYTES_COMPARATOR);
  for (byte[] key : smaller) {
    if (larger.contains(key)) {
      commonSet.add(key);
    }
  }
  return commonSet;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:18,代码来源:GSScannerCaching.java

示例9: getUniqueClassName

import java.util.TreeSet; //导入方法依赖的package包/类
/**
 * Returns given name if a class with the same name does not exist or makes it unique
 * @param name class name
 * @return unique name
 */
protected String getUniqueClassName(String name) {
	// Map of all unique names with their first users
	TreeSet<String> names = new TreeSet<String>();
	Vector<Object> keys = getClassKeys();
	// Finds all used names
	for (int i = 0; i < keys.size(); i++) {
		names.add(getClassName(keys.get(i)));
	}

	// If name is new, returns it
	if (!names.contains(name)) {
		return name;
	}

	int num;
	// If format is already '*_[number]' increment number
	char[] charname = name.toCharArray();
	int n = charname.length - 1;
	while (charname[n] >= '0' && charname[n] <= '9' && n > 0) {
		n--;
	}
	if (charname[n] == '_') {
		num = Integer.parseInt(name.substring(n + 1));
		name = name.substring(0, n); // Removes suffix
	}
	// Otherwise uses number 1
	else {
		num = 1;
	}
	// Finds unique number
	while (names.contains(name + "_" + num)) {
		num++;
	}
	return name + "_" + num;
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:41,代码来源:CommonModel.java

示例10: getUniqueStationName

import java.util.TreeSet; //导入方法依赖的package包/类
/**
 * Returns given name if a station with the same name does not exist or makes it unique
 * @param name station name
 * @return unique name
 */
protected String getUniqueStationName(String name) {
	// Map of all unique names with their first users
	TreeSet<String> names = new TreeSet<String>();
	Vector<Object> keys = getStationKeys();
	// Finds all used names
	for (int i = 0; i < keys.size(); i++) {
		names.add(getStationName(keys.get(i)));
	}
	names.add(STATION_TYPE_FORK);
	names.add(STATION_TYPE_CLASSSWITCH);
	names.add(STATION_TYPE_SCALER);
	names.add(STATION_TYPE_TRANSITION);

	// If name is new, returns it
	if (!names.contains(name)) {
		return name;
	}

	int num;
	// If format is already '*_[number]' increment number
	char[] charname = name.toCharArray();
	int n = charname.length - 1;
	while (charname[n] >= '0' && charname[n] <= '9' && n > 0) {
		n--;
	}
	if (charname[n] == '_') {
		num = Integer.parseInt(name.substring(n + 1));
		name = name.substring(0, n); // Removes suffix
	}
	// Otherwise uses number 1
	else {
		num = 1;
	}
	// Finds unique number
	while (names.contains(name + "_" + num)) {
		num++;
	}
	return name + "_" + num;
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:45,代码来源:CommonModel.java

示例11: getUniqueClassName

import java.util.TreeSet; //导入方法依赖的package包/类
/**
 * Returns given name if a class with the same name does not exists or makes it unique
 * @param name class name
 * @return unique name
 */
private String getUniqueClassName(String name) {
	TreeSet<String> names = new TreeSet<String>(); // Map of all unique names with their first users
	Vector keys = getClassKeys();
	// Finds all used names
	for (int i = 0; i < keys.size(); i++) {
		names.add(this.getClassName(keys.get(i)));
	}

	// If name is new, returns it
	if (!names.contains(name)) {
		return name;
	}

	int num;
	// If format is already '*_[number]' increment number
	char[] charname = name.toCharArray();
	int n = charname.length - 1;
	while (charname[n] >= '0' && charname[n] <= '9' && n > 0) {
		n--;
	}
	if (charname[n] == '_') {
		num = Integer.parseInt(name.substring(n + 1));
		name = name.substring(0, n); // Removes suffix
	}
	// Otherwise uses number 1
	else {
		num = 1;
	}
	// Finds unique number
	while (names.contains(name + "_" + num)) {
		num++;
	}
	return name + "_" + num;
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:40,代码来源:JMODELModel.java

示例12: getUniqueStationName

import java.util.TreeSet; //导入方法依赖的package包/类
/**
 * Returns given name if a station with the same name does not exists or makes it unique
 * @param name station name
 * @return unique name
 */
private String getUniqueStationName(String name) {
	TreeSet<String> names = new TreeSet<String>(); // Map of all unique names with their first users
	Vector keys = getStationKeys();
	// Finds all used names
	for (int i = 0; i < keys.size(); i++) {
		names.add(this.getStationName(keys.get(i)));
	}

	// If name is new, returns it
	if (!names.contains(name)) {
		return name;
	}

	int num;
	// If format is already '*_[number]' increment number
	char[] charname = name.toCharArray();
	int n = charname.length - 1;
	while (charname[n] >= '0' && charname[n] <= '9' && n > 0) {
		n--;
	}
	if (charname[n] == '_') {
		num = Integer.parseInt(name.substring(n + 1));
		name = name.substring(0, n); // Removes suffix
	}
	// Otherwise uses number 1
	else {
		num = 1;
	}
	// Finds unique number
	while (names.contains(name + "_" + num)) {
		num++;
	}
	return name + "_" + num;
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:40,代码来源:JMODELModel.java

示例13: getPositiveIPList

import java.util.TreeSet; //导入方法依赖的package包/类
Collection<ipAddress> getPositiveIPList() {
    TreeSet<ipAddress> ipsSorted = generateIPList();
    Vector<ipAddress> ips = new Vector<ipAddress>();
    for (ipAddress ia : ipsSorted) {
        if (ia.included) ips.add(ia);
    }
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
        // Include postive routes from the original set under < 4.4 since these might overrule the local
        // network but only if no smaller negative route exists
        for (ipAddress origIp : mIpAddresses) {
            if (!origIp.included) continue;
            // The netspace exists
            if (ipsSorted.contains(origIp)) continue;
            boolean skipIp = false;
            // If there is any smaller net that is excluded we may not add the positive route back
            for (ipAddress calculatedIp : ipsSorted) {
                if (!calculatedIp.included && origIp.containsNet(calculatedIp)) {
                    skipIp = true;
                    break;
                }
            }
            if (skipIp) continue;
            // It is safe to include the IP
            ips.add(origIp);
        }
    }
    return ips;
}
 
开发者ID:akashdeepsingh9988,项目名称:Cybernet-VPN,代码行数:29,代码来源:NetworkSpace.java

示例14: getDefaultLocale

import java.util.TreeSet; //导入方法依赖的package包/类
private String getDefaultLocale()
{
	Map<String, HtmlValueState> localeMap = state.getLocaleMap();
	TreeSet<Locale> editableLocales = new TreeSet<Locale>(localeComparator);

	Locale firstValidLoc = null;
	for( Map.Entry<String, HtmlValueState> entry : localeMap.entrySet() )
	{
		Locale locale = LocaleUtils.parseLocale(entry.getKey());
		if( !Check.isEmpty(entry.getValue().getValue()) && firstValidLoc == null )
		{
			firstValidLoc = locale;
		}
		editableLocales.add(locale);
	}

	Locale currentLocale = CurrentLocale.getLocale();

	if( !editableLocales.contains(currentLocale) )
	{
		Locale closestLocale = LocaleUtils.getClosestLocale(editableLocales, currentLocale);

		if( closestLocale != null )
		{
			currentLocale = closestLocale;

			if( !isEmpty(localeMap.values()) && Check.isEmpty(localeMap.get(closestLocale.toString()).getValue()) )
			{
				currentLocale = firstValidLoc;
			}
		}
		else
		{
			currentLocale = editableLocales.first();
		}
	}

	return currentLocale.toString();
}
 
开发者ID:equella,项目名称:Equella,代码行数:40,代码来源:MultiEditBoxRenderer.java

示例15: bestNode

import java.util.TreeSet; //导入方法依赖的package包/类
private DatanodeInfo bestNode(DFSClient dfs, DatanodeInfo[] nodes,
                              TreeSet<DatanodeInfo> deadNodes) throws IOException {
  if ((nodes == null) ||
      (nodes.length - deadNodes.size() < 1)) {
    throw new IOException("No live nodes contain current block");
  }
  DatanodeInfo chosenNode;
  do {
    chosenNode = nodes[DFSUtil.getRandom().nextInt(nodes.length)];
  } while (deadNodes.contains(chosenNode));
  return chosenNode;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:13,代码来源:NamenodeFsck.java


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