Пример #1
0
        public bool MoveNext()
        {
            if (_currentNode == null)
            {
                _currentNode = _tree.First;
            }
            else
            {
                _currentNode = _tree.Next(_currentNode);
            }

            return(!_currentNode.IsNull);
        }
Пример #2
0
        /// <summary>
        /// Finds object(s) in the set.
        /// </summary>
        /// <returns>Collection of objects equal to <b>obj</b>.</returns>
        /// <remarks>
        /// If no elements equal to <b>obj</b> are found in the set, returns
        /// valid reference to an empty collection.
        /// </remarks>
        public System.Collections.ICollection FindAll(object key)
        {
            System.Collections.ArrayList result = new System.Collections.ArrayList();
            if (key == null)
            {
                return(result);
            }

            RbTreeNode lower = _tree.LowerBound(key);
            RbTreeNode upper = _tree.UpperBound(key);

            if (lower == upper)
            {
                return(result);
            }

            for (RbTreeNode node = lower; node != upper; node = _tree.Next(node))
            {
                result.Add(node.Value);
            }

            return(result);
        }