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


Java TIntObjectIterator.key方法代码示例

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


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

示例1: print

import gnu.trove.iterator.TIntObjectIterator; //导入方法依赖的package包/类
@Override
public void print(PrintStream os, Module m)
{
    os.println("**************** Intervals ******************");
    TIntObjectIterator<LiveInterval> itr = slot2LI.iterator();
    while (itr.hasNext())
    {
        int slot = itr.key();
        LiveInterval interval = itr.value();
        interval.print(os, null);
        TargetRegisterClass rc = getIntervalRegClass(slot);
        if (rc != null)
        {
            os.printf("[%s]\n", rc.getName());
        }
        else
        {
            os.println("[unknown]");
        }
    }
}
 
开发者ID:JianpingZeng,项目名称:xcc,代码行数:22,代码来源:LiveStackSlot.java

示例2: collectItemStats

import gnu.trove.iterator.TIntObjectIterator; //导入方法依赖的package包/类
/**
 * @see infoMode
 */
private void collectItemStats() {
	TIntObjectIterator<PatternWithFreq[]> iterator = this.topK.iterator();

	while (iterator.hasNext()) {
		iterator.advance();

		int item = iterator.key();
		PatternWithFreq[] itemTopK = iterator.value();

		int nbPatterns = 0;
		int supportSum = 0;
		while (nbPatterns < this.k && itemTopK[nbPatterns] != null) {
			supportSum += itemTopK[nbPatterns].getSupportCount();
			nbPatterns++;
		}

		int lowestSupport = itemTopK[nbPatterns - 1].getSupportCount();

		if (itemTopK[0] != null) {
			this.decorated.collect(itemTopK[0].getSupportCount(), new int[] { item, nbPatterns, supportSum,
					lowestSupport });
		}
	}
}
 
开发者ID:slide-lig,项目名称:TopPI,代码行数:28,代码来源:PerItemTopKCollector.java

示例3: writeSimnilarity

import gnu.trove.iterator.TIntObjectIterator; //导入方法依赖的package包/类
protected void writeSimnilarity(int element1Id, double element1Score, TIntObjectIterator<ElementSimilarityScoring> it, boolean bR2L) throws SerializationException, IOException, NoScoreFoundException {
	TIntDoubleMap elementsScores = new TIntDoubleHashMap();
	while (it.hasNext()) {
		it.advance();
		int element2Id = it.key();
		if (elementFilter == null || elementFilter.isRelevantElementForCalculation(element2Id)) {
			double element2Score = elementFeatureScoreStorage.getElementScore(element2Id);
			ElementSimilarityScoring similarityScoring = it.value();
			double similarityScore = bR2L ?
						similarityScoring.getSimilarityScore(element2Score, element1Score) :
						similarityScoring.getSimilarityScore(element1Score, element2Score);
			if (similarityScore > 0)
				elementsScores.put(element2Id, similarityScore);
		}
	}
	
	LinkedHashMap<Integer, Double> sortedElementScores = SortUtil.sortMapByValue(elementsScores,true);
	
	if (vectorTruncater != null) 
		sortedElementScores = vectorTruncater.truncate(sortedElementScores);
		
	if (bR2L)
		outR2LDevice.write(element1Id, sortedElementScores);
	else
		outL2RDevice.write(element1Id, sortedElementScores);
}
 
开发者ID:hltfbk,项目名称:Excitement-TDMLEDA,代码行数:27,代码来源:GeneralElementSimilarityCalculator.java

示例4: iteratorEntities

import gnu.trove.iterator.TIntObjectIterator; //导入方法依赖的package包/类
public Iterable<EntityRef> iteratorEntities(Class<? extends Component>... componentClasses) {
    if (componentClasses.length == 0) {
        return iteratorEntities();
    }
    TIntList idList = new TIntArrayList();
    TIntObjectIterator<? extends Component> primeIterator = store.componentIterator(componentClasses[0]);
    if (primeIterator == null) {
        return NullIterator.newInstance();
    }

    while (primeIterator.hasNext()) {
        primeIterator.advance();
        int id = primeIterator.key();
        boolean discard = false;
        for (int i = 1; i < componentClasses.length; ++i) {
            if (store.get(id, componentClasses[i]) == null) {
                discard = true;
                break;
            }
        }
        if (!discard) {
            idList.add(primeIterator.key());
        }
    }
    return new EntityIterable(idList);
}
 
