本文整理汇总了Java中gnu.trove.iterator.TIntObjectIterator.advance方法的典型用法代码示例。如果您正苦于以下问题:Java TIntObjectIterator.advance方法的具体用法?Java TIntObjectIterator.advance怎么用?Java TIntObjectIterator.advance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gnu.trove.iterator.TIntObjectIterator
的用法示例。
在下文中一共展示了TIntObjectIterator.advance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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();
}
}
}
示例2: 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();
}
}
示例3: 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);
}
}
}
}
示例4: 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 });
}
}
}
示例5: 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);
}
示例6: tickTimeouts
import gnu.trove.iterator.TIntObjectIterator; //导入方法依赖的package包/类
public static void tickTimeouts()
{
if (++timer >= 200)
{
timer = 0;
int threshold = 30; // 5 minute timeout for non-accessed images
TIntObjectIterator<ImageHandler> iterator = HANDLERS.iterator();
for (int i = HANDLERS.size(); i > 0; --i)
{
iterator.advance();
ImageHandler imageHandler = iterator.value();
if (imageHandler.useSingleTemplateImage == false)
{
imageHandler.regionImageCache.removeOld(threshold);
}
}
}
}
示例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: 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);
}
}
}
示例14: initialisationComplete
import gnu.trove.iterator.TIntObjectIterator; //导入方法依赖的package包/类
@Override
public boolean initialisationComplete(TIndexedCollection<DAGNode> nodes,
TIndexedCollection<DAGEdge> edges, boolean forceRebuild) {
if (depthCalculated_ && !forceRebuild)
return false;
// Compute the depths of each node in the graph
System.out.print("Calculating node depths... ");
depthMap_ = MultiMap.createConcurrentHashSetMultiMap();
int tenPercent = nodes.size() / 10;
// TODO Embarrassingly parallel.
TIntObjectIterator<DAGNode> iter = nodes.iterator();
int i = 1;
for (; i <= nodes.size(); i++) {
iter.advance();
processNode(iter.value(), new HashSet<Integer>());
if (i % tenPercent == 0)
System.out.print((i / tenPercent * 10) + "% ");
}
System.out.println("Depth calculation complete!");
depthCalculated_ = true;
return true;
}
示例15: topologicalList
import gnu.trove.iterator.TIntObjectIterator; //导入方法依赖的package包/类
/**
* Topologically sorts a collection of nodes.
*
* @param nodes
* The nodes to sort.
* @return The topologically sorted list of nodes.
*/
public List<DAGNode> topologicalList(TIndexedCollection<DAGNode> nodes) {
cycles_ = new ArrayList<>();
LinkedList<DAGNode> sortedNodes = new LinkedList<>();
RewriteOfModule rewriteModule = (RewriteOfModule) dag_
.getModule(RewriteOfModule.class);
TIntObjectIterator<DAGNode> iter = nodes.iterator();
for (int i = nodes.size(); i-- > 0;) {
iter.advance();
DAGNode n = iter.value();
if (rewriteModule != null)
n = rewriteModule.getRewrite(n);
// Ignore non-collections
if (queryModule_.prove(false, CommonConcepts.ISA.getNode(dag_), n,
CommonConcepts.COLLECTION.getNode(dag_)) == QueryResult.TRUE)
topologicalVisit(n, sortedNodes,
new HashMap<DAGNode, String>(),
new ArrayList<DAGNode>());
}
return sortedNodes;
}