/** {@inheritDoc} */ @Override public String toString() { final StringBuilder buf = new StringBuilder( "{" ); forEachEntry( new TIntIntProcedure() { private boolean first = true; public boolean execute( int key, int value ) { if ( first ) first = false; else buf.append( ", " ); buf.append(key); buf.append("="); buf.append(value); return true; } }); buf.append( "}" ); return buf.toString(); }
/** See {@link gnu.trove.map.hash.TIntIntHashMap#forEachEntry(TIntIntProcedure)} */ public boolean forEachEntry(TIntIntProcedure procedure) { return delegate.forEachEntry(procedure); }
/** See {@link gnu.trove.map.hash.TIntIntHashMap#forEachEntry(TIntIntProcedure)} */ public boolean forEachEntry(TIntIntProcedure procedure) { return delegate.forEachEntry(procedure); }
/** {@inheritDoc} */ @Override public String toString() { final StringBuilder buf = new StringBuilder( "{" ); forEachEntry( new TIntIntProcedure() { private boolean first = true; public boolean execute( int key, int value ) { if ( first ) first = false; else buf.append( ", " ); buf.append(key); buf.append("="); buf.append(value); return true; } }); buf.append( "}" ); return buf.toString(); }
/** {@inheritDoc} */ @Override public String toString() { final StringBuilder buf = new StringBuilder( "{" ); forEachEntry( new TIntIntProcedure() { private boolean first = true; public boolean execute( int key, int value ) { if ( first ) first = false; else buf.append( ", " ); buf.append(key); buf.append("="); buf.append(value); return true; } }); buf.append( "}" ); return buf.toString(); }
/** {@inheritDoc} */ @Override public String toString() { final StringBuilder buf = new StringBuilder( "{" ); forEachEntry( new TIntIntProcedure() { private boolean first = true; public boolean execute( int key, int value ) { if ( first ) first = false; else buf.append( ", " ); buf.append(key); buf.append("="); buf.append(value); return true; } }); buf.append( "}" ); return buf.toString(); }
/** {@inheritDoc} */ @Override public String toString() { final StringBuilder buf = new StringBuilder( "{" ); forEachEntry( new TIntIntProcedure() { private boolean first = true; @Override public boolean execute( int key, int value ) { if ( first ) first = false; else buf.append( ", " ); buf.append(key); buf.append("="); buf.append(value); return true; } }); buf.append( "}" ); return buf.toString(); }
public void add (ServiceInfo serviceInfo) { servicesActive.add(serviceInfo.serviceId); serviceInfo.durationByRouteType.forEachEntry((routeType, serviceDurationSeconds) -> { durationByRouteType.adjustOrPutValue(routeType, serviceDurationSeconds, serviceDurationSeconds); return true; // Continue iteration. }); tripCount += serviceInfo.tripIds.size(); } }
void update() { // Requires two iterations to calculate variance (single iteration naive algorithm is numerically unstable) statsProcedure = new StatsProcedure(0); counters.forEachEntry(statsProcedure); // Second iteration, we use the mean value from the first statsProcedure = new StatsProcedure(statsProcedure.mean()); counters.forEachEntry(statsProcedure); needUpdate = false; } }
/*** * prunes the lexicon by removing features with less than threshold many counts */ public Lexicon getPrunedLexicon(final int threshold) { final Lexicon lex = new Lexicon(false, false); this.feature2Id.forEachEntry(new TIntIntProcedure() { @Override public boolean execute(int hash, int id) { if (featureCounts.get(id) > threshold) lex.feature2Id.put(hash, id); return true; } }); lex.nextFeatureId = this.nextFeatureId; logger.info("Number of features after pruning: " + lex.size()); return lex; }
/*** * prunes the lexicon by removing features with less than threshold many counts */ public Lexicon getPrunedLexicon(final int threshold) { final Lexicon lex = new Lexicon(false, false); this.feature2Id.forEachEntry(new TIntIntProcedure() { @Override public boolean execute(int hash, int id) { if (featureCounts.get(id) > threshold) lex.feature2Id.put(hash, id); return true; } }); lex.nextFeatureId = this.nextFeatureId; logger.info("Number of features after pruning: " + lex.size()); return lex; }
feature2Id.forEachEntry(new TIntIntProcedure() {
feature2Id.forEachEntry(new TIntIntProcedure() {
for (final TIntIntHashMap doc : docs) { final Document d = new Document(c); doc.forEachEntry(new TIntIntProcedure() { @Override public boolean execute(int word, int count) {
); for (ServiceInfo serviceInfo : serviceInfoForServiceId.values()) { serviceInfo.durationByRouteType.forEachEntry((routeType, serviceDurationSeconds) -> { try { serviceDurationStatement.setString(1, serviceInfo.serviceId);
/** * Based on writeExternal in the hierarchy of TIntIntHashMap. */ @Override public void write(Kryo kryo, Output output, TIntIntHashMap map) { // Do not write load and compaction factors. // They're not public and we don't ever modify them in a principled way. // No-entry key and value. Often zero or -1 so don't optimize for positive values, do optimize for small values. output.writeVarInt(map.getNoEntryKey(), false); output.writeVarInt(map.getNoEntryValue(), false); // Number of entries, always zero or positive. output.writeVarInt(map.size(), true); // All entries, most are positive in our application? if (varInts) { map.forEachEntry((k, v) -> { output.writeVarInt(k, optimizePositive); output.writeVarInt(v, optimizePositive); return true; }); } else { map.forEachEntry((k, v) -> { output.writeInt(k, optimizePositive); output.writeInt(v, optimizePositive); return true; }); } }
/** * Based on writeExternal in the hierarchy of TIntIntHashMap. */ @Override public void write(Kryo kryo, Output output, TIntIntHashMap map) { // Do not write load and compaction factors. // They're not public and we don't ever modify them in a principled way. // No-entry key and value. Often zero or -1 so don't optimize for positive values, do optimize for small values. output.writeVarInt(map.getNoEntryKey(), false); output.writeVarInt(map.getNoEntryValue(), false); // Number of entries, always zero or positive. output.writeVarInt(map.size(), true); // All entries, most are positive in our application? if (varInts) { map.forEachEntry((k, v) -> { output.writeVarInt(k, optimizePositive); output.writeVarInt(v, optimizePositive); return true; }); } else { map.forEachEntry((k, v) -> { output.writeInt(k, optimizePositive); output.writeInt(v, optimizePositive); return true; }); } }
freqs.forEachEntry(hm); mode[i] = hm.idx / 255.0;
freqs.forEachEntry(hm); mode[i] = hm.idx / 255.0;