/// <summary>
        /// Applies a SearchCriteria to the index.
        /// </summary>
        /// <param name="crit">The SearchCriteria to apply.</param>
        /// <returns>A ResultsTable that contains the result of applying the criteria.</returns>
        public ResultsTable GenerateResultsTable(SearchCriteria crit)
        {
            Debug.Assert(crit != null);

            CodeElementWrapperArrayIndexTable idxTable;

            // If using all criteria, perform a copy.
            if (crit.ElementFilter == CodeElementType.All)
            {
                idxTable = (CodeElementWrapperArrayIndexTable) indexTable.Clone();
            }
            else
            {
                idxTable = new CodeElementWrapperArrayIndexTable(codeElementArray);

                for (int i = 0; i < codeElementArray.Count; i++)
                {
                    if (codeElementArray[i].ElementType == crit.ElementFilter)
                    {
                        idxTable.Add(i);
                    }
                }

                idxTable.Sort(new SortCriteria(SortCriteria.SortType.ALPHA));
            }

            var ret = new ResultsTable(idxTable);
            return (ret);
        }
Beispiel #2
0
 /// <summary>
 /// Initializes a new instance of the ResultsTable class.
 /// </summary>
 /// <param name="indexTable">A CodeElementWrapperArrayIndexTable object to initialize from.</param>
 public ResultsTable(CodeElementWrapperArrayIndexTable indexTable)
     : base(indexTable)
 {
     Reset();
 }