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


Java TIntIntIterator.hasNext方法代码示例

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


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

示例1: cleanup

import gnu.trove.iterator.TIntIntIterator; //导入方法依赖的package包/类
@Override
protected void cleanup(final Context context) throws IOException, InterruptedException {
	final IntWritable keyW = new IntWritable();
	final IntWritable valueW = new IntWritable();
	
	TIntIntIterator it = this.combiner.iterator();
	
	while(it.hasNext()) {
		it.advance();
		keyW.set(it.key());
		valueW.set(it.value());
		context.write(keyW, valueW);
	}
	
	this.combiner = null;
}
 
开发者ID:slide-lig,项目名称:TopPI,代码行数:17,代码来源:ItemBigCountingMapper.java

示例2: dispose

import gnu.trove.iterator.TIntIntIterator; //导入方法依赖的package包/类
public void dispose() {
    logger.debug("Disposing shader {}.", title);

    TIntIntIterator it = shaderPrograms.iterator();
    while (it.hasNext()) {
        it.advance();
        GL20.glDeleteProgram(it.value());
    }
    shaderPrograms.clear();

    it = fragmentPrograms.iterator();
    while (it.hasNext()) {
        it.advance();
        GL20.glDeleteShader(it.value());
    }
    fragmentPrograms.clear();

    it = vertexPrograms.iterator();
    while (it.hasNext()) {
        it.advance();
        GL20.glDeleteShader(it.value());
    }
    vertexPrograms.clear();
}
 
开发者ID:zoneXcoding,项目名称:Mineworld,代码行数:25,代码来源:ShaderProgram.java

示例3: insertUnclosedPatterns

import gnu.trove.iterator.TIntIntIterator; //导入方法依赖的package包/类
final public int insertUnclosedPatterns(PerItemTopKCollector topKcoll, boolean outputPatternsForFutureExtensions) {
	int[] topKDistinctSupports = new int[topKcoll.getK()];
	int[] topKCorrespondingItems = new int[topKcoll.getK()];
	boolean highestUnique = false;
	// split between extension candidates and others ?
	// set a max because some items will never be able to raise their
	// threshold anyway?
	TIntIntIterator supportIterator = this.supportCounts.iterator();
	while (supportIterator.hasNext()) {
		supportIterator.advance();
		if (outputPatternsForFutureExtensions && supportIterator.key() < this.maxCandidate) {
			topKcoll.collectUnclosedForItem(supportIterator.value(), this.pattern,
					this.reverseRenaming[supportIterator.value()]);
		} else {
			highestUnique = updateTopK(topKDistinctSupports, topKCorrespondingItems, supportIterator.key(),
					supportIterator.value(), highestUnique);
		}
	}
	boolean highest = true;
	int lastInsertSupport = this.minSupport;
	for (int i = topKDistinctSupports.length - 1; i >= 0; i--) {
		if (topKDistinctSupports[i] == 0) {
			// AKA I didn't find k distinct supports
			lastInsertSupport = -1;
			break;
		} else {
			int[] newPattern = Arrays.copyOf(this.pattern, this.pattern.length + 1);
			newPattern[pattern.length] = this.reverseRenaming[topKCorrespondingItems[i]];
			topKcoll.collect(topKDistinctSupports[i], newPattern, highest && highestUnique);
			lastInsertSupport = topKDistinctSupports[i];
		}
		highest = false;
	}
	return lastInsertSupport;
}
 
开发者ID:slide-lig,项目名称:TopPI,代码行数:36,代码来源:SparseCounters.java

示例4: MapTidList

import gnu.trove.iterator.TIntIntIterator; //导入方法依赖的package包/类
public MapTidList(final TIntIntMap lengths) {
	TIntIntIterator iter = lengths.iterator();
	while (iter.hasNext()) {
		iter.advance();
		this.occurrences.put(iter.key(), new TIntArrayList(iter.value()));
	}
}
 
开发者ID:slide-lig,项目名称:TopPI,代码行数:8,代码来源:MapTidList.java

示例5: cleanup

import gnu.trove.iterator.TIntIntIterator; //导入方法依赖的package包/类
@Override
protected void cleanup(final Context context) throws IOException, InterruptedException {
	final NullWritable nullKey = NullWritable.get();
	final ItemAndSupportWritable valueW = new ItemAndSupportWritable();
	
	TIntIntIterator it = this.combiner.iterator();
	
	while(it.hasNext()) {
		it.advance();
		valueW.set(it.key(), it.value());
		context.write(nullKey, valueW);
	}
	
	this.combiner = null;
}
 
