Пример #1
0
 public MergingIterator(Comparator comparator, Iterator[] children)
 {
     comparator_ = comparator;
       children_ = new IteratorWrapper[children.Length];
       current_ = null;
       direction_ = Direction.kForward;
       for (int i = 0; i < children.Length; i++)
     children_[i] = new IteratorWrapper(children[i]);
 }
Пример #2
0
   public TwoLevelIterator(
 Iterator index_iter,
 BlockFunctionDelegate block_function,
 object arg,
 ReadOptions options)
   {
       block_function_ = block_function;
         arg_ = arg;
         options_ = options;
         index_iter_ = new IteratorWrapper(index_iter);
         data_iter_ = null;
   }
Пример #3
0
 void FindSmallest()
 {
     IteratorWrapper smallest = null;
       for (int i = 0; i < children_.Length; i++)
       {
     IteratorWrapper child = children_[i];
     if (child.Valid)
     {
       if (smallest == null)
       {
     smallest = child;
       }
       else if (comparator_.Compare(child.Key, smallest.Key) < 0)
       {
     smallest = child;
       }
     }
       }
       current_ = smallest;
 }
Пример #4
0
 void FindLargest()
 {
     IteratorWrapper largest = null;
       for (int i = children_.Length - 1; i >= 0; i--)
       {
     IteratorWrapper child = children_[i];
     if (child.Valid)
     {
       if (largest == null)
       {
     largest = child;
       }
       else if (comparator_.Compare(child.Key, largest.Key) > 0)
       {
     largest = child;
       }
     }
       }
       current_ = largest;
 }