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


Java THashSet.add方法代码示例

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


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

示例1: addPartition

import gnu.trove.set.hash.THashSet; //导入方法依赖的package包/类
public void addPartition(EquivalenceManagedPartition partition) {
	if (!this.observedPartitions.contains(partition.getIndices()) && !this.containsSimilarPartition(partition)) {
		this.observedPartitions.add(partition.getIndices());
		long hashNumber = partition.getHashNumber();
		System.out.println(String.format("Partition[%s]\t%d\tSize: %d", partition.getIndices(), hashNumber, partition.size()));
		partitionHashes.putIfAbsent(hashNumber, new TIntObjectHashMap<THashSet<EquivalenceManagedPartition>>());
		partitionHashes.get(hashNumber).putIfAbsent(partition.size(), new THashSet<EquivalenceManagedPartition>());
		THashSet<EquivalenceManagedPartition> partitionGroup = partitionHashes.get(hashNumber).get(partition.size());

		if (partitionGroup.isEmpty()) {
			partitionGroup.add(partition);
		} else {
			// then there is at least one element in the partitionGroup
			checkPossibleEquivalences(partitionGroup, partition);
		}
	}
}
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:18,代码来源:PartitionEquivalences.java

示例2: testReusesRemovedSlotsOnCollision

import gnu.trove.set.hash.THashSet; //导入方法依赖的package包/类
public void testReusesRemovedSlotsOnCollision() {
    THashSet<Object> set = new THashSet<Object>( 11, 0.5f );

    class Foo {

        @Override
        public int hashCode() {
            return 4;
        }
    }

    Foo f1 = new Foo();
    Foo f2 = new Foo();
    Foo f3 = new Foo();
    set.add( f1 );

    int idx = set.insertionIndex( f2 );
    set.add( f2 );
    assertEquals( f2, set._set[idx] );
    set.remove( f2 );
    assertEquals( THashSet.REMOVED, set._set[idx] );
    assertEquals( idx, set.insertionIndex( f3 ) );
    set.add( f3 );
    assertEquals( f3, set._set[idx] );
}
 
开发者ID:palantir,项目名称:trove-3.0.3,代码行数:26,代码来源:THashTest.java

示例3: getSlicesInRange

import gnu.trove.set.hash.THashSet; //导入方法依赖的package包/类
static Set<IDimensionSlice> getSlicesInRange(World w, int lx, int ly, int lz, int hx, int hy, int hz) {
    THashSet<IDimensionSlice> found_deltachunks = new THashSet<IDimensionSlice>(10);
    DeltaChunkMap map = DeltaChunk.getSlices(w); // NORELEASE: This guy keeps hold of dead DSEs? Such as after save reload.
    IDimensionSlice last_found = null;
    for (int x = lx; x <= hx; x += 16) {
        for (int z = lz; z <= hz; z += 16) {
            IDimensionSlice new_idcs[] = map.get(x/16, z/16);
            for (IDimensionSlice idc : new_idcs) {
                if (idc == last_found) continue;
                found_deltachunks.add(idc);
                last_found = idc;
            }
        }
    }
    return found_deltachunks;
}
 
开发者ID:purpleposeidon,项目名称:Factorization,代码行数:17,代码来源:DeltaChunk.java

示例4: testReusesRemovedSlotsOnCollision

import gnu.trove.set.hash.THashSet; //导入方法依赖的package包/类
public void testReusesRemovedSlotsOnCollision() {
    THashSet<Object> set = new THashSet<Object>( 11, 0.5f );

    class Foo {

        public int hashCode() {
            return 4;
        }
    }

    Foo f1 = new Foo();
    Foo f2 = new Foo();
    Foo f3 = new Foo();
    set.add( f1 );

    int idx = set.insertionIndex( f2 );
    set.add( f2 );
    assertEquals( f2, set._set[idx] );
    set.remove( f2 );
    assertEquals( THashSet.REMOVED, set._set[idx] );
    assertEquals( idx, set.insertionIndex( f3 ) );
    set.add( f3 );
    assertEquals( f3, set._set[idx] );
}
 
开发者ID:leventov,项目名称:trove-over-koloboke-compile,代码行数:25,代码来源:THashTest.java

示例5: insertCandidateAtPosition

import gnu.trove.set.hash.THashSet; //导入方法依赖的package包/类
/**
 * Make sure that concurring reads get associated with a unique candidate.
 * We should *not* insert candidates directly into candidateSequences.
 * Get interning as a small, beneficial side effect.
 * @param candidate
 * @param location
 * @return
 */
