Internally called to reallocate the indexes. This method should be called when the filtered model changes its
element size
586
protected void reallocateIndexes() {
        if (this.indexes == null || this.indexes.length != getFilteredModel().getSize()) {
            this.indexes = new int[getFilteredModel().getSize()];
        }
        applyConstraint();
    }
827194
public void set(long index, Slice value)
    {
        updateRetainedSize(index, value);
        array.set(index, value);
    }
384115
private void resize(Object[] oldTable, int newSize)
    {
        int oldCapacity = oldTable.length;
        int end = oldCapacity - 1;
        Object last = arrayAt(oldTable, end);
        if (this.size() < ((end*3) >> 2) && last == RESIZE_SENTINEL)
        {
            return;
        }
        if (oldCapacity >= MAXIMUM_CAPACITY)
        {
            throw new RuntimeException("max capacity of map exceeded");
        }
        ResizeContainer resizeContainer = null;
        boolean ownResize = false;
        if (last == null || last == RESIZE_SENTINEL)
        {
            synchronized (oldTable) // allocating a new array is too expensive to make this an atomic operation
            {
                if (arrayAt(oldTable, end) == null)
                {
                    setArrayAt(oldTable, end, RESIZE_SENTINEL);
                    resizeContainer = new ResizeContainer(allocateTable(newSize), oldTable.length - 2);
                    setArrayAt(oldTable, end, resizeContainer);
                    ownResize = true;
                }
            }
        }
        if (ownResize)
        {
            this.transfer(oldTable, resizeContainer);

            Object[] src = this.table;
            while (!TABLE_UPDATER.compareAndSet(this, oldTable, resizeContainer.nextArray))
            {
                // we're in a double resize situation; we'll have to go help until it's our turn to set the table
                if (src != oldTable)
                {
                    this.helpWithResize(src);
                }
            }
        }
        else
        {
            this.helpWithResize(oldTable);
        }
    }
1115797
def update_indexes_after(start_index)
      size = @templates.size
      if size > 0
        start_index.upto(size - 1) do |index|
          @templates[index].context.locals[:_index=].call(index)
        end
      end
    end
1264968
private void rehash() {
        int oldCapacity = mTable.length;
        Entry oldMap[] = mTable;
        
        int newCapacity = oldCapacity * 2 + 1;
        Entry newMap[] = new Entry[newCapacity];
        
        mModCount++;
        mThreshold = (int)(newCapacity * mLoadFactor);
        mTable = newMap;
        
        for (int i = oldCapacity ; i-- > 0 ;) {
            for (Entry old = oldMap[i] ; old != null ; ) {
                Entry e = old;
                old = old.mNext;

                // Only copy entry if its value hasn't been cleared.
                if (e.getValue() == null) {
                    mCount--;
                }
                else {
                    int index = (e.mHash & 0x7FFFFFFF) % newCapacity;
                    e.mNext = newMap[index];
                    newMap[index] = e;
                }
            }
        }
    }
1288581
private SparseMatrix retainColumns(Set<Integer> indicesToKeep) {
        int words = termToIndex.numDimensions();
        int cols = indicesToKeep.size();

        // Create a mapping from old indices to their new index value.
        Map<Integer, Integer> indexMap = new HashMap<Integer, Integer>();
        int newIndex = 0;
        for (Integer index : indicesToKeep)
            indexMap.put(index, newIndex++);

        // Create a reduced matrix that will have only the selected columns in
        // the final space.
        SparseMatrix reduced = new YaleSparseMatrix(
                words, indicesToKeep.size());

        // Iterate over the sparse values in the matrix for added efficiency.
        for (int row = 0; row < words; ++ row) {
            SparseDoubleVector sv = cooccurrenceMatrix.getRowVector(row);
            for (int col : sv.getNonZeroIndices()) {
                double v = cooccurrenceMatrix.get(row, col);

                // If the original column was retained, get it's new index
                // value and add it to the reduced matrix.
                Integer newColIndex = indexMap.get(col);
                if (newColIndex != null)
                    reduced.set(row, newColIndex, v);

                // If the transposed row column was retained, get it's new index
                // value and add it to the reduced matrix.  This turns the col
                // value into the row and the new index as the column.
                newColIndex = indexMap.get(row + words);
                if (newColIndex != null)
                    reduced.set(col, newColIndex, v);
            }
        }

        return reduced;
    }
246345
def reset_index(self):
        
        self.index = list(range(self.__len__()))
        self.index_name = 'index'
