com.carrotsearch.hppc
Interface ArraySizingStrategy
- All Known Implementing Classes:
- BoundedProportionalArraySizingStrategy
public interface ArraySizingStrategy
Resizing (growth) strategy for array-backed buffers.
|
Method Summary |
int |
grow(int currentBufferLength,
int elementsCount,
int expectedAdditions)
|
int |
round(int capacity)
Array sizing strategies may require that the initial size fulfills
certain constraints (is a prime or a power of two, for example). |
round
int round(int capacity)
- Array sizing strategies may require that the initial size fulfills
certain constraints (is a prime or a power of two, for example). This
method must return the first size that fulfills these conditions
and is greater or equal to
capacity.
grow
int grow(int currentBufferLength,
int elementsCount,
int expectedAdditions)
- Parameters:
currentBufferLength - Current size of the array (buffer). This number
should comply with the strategy's policies (it is a result of initial rounding
or further growths). It can also be zero, indicating the growth from an empty
buffer.elementsCount - Number of elements stored in the buffer.expectedAdditions - Expected number of additions (resize hint).
- Returns:
- Must return a new size at least as big as to hold
elementsCount + expectedAdditions.
Copyright © 2012 Carrot Search s.c.. All Rights Reserved.