private int getGroupId(long rawKey) { int groupId = _rawKeyToGroupIdMap.get(rawKey); if (groupId == INVALID_ID) { if (_numGroups < _globalGroupIdUpperBound) { groupId = _numGroups; _rawKeyToGroupIdMap.put(rawKey, _numGroups++); } } return groupId; }
@Override public int indexOf(Object rawValue) { long value = getValue(rawValue); return _valToDictId.get(value); }
case LONG: for (int i = 0; i < multiValues.length; i++) { indexes[i] = _longValueToIndexMap.get((long) multiValues[i]);
public int indexOfSV(Object value) { switch (_fieldSpec.getDataType()) { case INT: return _intValueToIndexMap.get((int) value); case LONG: return _longValueToIndexMap.get((long) value); case FLOAT: return _floatValueToIndexMap.get((float) value); case DOUBLE: return _doubleValueToIndexMap.get((double) value); case STRING: return _stringValueToIndexMap.getInt(value); case BYTES: return _bytesValueToIndexMap.get(new ByteArray((byte[]) value)); default: throw new UnsupportedOperationException("Unsupported data type : " + _fieldSpec.getDataType()); } }
private int getSuccessor_unsync(int curState, int input) { long t = getTransition_unsync(curState, input); return map.get(t); }
private int indexOf_unsync(int[] input, boolean add) { // System.err.println("Adding to index: "+ // Arrays.toString(IStrings.toStringArray(input))); int curState = IDX_ROOT; for (int anInput : input) { long transition = getTransition(curState, transitionNormalizer.apply(anInput)); assert (map != null); int nextState = map.get(transition); if (nextState == IDX_NOSUCCESSOR) { if (!add) return -1; if (lastStateIdx == Integer.MAX_VALUE) throw new RuntimeException("Running out of state indices!"); nextState = ++lastStateIdx; map.put(transition, nextState); } curState = nextState; } return curState; }
/** * increases the click count of an item that has just been clicked on by 1 * @param transaction - */ private void increaseClickCount(Transaction transaction) { if (itemClickCount.containsKey(transaction.item.id)) { itemClickCount.put(transaction.item.id, itemClickCount.get(transaction.item.id) + 1); } else { itemClickCount.put(transaction.item.id, 1); } }
int nextState = trieIndex.map.get(terminalTransition); if (nextState != TrieIntegerArrayIndex.IDX_NOSUCCESSOR) { CoverageSet coverage = s.coverage.clone(); long nonterminalTransition = trieIndex.getTransition(s.state, GAP_STR.id); int nextState = trieIndex.map.get(nonterminalTransition); if (nextState != TrieIntegerArrayIndex.IDX_NOSUCCESSOR) { long terminalTransition = trieIndex.getTransition(nextState, sequence.get(afterX).id); int next2State = trieIndex.map.get(terminalTransition); if (next2State != TrieIntegerArrayIndex.IDX_NOSUCCESSOR) { CoverageSet coverage = s.coverage.clone();
map.put(hashKey, col.getString(mkRows.hashMap.get(hashKey))); return new MinKSet<String>(this.maxSize, map, Comparator.naturalOrder(), minString, maxString, numPresent, numMissing);
int category = categoryMap.get(allRec.getLong(j));
docPointers.add(curPointer); counts.add(iter.count()); termSizes.put(curPointer, termSizes.get(curPointer) + iter.count()); occurrences += iter.count(); totalOccurrences += iter.count(); try(OutputBitStream sizesStream = new OutputBitStream(sizesFile)) { for(long i = 0; i < directTerms.size64(); i++) { int termSize = termSizes.get(i); sizesStream.writeGamma(termSize); if(termSize > maxTermSize) {
@Override public LongArrayList recommendInternal(ClickData clickData) { //filter out items with low overall click counts //first, retrieve the recommendation results of the underlying algorithm LongArrayList rec = mainStrategy.recommendInternal(clickData); //create lists of filtered items and retained items LongArrayList filteredRec = new LongArrayList(); LongArrayList filteredRecNotMatch = new LongArrayList(); //iterate over the recommendation list of the underlying strategy for (int j = 0; j < rec.size(); j++) { long i = rec.getLong(j); //filter items if they do not have enough clicks if ((itemClickCount.containsKey(i)) && (itemClickCount.get(i) >= minClickCount)) { filteredRec.add(i); } else if (fallback) { //if we have a fallback, add the filtered item to the fallback list filteredRecNotMatch.add(i); } } //merge the filtered list with the fallback list (empty in case fallback==false) filteredRec.addAll(filteredRecNotMatch); //return the filtered list return filteredRec; }
for(int j = BitsUtil.nextSetBit(scratch, i + 1); j >= 0; j = BitsUtil.nextSetBit(scratch, j + 1)) { long key = (((long) i) << 32) | j; map.put(key, 1 + map.get(key)); ++lives;
for(int j = BitsUtil.nextSetBit(scratch, i + 1); j >= 0; j = BitsUtil.nextSetBit(scratch, j + 1)) { long key = (((long) i) << 32) | j; map.put(key, 1 + map.get(key)); ++lives;
hMap.put(hashKey, new RowSnapshot(data, mkRows.hashMap.get(hashKey), schema)); RowSnapshot minRS = new RowSnapshot(data, minRow, schema); RowSnapshot maxRS = new RowSnapshot(data, maxRow, schema);