private @NonNull CandidateSequence insertCandidateAtPosition(@NonNull CandidateSequence candidate,
		@NonNull SequenceLocation location) {

	//No need for synchronization since we should not be
	//concurrently inserting two candidates at the same position
	THashSet<CandidateSequence> candidates = candidateSequences.computeIfAbsent(location, k -> new THashSet<>(2, 0.2f));
	CandidateSequence candidateMapValue = candidates.get(candidate);
	if (candidateMapValue == null) {
		boolean added = candidates.add(candidate);
		Assert.isTrue(added);
	} else {
		candidateMapValue.mergeWith(candidate);
		candidate = candidateMapValue;
	}
	return candidate;
}
 
开发者ID:cinquin,项目名称:mutinack,代码行数:25,代码来源:SubAnalyzer.java

示例6: loadTSet

import gnu.trove.set.hash.THashSet; //导入方法依赖的package包/类
/**
 * 每行为一个或多个元素
 * @param path
 * @param b true,每行为一个元素;false: 每行为多个元素
 * @return
 * @throws IOException
 */
public static THashSet<String> loadTSet(String path,boolean b) throws IOException{

	THashSet<String> dict = new THashSet<String>();
	BufferedReader bfr;
	try {
		bfr = new BufferedReader(new InputStreamReader(new FileInputStream(path),"utf8"));
	} catch (FileNotFoundException e) {
		System.out.print("没找到文件:"+path);
		return dict;
	}
	String line = null;		
	while ((line = bfr.readLine()) != null) {
		if(line.length()==0)
			continue;
		if(b)
			dict.add(line);
		else{
			String[] toks = line.split("\\s+");
			for(String tok:toks)
				dict.add(tok);
		}
	}
	bfr.close();
	return dict;
}
 
开发者ID:FudanNLP,项目名称:fnlp,代码行数:33,代码来源:MyCollection.java

示例7: provideDefaultRanks

import gnu.trove.set.hash.THashSet; //导入方法依赖的package包/类
@Provides
@Singleton
@Named("predefined-ranks")
public Set<Rank> provideDefaultRanks(RankFactory rankFactory) {
    THashSet<Rank> ranks = new THashSet<Rank>();

    List<? extends Config> objectList = config.getConfigList("ranks.predefined");

    for (Config object : objectList) {
        String name = object.getString("name");
        int priority = object.getInt("priority");
        List<String> rules = object.getStringList("rules");

        Rank rank = rankFactory.createStatic(name, priority, rules);

        ranks.add(rank);
    }

    return Collections.unmodifiableSet(ranks);
}
 
开发者ID:mc-societies,项目名称:societies,代码行数:21,代码来源:RuleModule.java

示例8: getUncheckedMaximalSubsets

import gnu.trove.set.hash.THashSet; //导入方法依赖的package包/类
public THashSet<ColumnCollection> getUncheckedMaximalSubsets(ColumnCollection lhs, ColumnOrder order) {
		THashSet<ColumnCollection> uncheckedMaximalSubsets = new THashSet<>();
		
//		if (lhs.cardinality() > 2) {
			for (Integer columnIndex : order.getOrderHighDistinctCount(lhs)) { 
				ColumnCollection subsetIndices = lhs.removeColumnCopy(columnIndex);
				if (!this.containsKey(subsetIndices)) {
					uncheckedMaximalSubsets.add(subsetIndices);
				}
			}
//		}
		return uncheckedMaximalSubsets;
	}
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:14,代码来源:Observations.java

示例9: getUncheckedOrCandidateMaximalSubsets

import gnu.trove.set.hash.THashSet; //导入方法依赖的package包/类
public THashSet<ColumnCollection> getUncheckedOrCandidateMaximalSubsets(ColumnCollection lhs, ColumnOrder order) {
	THashSet<ColumnCollection> uncheckedMaximalSubsets = new THashSet<>();
	
	// we only want to check subsets with at least 2 columns
	if (lhs.cardinality() > 2) {
		for (Integer columnIndex : order.getOrderHighDistinctCount(lhs)) { 
			ColumnCollection subsetIndices = lhs.removeColumnCopy(columnIndex);
			if (!this.containsKey(subsetIndices) || this.get(subsetIndices) == Observation.CANDIDATE_MINIMAL_DEPENDENCY) {
				uncheckedMaximalSubsets.add(subsetIndices);
			}
		}
	}
	return uncheckedMaximalSubsets;
}
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:15,代码来源:Observations.java

