本文整理汇总了Java中gnu.trove.iterator.TIntObjectIterator.hasNext方法的典型用法代码示例。如果您正苦于以下问题:Java TIntObjectIterator.hasNext方法的具体用法?Java TIntObjectIterator.hasNext怎么用?Java TIntObjectIterator.hasNext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gnu.trove.iterator.TIntObjectIterator
的用法示例。
在下文中一共展示了TIntObjectIterator.hasNext方法的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]");
}
}
}
示例2: testIteratorRemoval2
import gnu.trove.iterator.TIntObjectIterator; //导入方法依赖的package包/类
public void testIteratorRemoval2() {
int element_count = 10000;
int remaining = element_count / 2;
TIntObjectHashMap<String> map =
new TIntObjectHashMap<String>( element_count, 0.5f, Integer.MIN_VALUE );
for ( int pass = 0; pass < 10; pass++ ) {
Random r = new Random();
for ( int i = 0; i <= element_count; i++ ) {
map.put( Integer.valueOf( r.nextInt() ), String.valueOf( i ) );
}
TIntObjectIterator iterator = map.iterator();
while ( map.size() > remaining && iterator.hasNext() ) {
iterator.advance();
iterator.remove();
}
}
}
示例3: process
import gnu.trove.iterator.TIntObjectIterator; //导入方法依赖的package包/类
@Override
public void process(@Nonnull final EntityPlayer player) {
if (this.messages.size() == 0)
return;
// Go through the cached messages and get rid of those
// that expire.
final int currentTick = EnvironState.getTickCounter();
final TIntObjectIterator<EntityBubbleContext> entityData = this.messages.iterator();
while (entityData.hasNext()) {
entityData.advance();
final EntityBubbleContext ctx = entityData.value();
if (ctx.clean(currentTick))
entityData.remove();
}
}
示例4: writeTopKBounds
import gnu.trove.iterator.TIntObjectIterator; //导入方法依赖的package包/类
public void writeTopKBounds(MultipleOutputs<?, ?> sideOutputs, String outputName, String path, int minsup) throws IOException, InterruptedException {
final IntWritable itemW = new IntWritable();
final IntWritable boundW = new IntWritable();
TIntObjectIterator<PatternWithFreq[]> it = this.topK.iterator();
while (it.hasNext()) {
it.advance();
if (it.value()[this.k - 1] != null) {
final int supportCount = it.value()[this.k - 1].getSupportCount();
if (supportCount > minsup) {
itemW.set(it.key());
boundW.set(supportCount);
sideOutputs.write(outputName, itemW, boundW, path);
}
}
}
}
示例5: 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 });
}
}
}
示例6: getFulfilledRowRequests
import gnu.trove.iterator.TIntObjectIterator; //导入方法依赖的package包/类
public void getFulfilledRowRequests(ArrayList<ServerRowRequest> requests) {
int clock = bgClock.getMinClock();
requests.clear();
TIntObjectMap<List<ServerRowRequest>> bgRowRequests = clockBgRowRequests
.get(clock);
if (bgRowRequests == null) {
return;
}
TIntObjectIterator<List<ServerRowRequest>> iter =
bgRowRequests.iterator();
while (iter.hasNext()) {
iter.advance();
requests.addAll(iter.value());
}
clockBgRowRequests.remove(clock);
}
示例7: normalizeAll
import gnu.trove.iterator.TIntObjectIterator; //导入方法依赖的package包/类
/** Normalizes all potentials in the tree, both node and sepset. */
public void normalizeAll()
{
int n = cpfs.length;
for (int i = 0; i < n; i++) {
if (cpfs[i] != null) {
cpfs[i].normalize();
}
}
TIntObjectIterator it = sepsets.iterator();
while (it.hasNext()) {
it.advance();
Factor ptl = ((Sepset) it.value()).ptl;
ptl.normalize();
}
}
示例8: dump
import gnu.trove.iterator.TIntObjectIterator; //导入方法依赖的package包/类
public void dump ()
{
int n = cpfs.length;
// This will cause OpenJGraph to print all our nodes and edges
System.out.println(dumpToString());
// Now lets print all the cpfs
System.out.println("Vertex CPFs");
for (int i = 0; i < n; i++) {
if (cpfs[i] != null) {
System.out.println("CPF "+i+" "+cpfs[i].dumpToString ());
}
}
// And the sepset potentials
System.out.println("sepset CPFs");
TIntObjectIterator it = sepsets.iterator();
while (it.hasNext()) {
it.advance();
Factor ptl = ((Sepset) it.value()).ptl;
System.out.println(ptl.dumpToString ());
}
System.out.println ("/End JT");
}
示例9: isNaN
import gnu.trove.iterator.TIntObjectIterator; //导入方法依赖的package包/类
public boolean isNaN()
{
int n = cpfs.length;
for (int i = 0; i < n; i++)
if (cpfs[i].isNaN()) return true;
// And the sepset potentials
TIntObjectIterator it = sepsets.iterator();
while (it.hasNext()) {
it.advance();
Factor ptl = ((Sepset) it.value()).ptl;
if (ptl.isNaN()) return true;
}
return false;
}
示例10: dumpMap
import gnu.trove.iterator.TIntObjectIterator; //导入方法依赖的package包/类
protected void dumpMap() {
try {
tmpFileIndex++;
String outfile = tmpDIR + "/" + tmpFileIndex + ".tmp";
logger.info("dumping memory to file: " + outfile);
PrintStream tmpContentFile = new PrintStream(outfile);
TIntObjectIterator<T> it = id2item.iterator();
while (it.hasNext()) {
it.advance();
T item = it.value();
tmpContentFile.print(item.getID());
tmpContentFile.print("\t");
tmpContentFile.print(Serialization.serialize(item));
tmpContentFile.print("\n");
it.remove();
}
tmpContentFile.close();
} catch (Exception e) {
logger.error(e.toString());
}
}
开发者ID:hltfbk,项目名称:Excitement-TDMLEDA,代码行数:22,代码来源:UnlimitedMemoryBasedCountableIdentifiableStorage.java
示例11: 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);
}
示例12: 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);
}
示例13: 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);
}
}
}
示例14: statisticProb
import gnu.trove.iterator.TIntObjectIterator; //导入方法依赖的package包/类
/**
* 一次性统计概率,节约时间
*/
private void statisticProb() {
System.out.println("统计概率");
float totalword = alpahbet.size();
TIntFloatIterator it = wordProb.iterator();
while(it.hasNext()){
it.advance();
float v = it.value()/totalword;
it.setValue(v);
Cluster cluster = new Cluster(it.key(),v,alpahbet.lookupString(it.key()));
clusters.put(it.key(), cluster);
}
TIntObjectIterator<TIntFloatHashMap> it1 = pcc.iterator();
while(it1.hasNext()){
it1.advance();
TIntFloatHashMap map = it1.value();
TIntFloatIterator it2 = map.iterator();
while(it2.hasNext()){
it2.advance();
it2.setValue(it2.value()/totalword);
}
}
}
示例15: 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;
}