开发者ID:slide-lig,项目名称:TopPI,代码行数:16,代码来源:ItemCountingMapper.java

示例6: preloadBounds

import gnu.trove.iterator.TIntIntIterator; //导入方法依赖的package包/类
public void preloadBounds(TIntIntMap perItemBounds) {
	TIntIntIterator iterator = perItemBounds.iterator();
	int[] fakePattern = new int[] { };
	while (iterator.hasNext()) {
		iterator.advance();
		
		final int item = iterator.key();
		PatternWithFreq[] top = this.topK.get(item);
		
		if (top != null) {
			Arrays.fill(top, new PatternWithFreq(iterator.value(), fakePattern, true));
		}
	}
}
 
开发者ID:slide-lig,项目名称:TopPI,代码行数:15,代码来源:PerItemTopKHadoopCollector.java

示例7: cleanup

import gnu.trove.iterator.TIntIntIterator; //导入方法依赖的package包/类
@Override
protected void cleanup(Context context) throws java.io.IOException, InterruptedException {
	final Configuration conf = context.getConfiguration();
	final int minSupport = conf.getInt(TopPIoverHadoop.KEY_MINSUP, 10);
	
	final IntWritable keyW = new IntWritable();
	final IntWritable valueW = new IntWritable();
	final TreeSet<ItemAndBigSupport> heap = new TreeSet<ItemAndBigSupport>();
	
	TIntIntIterator it = this.itemSupports.iterator();
	while(it.hasNext()) {
		it.advance();
		final int support = it.value();
		if (support >= minSupport) {
			heap.add(new ItemAndBigSupport(it.key(), support));
		}
	}
	
	this.itemSupports = null;
	int rebased = 0;
	
	for (ItemAndBigSupport entry : heap) {
		keyW.set(entry.item);
		valueW.set(rebased++);
		context.write(keyW, valueW);
	}
	
	rebased -= 1;
	
	context.getCounter(COUNTERS_GROUP, COUNTER_REBASING_MAX_ID).setValue(rebased);
}
 
开发者ID:slide-lig,项目名称:TopPI,代码行数:32,代码来源:ItemCountingReducer.java

示例8: testInt_TPrimitiveHashMap

import gnu.trove.iterator.TIntIntIterator; //导入方法依赖的package包/类
@Override
public void testInt_TPrimitiveHashMap() {
	int total = 0;

	for( int i = 0; i < ITERATIONS_INT; i++ ) {
		TIntIntIterator iterator = int_t_primitive_map.iterator();
		while( iterator.hasNext() ) {
			iterator.advance();
			total += iterator.key();
		}
	}

	int_slot.set( total );
}
 
开发者ID:leventov,项目名称:trove-over-koloboke-compile,代码行数:15,代码来源:IterationBenchmark.java

示例9: countFrequency

import gnu.trove.iterator.TIntIntIterator; //导入方法依赖的package包/类
/**
 * 
 * @param freqmap
 * @return
 */
public static TreeMap<Integer, Integer> countFrequency(TIntIntHashMap freqmap) {
	TreeMap<Integer, Integer> map = new TreeMap<Integer,Integer>();
	TIntIntIterator it = freqmap.iterator();
	while(it.hasNext()){
		it.advance();
		int freq = it.value();
		if(map.containsKey(freq)){
			map.put(freq, map.get(freq)+1);
		}else
			map.put(freq, 1);
	}
	return map;		
}
 
开发者ID:FudanNLP,项目名称:fnlp,代码行数:19,代码来源:MyArrays.java

示例10: compressSortRenaming

import gnu.trove.iterator.TIntIntIterator; //导入方法依赖的package包/类
/**
 * Will compress an older renaming, by removing infrequent items. Contained
 * arrays (except closure) will refer new item IDs
 * 
 * @param olderReverseRenaming
 *            reverseRenaming from the dataset that fed this Counter
 * @param items
 *            below this parameter will be renamed by decreasing frequency
 * @return the translation from the old renaming to the compressed one
 *         (gives -1 for removed items)
 */