288021
public void trimToSize() {
        modCount++;
        int oldCapacity = elementData.length;
        if (size < oldCapacity) {
            elementData = Arrays.copyOf(elementData, size);
        }
    }
561059
private void reallocate(int capacity) {
    if (capacity != elements.length) {
      assert (size <= capacity);
      float[] newArray = new float[capacity];
      for (int i = 0; i < size; i++) {
        newArray[i] = elements[i];
      }
      elements = newArray;
    }
  }
422083
def refresh_index(meta, index) -> None:
    
    # All projections include model + index keys
    projection_keys = set.union(meta.keys, index.keys)

    proj = index.projection
    mode = proj["mode"]

    if mode == "keys":
        proj["included"] = projection_keys
    elif mode == "all":
        proj["included"] = meta.columns
    elif mode == "include":  # pragma: no branch
        if all(isinstance(p, str) for p in proj["included"]):
            proj["included"] = set(meta.columns_by_name[n] for n in proj["included"])
        else:
            proj["included"] = set(proj["included"])
        proj["included"].update(projection_keys)

    if proj["strict"]:
        proj["available"] = proj["included"]
    else:
        proj["available"] = meta.columns
350382
@Override
	protected void onSizeChanged(int w, int h, int oldw, int oldh) {
		if (w != oldw || h != oldh) {
			mNeedsResize = true;
		}
	}
639790
def reset_index(self, inplace=True, drop=True):
        
        if len(self.column_types) == 1:
            vectype = self.column_types[0]
            if isinstance(vectype, WeldVec):
                elem_type = vectype.elemType
                if isinstance(elem_type, WeldStruct):
                    self.column_types = elem_type.field_types
                    value_type = WeldStruct(self.column_types)
                else:
                    self.column_types = elem_type
                    value_type = elem_type
                if len(self.grouping_column_types) == 1:
                    group_type = self.grouping_column_types[0]
                else:
                    group_type = WeldStruct(self.grouping_column_types)

                self.weld_type = WeldStruct([group_type, value_type])
                self.expr = grizzly_impl.flatten_group(
                    self.expr,
                    self.column_types,
                    self.grouping_column_types
                )
173481
public void restoreFilters() {

        IndexedContainer container = (IndexedContainer)m_fileTable.getContainerDataSource();
        container.removeAllContainerFilters();
        for (Filter filter : m_filters) {
            container.addContainerFilter(filter);
        }
    }
1176410
private void reinsertExpanded(SpatialPrimitiveDistanceFunction<V> distFunction, DeLiCluTree index, IndexTreePath<DeLiCluEntry> path, DataStore<KNNList> knns) {
    int l = 0; // Count the number of components.
    for(IndexTreePath<DeLiCluEntry> it = path; it != null; it = it.getParentPath()) {
      l++;
    }
    ArrayList<IndexTreePath<DeLiCluEntry>> p = new ArrayList<>(l - 1);
    // All except the last (= root).
    IndexTreePath<DeLiCluEntry> it = path;
    for(; it.getParentPath() != null; it = it.getParentPath()) {
      p.add(it);
    }
    assert (p.size() == l - 1);
    DeLiCluEntry rootEntry = it.getEntry();
    reinsertExpanded(distFunction, index, p, l - 2, rootEntry, knns);
  }
489408
public void trimToSize()
    {
        if (elements.length != size && elements.length > INITIAL_CAPACITY)
        {
            elements = Arrays.copyOf(elements, Math.max(INITIAL_CAPACITY, size));
        }
    }
1060186
private void resizeNodeArrays(int newBucketCount)
    {
        // every per-bucket array needs to be updated
        counts.ensureCapacity(newBucketCount);
        valuePositions.ensureCapacity(newBucketCount);
        nextPointers.ensureCapacity(newBucketCount);
        valueAndGroupHashes.ensureCapacity(newBucketCount);
        groupIds.ensureCapacity(newBucketCount);
    }
1072424
private void removeAllEntries() {
        // A bit unusual, but we want to make sure we do not call this while the index is active.
        Preconditions.checkState(this.closed, "Cannot call removeAllEntries unless the ReadIndex is closed.");
        int count;
        synchronized (this.lock) {
            this.indexEntries.forEach(entry -> {
                if (entry.isDataEntry()) {
                    CacheKey key = getCacheKey(entry);
                    this.cache.remove(key);
                }
            });

            count = this.indexEntries.size();
            this.indexEntries.clear();
        }

        if (count > 0) {
            log.debug("{}: Cleared all cache entries ({}).", this.traceObjectId, count);
        }
    }