开发者ID:zoneXcoding,项目名称:Mineworld,代码行数:27,代码来源:PojoEntityManager.java

示例5: iterate

import gnu.trove.iterator.TIntObjectIterator; //导入方法依赖的package包/类
void iterate(CellFunction fn) {
	TIntObjectIterator<TIntObjectHashMap<ExchangeCell>> rowIterator = cells
			.iterator();
	while (rowIterator.hasNext()) {
		rowIterator.advance();
		int row = rowIterator.key();
		TIntObjectHashMap<ExchangeCell> rowMap = rowIterator.value();
		if (rowMap == null)
			continue;
		TIntObjectIterator<ExchangeCell> colIterator = rowMap.iterator();
		while (colIterator.hasNext()) {
			colIterator.advance();
			int col = colIterator.key();
			ExchangeCell cell = colIterator.value();
			if (cell == null)
				continue;
			fn.apply(row, col, cell);
		}
	}
}
 
开发者ID:GreenDelta,项目名称:olca-modules,代码行数:21,代码来源:ExchangeMatrix.java

示例6: equals

import gnu.trove.iterator.TIntObjectIterator; //导入方法依赖的package包/类
/** {@inheritDoc} */
public boolean equals( Object other ) {
    if ( ! ( other instanceof TIntObjectMap ) ) {
        return false;
    }
    TIntObjectMap that = ( TIntObjectMap ) other;
    if ( that.size() != this.size() ) {
        return false;
    }
    try {
        TIntObjectIterator iter = this.iterator();
        while ( iter.hasNext() ) {
            iter.advance();
            int key = iter.key();
            Object value = iter.value();
            if ( value == null ) {
                if ( !( that.get( key ) == null && that.containsKey( key ) ) ) {
                    return false;
                }
            } else {
                if ( !value.equals( that.get( key ) ) ) {
                    return false;
                }
            }
        }
    } catch ( ClassCastException ex ) {
        // unused.
    }
    return true;
}
 
开发者ID:JianpingZeng,项目名称:xcc,代码行数:31,代码来源:TIntObjectHashMap.java

示例7: updatePredecessors

import gnu.trove.iterator.TIntObjectIterator; //导入方法依赖的package包/类
protected void updatePredecessors() {
	
	TIntObjectIterator<BitSet> iterator = nodeToSplit.getValue().predecessors.iterator();
	Node<ValueNode> parent = nodeToSplit.getParent();
	BitSet letterToDeleted = new BitSet();
	while(iterator.hasNext()) {
		iterator.advance();
		int letter = iterator.key();
		BitSet statePrevs = iterator.value();
		BitSet stateLeft = (BitSet) statePrevs.clone();
		for(int stateNr = statePrevs.nextSetBit(0)
				; stateNr >= 0
				; stateNr = statePrevs.nextSetBit(stateNr + 1)) {
			ValueNode statePrev = states.get(stateNr);
			Node<ValueNode> nodeOther = sift(statePrev.label.append(letter), parent);
			if (nodeOther != nodeToSplit) {
				updateTransition(stateNr, letter, nodeOther.getValue().id);
				stateLeft.clear(stateNr);
			}
		}
		if(stateLeft.isEmpty()) {
			letterToDeleted.set(letter);
		}else {
			iterator.setValue(stateLeft);
		}
	}
	
	for(int letter = letterToDeleted.nextSetBit(0)
			; letter >= 0
			; letter = letterToDeleted.nextSetBit(letter + 1)) {
		nodeToSplit.getValue().predecessors.remove(letter);
	}
	
}
 
开发者ID:duckly,项目名称:LearnMealyMachine,代码行数:35,代码来源:LearnerTree.java

示例8: equals