public int[] compressSortRenaming(int[] olderReverseRenaming) {
	if (olderReverseRenaming == null) {
		olderReverseRenaming = this.reverseRenaming;
	}
	this.rebasedDistinctTransactionsCounts = new int[this.nbFrequents];
	this.rebasedSupportCounts = new int[this.nbFrequents];
	this.reverseRenaming = new int[this.nbFrequents];
	// first, compact
	// we will always have newItemID <= item
	int newItemIDBelowCandidate = 0;
	int newItemIDAboveCandidate = this.nbFrequents - 1;
	TIntIntIterator supportIterator = this.supportCounts.iterator();
	// after this loop we have
	// reverseRenaming: NewBase (index) -> PreviousDatasetBase (value)
	// supportCounts: NewBase (index) -> Support (value)
	// distinctTransactionCount: NewBase (index) -> Count (value)
	while (supportIterator.hasNext()) {
		supportIterator.advance();
		if (supportIterator.key() < this.maxCandidate) {
			this.reverseRenaming[newItemIDBelowCandidate] = supportIterator.key();
			this.rebasedSupportCounts[newItemIDBelowCandidate] = supportIterator.value();
			this.rebasedDistinctTransactionsCounts[newItemIDBelowCandidate] = this.distinctTransactionsCounts
					.get(supportIterator.key());
			newItemIDBelowCandidate++;
		} else {
			this.reverseRenaming[newItemIDAboveCandidate] = supportIterator.key();
			this.rebasedSupportCounts[newItemIDAboveCandidate] = supportIterator.value();
			this.rebasedDistinctTransactionsCounts[newItemIDAboveCandidate] = this.distinctTransactionsCounts
					.get(supportIterator.key());
			newItemIDAboveCandidate--;
		}
	}
	this.supportCounts = null;
	this.distinctTransactionsCounts = null;
	this.maxCandidate = newItemIDBelowCandidate;
	this.maxFrequent = this.nbFrequents - 1;

	// now, sort up to the pivot
	this.quickSortOnSup(0, this.maxCandidate);

	int[] renaming = new int[Math.max(olderReverseRenaming.length, this.rebasingSize)];
	Arrays.fill(renaming, -1);

	// after this loop we have
	// reverseRenaming: NewBase (index) -> OriginalBase (value)
	// renaming: PreviousDatasetBase (index) -> NewBase (value)

	for (int i = 0; i <= this.maxFrequent; i++) {
		renaming[this.reverseRenaming[i]] = i;
		this.reverseRenaming[i] = olderReverseRenaming[this.reverseRenaming[i]];
	}

	this.compactedArrays = true;
	return renaming;
}
 
开发者ID:slide-lig,项目名称:TopPI,代码行数:67,代码来源:SparseCounters.java

示例11: start

import gnu.trove.iterator.TIntIntIterator; //导入方法依赖的package包/类
/**
 * start path extraction considering all the pairs main_item-items
 */
private void start(){
	
	TIntIntHashMap paths = null;
	String item_pair_paths = "";
	
	for(int j = 0; j < items.size(); j++){
		
		ItemTree b = items.get(j);
		int b_id = b.getItemId();
		
		paths = computePaths(main_item, b);
			
		if(paths.size() > 0){
				
			item_pair_paths = main_item_id + "-" + b_id + "\t";
			TIntIntIterator it = paths.iterator();
			while(it.hasNext()){
				it.advance();
				item_pair_paths += it.key() + "=" + it.value() + ",";
			}
			item_pair_paths = item_pair_paths.substring(0, item_pair_paths.length()-1);
				
			// text file writing
			if(textWriter != null)
				textWriter.write(item_pair_paths);
			
			// binary file writing
			if(pathWriter != null)
				pathWriter.write(item_pair_paths);
				
			if(computeInversePaths){
				
				item_pair_paths = b_id + "-" + main_item_id + "\t";
				it = paths.iterator();
				while(it.hasNext()){
					it.advance();
					item_pair_paths += reverse(it.key()) + "=" + it.value() + ",";
				}
				
				item_pair_paths = item_pair_paths.substring(0, item_pair_paths.length()-1);
				
				// text file writing
				if(textWriter != null)
					textWriter.write(item_pair_paths);
					
				// binary file writing
				if(pathWriter != null){
					pathWriter.write(item_pair_paths);
				}
			}
			
		}
		
	}
	 
}
 
开发者ID:sisinflab,项目名称:lodreclib,代码行数:60,代码来源:ItemPathExtractorWorker.java


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