Ejemplo n.º 1
0
 public Index Filter(IndexBinding binding)
 {
     Index res = new Index();
     bool wasSorted = binding.IsSorted;
     ListSortDirection prevOrder = binding.Order;
     if (!wasSorted || prevOrder != settings.Direction)
         binding.Sort(settings.Direction);
     int lim = settings.Count > binding.Count ? binding.Count : settings.Count;
     int i = 0;
     foreach (KeyValuePair<string, int> pair in binding)
     {
         if (i >= lim)
             break;
         res.Add(pair.Key, pair.Value);
         i++;
     }
     if (!wasSorted)
         binding.Reset();
     else if (prevOrder != settings.Direction)
         binding.Sort(prevOrder);
     return res;
 }
Ejemplo n.º 2
0
 private void RunScanner(Scanner sr, string path)
 {
     sr.Scan(path);
     index = sr.GetIndex();
     binding = new IndexBinding(index);
 }