import gnu.trove.iterator.TIntObjectIterator; //导入方法依赖的package包/类
public boolean equals( Object other ) {
    if ( ! ( other instanceof TIntObjectMap ) ) {
        return false;
    }
    TIntObjectMap that = ( TIntObjectMap ) other;
    if ( that.size() != this.size() ) {
        return false;
    }
    try {
        TIntObjectIterator iter = this.iterator();
        while ( iter.hasNext() ) {
            iter.advance();
            int key = iter.key();
            Object value = iter.value();
            if ( value == null ) {
                if ( !( that.get( key ) == null && that.containsKey( key ) ) ) {
                    return false;
                }
            } else {
                if ( !value.equals( that.get( key ) ) ) {
                    return false;
                }
            }
        }
    } catch ( ClassCastException ex ) {
        // unused.
    }
    return true;
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:30,代码来源:TIntObjectHashMap.java

示例9: equals

import gnu.trove.iterator.TIntObjectIterator; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
@SuppressWarnings("rawtypes")
public boolean equals( Object other ) {
    if ( ! ( other instanceof TIntObjectMap ) ) {
        return false;
    }
    TIntObjectMap that = ( TIntObjectMap ) other;
    if ( that.size() != this.size() ) {
        return false;
    }
    try {
        TIntObjectIterator iter = this.iterator();
        while ( iter.hasNext() ) {
            iter.advance();
            int key = iter.key();
            Object value = iter.value();
            if ( value == null ) {
                if ( !( that.get( key ) == null && that.containsKey( key ) ) ) {
                    return false;
                }
            } else {
                if ( !value.equals( that.get( key ) ) ) {
                    return false;
                }
            }
        }
    } catch ( ClassCastException ex ) {
        // unused.
    }
    return true;
}
 
开发者ID:palantir,项目名称:trove-3.0.3,代码行数:33,代码来源:TIntObjectHashMap.java

示例10: cleanup

import gnu.trove.iterator.TIntObjectIterator; //导入方法依赖的package包/类
@Override
protected void cleanup(Context context) throws IOException, InterruptedException {
	final IntWritable keyW = new IntWritable();
	
	ProgressWatcherThread pokeMaster = new ProgressWatcherThread();
	pokeMaster.setHadoopContext(context);
	pokeMaster.start();
	
	getGlobalSupports(getDatasetPath(context));
	
	TIntObjectIterator<TreeMatcher> iterator = this.perItempatterns.iterator();
	while(iterator.hasNext()) {
		iterator.advance();
		int keyItem = iterator.key();
		keyW.set(keyItem);
		TreeMatcher found = iterator.value();
		
		PatternsHeap heap = new PatternsHeap(this.k, this.itemSupports.get(keyItem));
		Iterator<ItemsetSupports> patterns = found.iterator();
		while (patterns.hasNext()) {
			ItemsetSupports pattern = patterns.next();
			int[] itemset = pattern.getItemset();
			try {
				int itemsetSupport = this.searchedPatterns.getSupport(itemset);
				heap.insert(itemset, itemsetSupport, pattern.getSupport());
			} catch (NotMonitoredException e) {
				e.printStackTrace();
			}
		}
		
		Iterator<SupportAndTransactionWritable> writables = heap.getWritables();
		while (writables.hasNext()) {
			context.write(keyW, writables.next());
		}
	}
	
	pokeMaster.interrupt();
}
 
开发者ID:slide-lig,项目名称:TopPI,代码行数:39,代码来源:AggregationByCorrelationReducer.java

示例11: getRowIdsToPush

import gnu.trove.iterator.TIntObjectIterator; //导入方法依赖的package包/类
public TIntSet getRowIdsToPush(int clientId) {
    TIntSet rowIds = new TIntHashSet();
    TIntObjectIterator<ServerRow> iter = storage.iterator();
    while (iter.hasNext()) {
        iter.advance();
        int rowId = iter.key();
        ServerRow serverRow = iter.value();
        if (serverRow.isSubscribed(clientId) && serverRow.isDirty()) {
            rowIds.add(rowId);
        }
    }
    return rowIds;
}
 
开发者ID:sailing-pmls,项目名称:jbosen,代码行数:14,代码来源:ServerTable.java

示例12: writeData

import gnu.trove.iterator.TIntObjectIterator; //导入方法依赖的package包/类
public static void writeData(String file, TIntObjectHashMap<TIntObjectHashMap<TIntIntHashMap>> path){
	
	BufferedWriter writer;
	try {
		
		writer = new BufferedWriter(new FileWriter(file));

		TIntObjectIterator<TIntObjectHashMap<TIntIntHashMap>> it = path.iterator();
		while(it.hasNext()){
			it.advance();
			int a = it.key();
			TIntObjectHashMap<TIntIntHashMap> tmp = it.value();
			
			if(tmp!=null){
				TIntObjectIterator<TIntIntHashMap> it1 = tmp.iterator();
				while(it1.hasNext()){
					it1.advance();
					int b = it1.key();
					writer.append(a + "-" + b + ": " + it1.value());
					writer.newLine();
				}
			}
		}

		writer.flush();
		writer.close();

	} 
	catch (Exception e){
		e.printStackTrace();
	}
	
}
 
开发者ID:sisinflab,项目名称:lodreclib,代码行数:34,代码来源:TextFileUtils.java

示例13: toMCString

import gnu.trove.iterator.TIntObjectIterator; //导入方法依赖的package包/类
public String toMCString() {
    StringBuilder out = new StringBuilder();
    out.append(METADATA_PREFIX);
    TIntObjectIterator<Object> it = iterator();
    while (it.hasNext()) {
        it.advance();
        int key = it.key();
        Object value = it.value();
        int index = key & 0x1F;
        if (value instanceof Byte) {
            index |= 0 << 5;
            writeByte(out, index);
            writeByte(out, ((Byte) value).intValue());
        } else if (value instanceof Short) {
            index |= 1 << 5;
            writeByte(out, index);
            writeShort(out, ((Short) value).intValue());
        } else if (value instanceof Integer) {
            index |= 2 << 5;
            writeByte(out, index);
            writeInt(out, ((Integer) value).intValue());
        } else if (value instanceof Float) {
            index |= 3 << 5;
            writeByte(out, index);
            writeInt(out, Float.floatToIntBits((Float) value));
        } else if (value instanceof String) {
            index |= 4 << 5;
            writeByte(out, index);
            writeString(out, (String) value);
        }
    }
    int size = out.length() - METADATA_PREFIX.length();
    insertShort(out, METADATA_PREFIX.length(), size);
    return out.toString();
}
 
开发者ID:Thinkofname,项目名称:RPG-Items,代码行数:36,代码来源:RPGMetadata.java

示例14: getNbFreeChunks

import gnu.trove.iterator.TIntObjectIterator; //导入方法依赖的package包/类
private int getNbFreeChunks() {
    int res = 0;

    TIntObjectIterator<TLongList> it = freePosSizeMap.iterator();
    while (it.hasNext()) {
        it.advance();
        res += it.key() * it.value().size();
    }

    return res;
}
 
开发者ID:bgranvea,项目名称:offheapstore-benchmark,代码行数:12,代码来源:ChronicleStore.java

示例15: testIterator

import gnu.trove.iterator.TIntObjectIterator; //导入方法依赖的package包/类
public void testIterator() {
    TIntObjectHashMap<String> map = new TIntObjectHashMap<String>();

    TIntObjectIterator<String> iterator = map.iterator();
    assertFalse( iterator.hasNext() );

    map.put( 1, "one" );
    map.put( 2, "two" );

    iterator = map.iterator();
    assertTrue( iterator.hasNext() );
    iterator.advance();

    int first_key = iterator.key();
    assertNotNull( "key was null", first_key );
    assertTrue( "invalid key: " + first_key, first_key == 1 || first_key == 2 );
    if ( first_key == 1 ) {
        assertEquals( "one", iterator.value() );
    } else {
        assertEquals( "two", iterator.value() );
    }

    assertTrue( iterator.hasNext() );
    iterator.advance();
    int second_key = iterator.key();
    assertNotNull( "key was null", second_key );
    assertTrue( "invalid key: " + second_key, second_key == 1 || second_key == 2 );
    if ( second_key == 1 ) {
        assertEquals( "one", iterator.value() );
    } else {
        assertEquals( "two", iterator.value() );
    }
    assertFalse( first_key + ", " + second_key, first_key == second_key );

    assertFalse( iterator.hasNext() );

    // New Iterator
    iterator = map.iterator();
    iterator.advance();
    first_key = iterator.key();
    iterator.setValue( "1138" );
    assertEquals( "1138", iterator.value() );
    assertEquals( "1138", map.get( first_key ) );
}
 
开发者ID:palantir,项目名称:trove-3.0.3,代码行数:45,代码来源:TPrimitiveObjectHashMapTest.java


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