Exemplo n.º 1
0
 /// <summary>
 /// Returns the iterator pointing to the first item greater than <paramref name="item"/>.
 /// </summary>
 public RedBlackTreeIterator<T> UpperBound(T item)
 {
     RedBlackTreeIterator<T> it = LowerBound(item);
     while (it.IsValid && host.Compare(it.Current, item) == 0)
     {
         it.MoveNext();
     }
     return it;
 }
Exemplo n.º 2
0
        public RedBlackTreeIterator <T> UpperBound(T item)
        {
            RedBlackTreeIterator <T> redBlackTreeIterator = this.LowerBound(item);

            while (redBlackTreeIterator.IsValid && this.host.Compare(redBlackTreeIterator.Current, item) == 0)
            {
                redBlackTreeIterator.MoveNext();
            }
            return(redBlackTreeIterator);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Returns the iterator pointing to the specified item, or an iterator in End state if the item is not found.
 /// </summary>
 public RedBlackTreeIterator<T> Find(T item)
 {
     RedBlackTreeIterator<T> it = LowerBound(item);
     while (it.IsValid && host.Compare(it.Current, item) == 0)
     {
         if (host.Equals(it.Current, item))
             return it;
         it.MoveNext();
     }
     return default(RedBlackTreeIterator<T>);
 }
Exemplo n.º 4
0
        public RedBlackTreeIterator <T> Find(T item)
        {
            RedBlackTreeIterator <T> redBlackTreeIterator = this.LowerBound(item);

            while (redBlackTreeIterator.IsValid && this.host.Compare(redBlackTreeIterator.Current, item) == 0)
            {
                if (this.host.Equals(redBlackTreeIterator.Current, item))
                {
                    return(redBlackTreeIterator);
                }
                redBlackTreeIterator.MoveNext();
            }
            return(new RedBlackTreeIterator <T>());
        }