示例10: getMaximalSubsets

import gnu.trove.set.hash.THashSet; //导入方法依赖的package包/类
public THashSet<ColumnCollection> getMaximalSubsets(ColumnCollection lhs, ColumnOrder order) {
	THashSet<ColumnCollection> uncheckedMaximalSubsets = new THashSet<>();
	
	// we only want to check subsets with at least 2 columns
	if (lhs.cardinality() > 2) {
		for (Integer columnIndex : order.getOrderHighDistinctCount(lhs)) { 
			ColumnCollection subsetIndices = lhs.removeColumnCopy(columnIndex);
			uncheckedMaximalSubsets.add(subsetIndices);
		}
	}
	return uncheckedMaximalSubsets;
}
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:13,代码来源:Observations.java

示例11: getUncheckedOrCandidateMinimalSupersets

import gnu.trove.set.hash.THashSet; //导入方法依赖的package包/类
public THashSet<ColumnCollection> getUncheckedOrCandidateMinimalSupersets(ColumnCollection lhs, int rhsIndex, ColumnOrder order) {
	THashSet<ColumnCollection> uncheckedMinimalSupersets = new THashSet<>();
	
	for (Integer columnIndex : order.getOrderLowDistinctCount(lhs.setCopy(rhsIndex).complement())) {
		ColumnCollection supersetIndices = lhs.setCopy(columnIndex);
		if (!this.containsKey(supersetIndices) || this.get(supersetIndices) == Observation.CANDIDATE_MAXIMAL_NON_DEPENDENCY) {
			uncheckedMinimalSupersets.add(supersetIndices);
		}
	}
	return uncheckedMinimalSupersets;
}
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:12,代码来源:Observations.java

示例12: getUncheckedMinimalSupersets

import gnu.trove.set.hash.THashSet; //导入方法依赖的package包/类
public THashSet<ColumnCollection> getUncheckedMinimalSupersets(ColumnCollection lhs, int rhsIndex, ColumnOrder order) {
	THashSet<ColumnCollection> uncheckedMinimalSupersets = new THashSet<>();
	
	for (Integer columnIndex : order.getOrderLowDistinctCount(lhs.setCopy(rhsIndex).complement())) {
		ColumnCollection supersetIndices = lhs.setCopy(columnIndex);
		if (!this.containsKey(supersetIndices)) {
			uncheckedMinimalSupersets.add(supersetIndices);
		}
	}
	return uncheckedMinimalSupersets;
}
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:12,代码来源:Observations.java

示例13: getMinimalSupersets

import gnu.trove.set.hash.THashSet; //导入方法依赖的package包/类
public THashSet<ColumnCollection> getMinimalSupersets(ColumnCollection lhs, int rhsIndex, ColumnOrder order) {
	THashSet<ColumnCollection> uncheckedMinimalSupersets = new THashSet<>();

	for (Integer columnIndex : order.getOrderLowDistinctCount(lhs.setCopy(rhsIndex).complement())) {
		ColumnCollection supersetIndices = lhs.setCopy(columnIndex);
		uncheckedMinimalSupersets.add(supersetIndices);
	}
	return uncheckedMinimalSupersets;
}
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:10,代码来源:Observations.java

示例14: getPrunedSubsets

import gnu.trove.set.hash.THashSet; //导入方法依赖的package包/类
public THashSet<ColumnCollection> getPrunedSubsets(THashSet<ColumnCollection> subsets) {
	THashSet<ColumnCollection> prunedSubsets = new THashSet<>();
	for (ColumnCollection subset : subsets) {
		if (this.isRepresented(subset)) {
			prunedSubsets.add(subset);
		}
	}
	return prunedSubsets;
}
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:10,代码来源:Dependencies.java

示例15: getPrunedSupersets

import gnu.trove.set.hash.THashSet; //导入方法依赖的package包/类
public THashSet<ColumnCollection> getPrunedSupersets(THashSet<ColumnCollection> supersets) {
	THashSet<ColumnCollection> prunedSupersets = new THashSet<>();
	for (ColumnCollection superset : supersets) {
		if (this.isRepresented(superset)) {
			prunedSupersets.add(superset);
		}
	}
	return prunedSupersets;
}
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:10,代码来源:NonDependencies.java


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