예제 #1
0
        public bool MoveNext()
        {
            BinaryTreeCellsNode oldCurrentRight = current.right;

            current = current.left;

            if (current == (Object)null)
            {
                if (oldCurrentRight != (Object)null)
                {
                    current = oldCurrentRight;
                }
                else
                {
                    if (RightNode.Count == 0)
                    {
                        return(false);
                    }

                    current = RightNode.Pop(); // В стеке ещё есть праый узел, Переходим на него
                }
            }
            else
            if (oldCurrentRight != (Object)null)
            {
                RightNode.Push(oldCurrentRight);
            }

            return(true);
        }
예제 #2
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         current   = null;
         RightNode = null;
     }
 }
예제 #3
0
 public void Reset()
 {
     current = new BinaryTreeCellsNode(null)
     {
         left   = cells.First(),
         right  = null,
         parent = null
     };
 }
예제 #4
0
        public void SetParentLeftOrRight(BinaryTreeCellsNode node)
        {
            switch (Side())
            {
            case SideNode.Left:
                parent.left = node;
                break;

            case SideNode.Right:
                parent.right = node;
                break;
            }
        }
예제 #5
0
 public bool Equals(BinaryTreeCellsNode other)
 {
     return(cell.Equals(other.cell));
 }
예제 #6
0
 public int CompareTo(BinaryTreeCellsNode other) => cell.CompareTo(other.cell);