/// <summary> /// Asks the <see cref="SelectableScheme">scheme</see> for a /// <see cref="SelectableScheme"/> object that describes a /// sub-set of the set handled by this scheme. /// </summary> /// <param name="subsetTable"></param> /// <param name="subsetColumn"></param> /// <remarks> /// Since a <see cref="Table">table</see> stores a subset of a given /// <see cref="DataTable"/>, we pass this as the argument. It returns /// a new <see cref="SelectableScheme"/> that orders the rows in the /// given columns order. /// The <see cref="Column"/> variable specifies the column index of /// this column in the given table. /// </remarks> /// <returns></returns> public SelectableScheme GetSubsetScheme(Table subsetTable, int subsetColumn) { // Resolve table rows in this table scheme domain. List <long> rowSet = new List <long>((int)subsetTable.RowCount); IEnumerator <long> e = subsetTable.GetRowEnumerator(); while (e.MoveNext()) { rowSet.Add(e.Current); } subsetTable.SetToRowTableDomain(subsetColumn, rowSet, Table); // Generates an IIndex which contains indices into 'rowSet' in // sorted order. IIndex <long> newSet = GetOrderedIndex(rowSet); // Our 'new_set' should be the same size as 'rowSet' if (newSet.Count != rowSet.Count) { throw new Exception("Internal sort error in finding sub-set."); } // Set up a new SelectableScheme with the sorted index set. // Move the sorted index set into the new scheme. InsertSearch scheme = new InsertSearch(subsetTable, subsetColumn, newSet); // Don't let subset schemes create uid caches. scheme.RecordUid = false; return(scheme); }
/// <summary> /// Constructs this as a copy of the given, either mutable or readOnly copy. /// </summary> /// <param name="table"></param> /// <param name="from"></param> /// <param name="readOnly"></param> private InsertSearch(ITable table, InsertSearch from, bool readOnly) : base(table, from.Column) { IsReadOnly = readOnly; if (readOnly) { // Immutable is a shallow copy list = from.list; debugReadOnlySetSize = list.Count; } else { list = new BlockIndex <long>(from.list); } // Do we generate lookup caches? recordUid = from.recordUid; // The internal comparator that enables us to sort and lookup on the data // in this column. SetupComparer(); }
public IndexComparerImpl(InsertSearch scheme) { this.scheme = scheme; }