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


Java THashSet.removeAll方法代码示例

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


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

示例1: nextSeeds

import gnu.trove.set.hash.THashSet; //导入方法依赖的package包/类
private Stack<Seed> nextSeeds(int currentRHSIndex) {
//		System.out.println("Find holes");
		THashSet<ColumnCollection> deps = new THashSet<>();
		ArrayList<ColumnCollection> currentMaximalNonDependencies = maximalNonDependencies.getLHSForRHS(currentRHSIndex);
		HashSet<ColumnCollection> currentMinimalDependencies = new HashSet<>(minimalDependencies.getLHSForRHS(currentRHSIndex));
		ArrayList<ColumnCollection> newDeps = new ArrayList<>(numberOfColumns * deps.size());
//		Holes holes = new Holes();
		
//		int i = 0;
//		for (ColumnCollection maximalNonDependency : currentMaximalNonDependencies) {
//			ColumnCollection complement = maximalNonDependency.setCopy(currentRHSIndex).complement();
//			if (deps.isEmpty()) {
//				ColumnCollection emptyColumnIndices = new ColumnCollection(numberOfColumns);
//				for (Integer complementColumnIndex : complement.getSetBits()) {
//					deps.add(emptyColumnIndices.setCopy(complementColumnIndex));
//				}
//			} else {
//				for (ColumnCollection dep : deps) {
//					int[] setBits = complement.getSetBits();
//					for (int setBit = 0; setBit < setBits.length; setBit++) {
//						holes.add(dep.setCopy(setBits[setBit]));
////						System.out.println("Dep:\t" + dep.setCopy(setBits[setBit]));
//					}
//				}
//				// minimize newDeps
//				System.out.println(i++ + "\t" + currentMaximalNonDependencies.size());
//				System.out.println("total deps:\t" + deps.size());
//				System.out.println("before minimizing:\t" + holes.size());
////				ArrayList<ColumnCollection> minimizedNewDeps = minimizeSeeds(newDeps);
//				holes.minimize();
//				System.out.println("after minimizing:\t" + holes.size());
//				deps.clear();
//				deps.addAll(holes);
//				holes.clear();
//			}
//		}

		for (ColumnCollection maximalNonDependency : currentMaximalNonDependencies) {
			ColumnCollection complement = maximalNonDependency.setCopy(currentRHSIndex).complement();
			if (deps.isEmpty()) {
				ColumnCollection emptyColumnIndices = new ColumnCollection(numberOfColumns);
				for (Integer complementColumnIndex : complement.getSetBits()) {
					deps.add(emptyColumnIndices.setCopy(complementColumnIndex));
				}
			} else {
				for (ColumnCollection dep : deps) {
					int[] setBits = complement.getSetBits();
					for (int setBit = 0; setBit < setBits.length; setBit++) {
						newDeps.add(dep.setCopy(setBits[setBit]));
					}
				}
				// minimize newDeps
				ArrayList<ColumnCollection> minimizedNewDeps = minimizeSeeds(newDeps);
				deps.clear();
				deps.addAll(minimizedNewDeps);
				newDeps.clear();
			}
		}
		
		// return only elements that aren't already covered by the minimal
		// dependencies
		Stack<Seed> remainingSeeds = new Stack<>();
		deps.removeAll(currentMinimalDependencies);
		for (ColumnCollection remainingSeed : deps) {
			remainingSeeds.push(new Seed(remainingSeed));
		}

		return remainingSeeds;
	}
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:70,代码来源:DFDMiner.java

示例2: randomWalkStep

import gnu.trove.set.hash.THashSet; //导入方法依赖的package包/类
private Seed randomWalkStep(Seed currentSeed, Integer currentRHSIndex) {
	Observation observationOfSeed = this.observations.get(currentSeed.getIndices());

	if (observationOfSeed == Observation.CANDIDATE_MINIMAL_DEPENDENCY) {
		THashSet<ColumnCollection> uncheckedSubsets = this.observations.getUncheckedMaximalSubsets(currentSeed.getIndices(), columnOrder);
		THashSet<ColumnCollection> prunedNonDependencySubsets = nonDependencies.getPrunedSupersets(uncheckedSubsets);
		for (ColumnCollection prunedNonDependencySubset : prunedNonDependencySubsets) {
			observations.put(prunedNonDependencySubset, Observation.NON_DEPENDENCY);
		}
		uncheckedSubsets.removeAll(prunedNonDependencySubsets);
		if (uncheckedSubsets.isEmpty() && prunedNonDependencySubsets.isEmpty()) {
			observations.put(currentSeed.getIndices(), Observation.MINIMAL_DEPENDENCY);
			minimalDependencies.addRHSColumn(currentSeed.getIndices(), currentRHSIndex);
		} else if (!uncheckedSubsets.isEmpty()) {
			ColumnCollection notRepresentedUncheckedSubset = uncheckedSubsets.iterator().next();
			if (notRepresentedUncheckedSubset != null) {
				trace.push(currentSeed);
				return new Seed(notRepresentedUncheckedSubset);
			}
		}
	} else if (observationOfSeed == Observation.CANDIDATE_MAXIMAL_NON_DEPENDENCY) {
		THashSet<ColumnCollection> uncheckedSupersets = this.observations.getUncheckedMinimalSupersets(currentSeed.getIndices(), currentRHSIndex, columnOrder);
		THashSet<ColumnCollection> prunedNonDependencySupersets = nonDependencies.getPrunedSupersets(uncheckedSupersets);
		THashSet<ColumnCollection> prunedDependencySupersets = dependencies.getPrunedSubsets(uncheckedSupersets);
		for (ColumnCollection prunedNonDependencySuperset : prunedNonDependencySupersets) {
			observations.put(prunedNonDependencySuperset, Observation.NON_DEPENDENCY);
		}
		for (ColumnCollection prunedDependencySuperset : prunedDependencySupersets) {
			observations.put(prunedDependencySuperset, Observation.DEPENDENCY);
		}
		uncheckedSupersets.removeAll(prunedDependencySupersets);
		uncheckedSupersets.removeAll(prunedNonDependencySupersets);
		if (uncheckedSupersets.isEmpty() && prunedNonDependencySupersets.isEmpty()) {
			observations.put(currentSeed.getIndices(), Observation.MAXIMAL_NON_DEPENDENCY);
			maximalNonDependencies.addRHSColumn(currentSeed.getIndices(), currentRHSIndex);
		} else if (!uncheckedSupersets.isEmpty()) {
			ColumnCollection notRepresentedUncheckedSuperset = uncheckedSupersets.iterator().next();
			if (notRepresentedUncheckedSuperset != null) {
				trace.push(currentSeed);
				int additionalColumn = notRepresentedUncheckedSuperset.removeCopy(currentSeed.getIndices()).nextSetBit(0);
				return new Seed(notRepresentedUncheckedSuperset, additionalColumn);
			}
		}
	}
	if (!this.trace.isEmpty()) {
		Seed nextSeed = this.trace.pop();
		return nextSeed;
	}
	return null;
}
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:51,代码来源:DFDMiner.java


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