src/table/table.js
/**
   * Returns an array of indices for all rows passing the table filter.
   * @param {boolean} [order=true] A flag indicating if the returned
   *  indices should be sorted if this table is ordered. If false, the
   *  returned indices may or may not be sorted.
   * @return {Uint32Array} An array of row indices.
   */
Returns an array of indices for all rows passing the table filter.
@param {boolean} [order=true] A flag indicating if the returned
indices should be sorted if this table is ordered. If false, the
returned indices may or may not be sorted.
@return {Uint32Array} An array of row indices.
Returns an array of indices for all rows passing the table filter . @param { boolean } [ order = true ] A flag indicating if the returned indices should be sorted if this table is ordered . If false the returned indices may or may not be sorted . @return { Uint32Array } An array of row indices .
indices(order = true) {
    if (this._index) return this._index;
    const n = this.numRows();
    const index = new Uint32Array(n);
    const ordered = this.isOrdered();
    const bits = this.mask();
    let row = -1;
    if (bits) {
      for (let i = bits.next(0); i >= 0; i = bits.next(i + 1)) {
        index[++row] = i;
      }
    } else {
      for (let i = 0; i < n; ++i) {
        index[++row] = i;
      }
    }
    if (order && ordered) {
      const compare = this._order;
      const data = this._data;
      index.sort((a, b) => compare(a, b, data));
    }
    if (order || !ordered) {
      this._index = index;
    }
    return index;
  }
indices ( order = true ) { if ( this . _index ) return this . _index ; const n = this . numRows ( ) ; const index = new Uint32Array ( n ) ; const ordered = this . isOrdered ( ) ; const bits = this . mask ( ) ; let row = - 1 ; if ( bits ) { for ( let i = bits . next ( 0 ) ; i >= 0 ; i = bits . next ( i + 1 ) ) { index [ ++ row ] = i ; } } else { for ( let i = 0 ; i < n ; ++ i ) { index [ ++ row ] = i ; } } if ( order && ordered ) { const compare = this . _order ; const data = this . _data ; index . sort ( ( a , b ) => compare ( a , b , data ) ) ; } if ( order || ! ordered ) { this . _index = index ; } return index ; }
Returns an array of indices for all rows passing the table filter.
Returns an array of indices for all rows passing the table filter .
// inline the following for performance: // this.scan(row => index[++i] = row); // sort index vector // save indices if they reflect table metadata