public void add (int i) { count++; int binVal = bins.adjustOrPutValue(i, 1, 1); if (binVal > maxVal) maxVal = binVal; if (i > maxBin) { maxBin = i; } if (i < minBin) { minBin = i; } }
public int adjustOrPutValue( int key, int adjust_amount, int put_amount ) { synchronized( mutex ) { return m.adjustOrPutValue( key, adjust_amount, put_amount ); } }
private synchronized void incrementReadCount(int clientIndex) { if (readLockHolders == null) { readLockHolders = new TIntIntHashMap(1); } readLockHolders.adjustOrPutValue(clientIndex, 1, 1); }
public void add (int i) { count++; int binVal = bins.adjustOrPutValue(i, 1, 1); if (binVal > maxVal) maxVal = binVal; if (i > maxBin) { maxBin = i; } if (i < minBin) { minBin = i; } }
public void add (int i) { count++; int binVal = bins.adjustOrPutValue(i, 1, 1); if (binVal > maxVal) maxVal = binVal; if (i > maxBin) { maxBin = i; } if (i < minBin) { minBin = i; } }
public int adjustOrPutValue( int key, int adjust_amount, int put_amount ) { synchronized( mutex ) { return m.adjustOrPutValue( key, adjust_amount, put_amount ); } }
@Override public int adjustOrPutValue( int key, int adjust_amount, int put_amount ) { synchronized( mutex ) { return m.adjustOrPutValue( key, adjust_amount, put_amount ); } }
public int adjustOrPutValue( int key, int adjust_amount, int put_amount ) { synchronized( mutex ) { return m.adjustOrPutValue( key, adjust_amount, put_amount ); } }
public int adjustOrPutValue( int key, int adjust_amount, int put_amount ) { synchronized( mutex ) { return m.adjustOrPutValue( key, adjust_amount, put_amount ); } }
@Override public void increment(DBIDRef id, int adjust) { map.adjustOrPutValue(DBIDUtil.asInteger(id), adjust, adjust); }
/** * Counts words that have not been normalized. I.e. the separators between words * are those traditionally found in plain text. * * @param text */ public void countRawText(String text) { // Count and extract mentions if necessary. if (containsMentions) { Matcher m = PATTERN_MENTION.matcher(text); while (m.find()) { int wpId = Integer.valueOf(m.group(3)); synchronized (mentionCounts) { mentionCounts.adjustOrPutValue(wpId, 1, 1); } } text = PATTERN_MENTION.matcher(text).replaceAll("$1 "); } countWords(tokenizer.getWords(language, text)); }
int wpId = Integer.valueOf(m.group(3)); synchronized (mentionCounts) { mentionCounts.adjustOrPutValue(wpId, 1, 1);
for (KnownSim ks : mostSim) { if (ks.wpId1 >= 0) { int n = idCounts.adjustOrPutValue(ks.wpId1, 1, 1); if (n > maxIdCount) { maxIdCount = n;
@Override public SRResultList mostSimilar(int pageId, int maxResults, TIntSet validIds) throws DaoException { TIntIntMap scores = new TIntIntHashMap(); for (int id : getLinks(pageId, true)) { if (validIds == null || validIds.contains(id)) scores.adjustOrPutValue(id, 1, 1); } for (int id : getLinks(pageId, false)) { if (validIds == null || validIds.contains(id)) scores.adjustOrPutValue(id, 1, 1); } Leaderboard leaderboard = new Leaderboard(maxResults); for (int id : scores.keys()) { leaderboard.tallyScore(id, scores.get(id) / 2.0); } return normalize(leaderboard.getTop()); }
@Override public TIntIntMap getAllViews(Language language, DateTime startDate, DateTime endDate) throws DaoException { DSLContext context = getJooq(); Timestamp startTime = new Timestamp(startDate.getMillis()); Timestamp endTime = new Timestamp(endDate.getMillis()); try { Cursor<Record> result = context.select(). from(Tables.PAGEVIEW). where(Tables.PAGEVIEW.LANG_ID.eq(language.getId())). and(Tables.PAGEVIEW.TSTAMP.between(startTime, endTime)). fetchLazy(getFetchSize()); TIntIntMap views = new TIntIntHashMap( gnu.trove.impl.Constants.DEFAULT_CAPACITY, gnu.trove.impl.Constants.DEFAULT_LOAD_FACTOR, -1, -1); for (Record record : result){ views.adjustOrPutValue( record.getValue(Tables.PAGEVIEW.PAGE_ID), record.getValue(Tables.PAGEVIEW.NUM_VIEWS), record.getValue(Tables.PAGEVIEW.NUM_VIEWS)); } return views; } finally { freeJooq(context); } }
@Override public TIntIntMap getAllViews(Language language, DateTime startDate, DateTime endDate) throws DaoException { DSLContext context = getJooq(); Timestamp startTime = new Timestamp(startDate.getMillis()); Timestamp endTime = new Timestamp(endDate.getMillis()); try { Cursor<Record> result = context.select(). from(Tables.PAGEVIEW). where(Tables.PAGEVIEW.LANG_ID.eq(language.getId())). and(Tables.PAGEVIEW.TSTAMP.between(startTime, endTime)). fetchLazy(getFetchSize()); TIntIntMap views = new TIntIntHashMap( gnu.trove.impl.Constants.DEFAULT_CAPACITY, gnu.trove.impl.Constants.DEFAULT_LOAD_FACTOR, -1, -1); for (Record record : result){ views.adjustOrPutValue( record.getValue(Tables.PAGEVIEW.PAGE_ID), record.getValue(Tables.PAGEVIEW.NUM_VIEWS), record.getValue(Tables.PAGEVIEW.NUM_VIEWS)); } return views; } finally { freeJooq(context); } }
@Override public SRResultList mostSimilar(TIntFloatMap query, int maxResults, TIntSet validIds) throws IOException { TIntIntMap intersections = new TIntIntHashMap(); for (int id1 : query.keys()){ SparseMatrixRow row = transpose.getRow(id1); for (int i = 0; i < row.getNumCols(); i++) { int id2 = row.getColIndex(i); if (validIds == null || validIds.contains(id2)) { intersections.adjustOrPutValue(id2, 1, 1); } } } Leaderboard leaderboard = new Leaderboard(maxResults); for (int id: intersections.keys()) { double sim = SimUtils.googleSimilarity(query.size(), lengths.get(id), intersections.get(id), numPages); leaderboard.tallyScore(id, sim); } return leaderboard.getTop(); }
sizes.adjustOrPutValue(it.next(), 1, 1);