public int positionOf(Block block, int position) { return blockPositionByHash.get(getHashPositionOfElement(block, position)); }
public boolean contains(Block block, int position) { requireNonNull(block, "block must not be null"); checkArgument(position >= 0, "position must be >= 0"); if (block.isNull(position)) { return containsNullElement; } else { return blockPositionByHash.get(getHashPositionOfElement(block, position)) != EMPTY_SLOT; } }
public void add(Block block, int position) { requireNonNull(block, "block must not be null"); checkArgument(position >= 0, "position must be >= 0"); // containsNullElement flag is maintained so contains() method can have shortcut for null value if (block.isNull(position)) { containsNullElement = true; } int hashPosition = getHashPositionOfElement(block, position); if (blockPositionByHash.get(hashPosition) == EMPTY_SLOT) { addNewElement(hashPosition, block, position); } }
/** * Get slot position of element at {@code position} of {@code block} */ private int getHashPositionOfElement(Block block, int position) { int hashPosition = getMaskedHash(hashPosition(elementType, block, position)); while (true) { int blockPosition = blockPositionByHash.get(hashPosition); // Doesn't have this element if (blockPosition == EMPTY_SLOT) { return hashPosition; } // Already has this element else if (positionEqualsPosition(elementType, elementBlock, blockPosition, block, position)) { return hashPosition; } hashPosition = getMaskedHash(hashPosition + 1); } }
writtenBytes += 4; out.writeInt(-labelToMerge.get(i)); exampleCount++; writtenBytes += 4;
int previousPosition = probeIndexBuilder.isEmpty() ? -1 : probeIndexBuilder.get(probeIndexBuilder.size() - 1);
public int positionOf(Block block, int position) { return blockPositionByHash.get(getHashPositionOfElement(block, position)); }
public int positionOf(Block block, int position) { return blockPositionByHash.get(getHashPositionOfElement(block, position)); }
public boolean contains(Block block, int position) { requireNonNull(block, "block must not be null"); checkArgument(position >= 0, "position must be >= 0"); if (block.isNull(position)) { return containsNullElement; } else { return blockPositionByHash.get(getHashPositionOfElement(block, position)) != EMPTY_SLOT; } }
public boolean contains(Block block, int position) { requireNonNull(block, "block must not be null"); checkArgument(position >= 0, "position must be >= 0"); if (block.isNull(position)) { return containsNullElement; } else { return blockPositionByHash.get(getHashPositionOfElement(block, position)) != EMPTY_SLOT; } }
public void add(Block block, int position) { requireNonNull(block, "block must not be null"); checkArgument(position >= 0, "position must be >= 0"); // containsNullElement flag is maintained so contains() method can have shortcut for null value if (block.isNull(position)) { containsNullElement = true; } int hashPosition = getHashPositionOfElement(block, position); if (blockPositionByHash.get(hashPosition) == EMPTY_SLOT) { addNewElement(hashPosition, block, position); } }
public void add(Block block, int position) { requireNonNull(block, "block must not be null"); checkArgument(position >= 0, "position must be >= 0"); // containsNullElement flag is maintained so contains() method can have shortcut for null value if (block.isNull(position)) { containsNullElement = true; } int hashPosition = getHashPositionOfElement(block, position); if (blockPositionByHash.get(hashPosition) == EMPTY_SLOT) { addNewElement(hashPosition, block, position); } }
if (writer != null) writer.write(sequence, kTotalSupports.get(i));
/** * add the aggregatorID into list if not existed * * @param aggIDList * @param aggregatorID */ protected void mergeAggregatorID(IntArrayList aggIDList, int aggregatorID) { for (int index = 0; index < aggIDList.size(); ++index) { if (aggIDList.get(index) == aggregatorID) { return; } } aggIDList.add(aggregatorID); }
/** * Get slot position of element at {@code position} of {@code block} */ private int getHashPositionOfElement(Block block, int position) { int hashPosition = getMaskedHash(hashPosition(elementType, block, position)); while (true) { int blockPosition = blockPositionByHash.get(hashPosition); // Doesn't have this element if (blockPosition == EMPTY_SLOT) { return hashPosition; } // Already has this element else if (positionEqualsPosition(elementType, elementBlock, blockPosition, block, position)) { return hashPosition; } hashPosition = getMaskedHash(hashPosition + 1); } }
/** * Get slot position of element at {@code position} of {@code block} */ private int getHashPositionOfElement(Block block, int position) { int hashPosition = getMaskedHash(hashPosition(elementType, block, position)); while (true) { int blockPosition = blockPositionByHash.get(hashPosition); // Doesn't have this element if (blockPosition == EMPTY_SLOT) { return hashPosition; } // Already has this element else if (positionEqualsPosition(elementType, elementBlock, blockPosition, block, position)) { return hashPosition; } hashPosition = getMaskedHash(hashPosition + 1); } }
int previousPosition = probeIndexBuilder.isEmpty() ? -1 : probeIndexBuilder.get(probeIndexBuilder.size() - 1);