本文整理汇总了Java中gnu.trove.iterator.TIntObjectIterator.setValue方法的典型用法代码示例。如果您正苦于以下问题:Java TIntObjectIterator.setValue方法的具体用法?Java TIntObjectIterator.setValue怎么用?Java TIntObjectIterator.setValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gnu.trove.iterator.TIntObjectIterator
的用法示例。
在下文中一共展示了TIntObjectIterator.setValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}
示例2: 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 ) );
}