Esempio n. 1
0
        /// <summary>
        /// Perform a operation over all tree nodes in the
        /// specified order. The operation is specified
        /// through a visitor object.
        /// </summary>
        public void WalkTree(TreeNode nodeFrom, ITreeNodeVisitor visitor)
        {
            visitor.Visit(nodeFrom);

            foreach (TreeNode child in nodeFrom.Children)
            {
                WalkTree(child, visitor);
            }
        }
Esempio n. 2
0
        public override void Accept(ITreeNodeVisitor v)
        {
            v.Visit(this);

            foreach (var c in Children)
            {
                c.Accept(v);
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Applies a visitor to each ancestor
 /// </summary>
 /// <param name="visitor">
 /// The visitor.
 /// </param>
 public void Climb(ITreeNodeVisitor <T> visitor)
 {
     if (!visitor.Completed)
     {
         visitor.Visit(this);
     }
     if (!visitor.Completed && this.Parent != null)
     {
         Parent.Climb(visitor);
     }
 }
Esempio n. 4
0
        /// <summary>
        /// Applies a visitor to each node in a traversal.
        /// </summary>
        /// <param name="visitor">
        /// The action.
        /// </param>
        public void Traverse(ITreeNodeVisitor <T> visitor)
        {
            if (!visitor.Completed)
            {
                visitor.Visit(this);
            }

            foreach (var child in this._children)
            {
                child.Traverse(visitor);
                if (visitor.Completed)
                {
                    break;
                }
            }
        }
Esempio n. 5
0
		/// <summary>
		/// Perform a operation over all tree nodes in the
		/// specified order. The operation is specified
		/// through a visitor object.
		/// </summary>
		public void WalkTree(TreeNode nodeFrom, ITreeNodeVisitor visitor)
		{
			visitor.Visit(nodeFrom);

			foreach(TreeNode child in nodeFrom.Children)
				WalkTree(child, visitor);
		}
Esempio n. 6
0
 public void Accept(ITreeNodeVisitor visitor)
 {
     visitor.Visit(this);
 }
Esempio n. 7
0
 public override void Accept(ITreeNodeVisitor visitor)
 {
     visitor.Visit(this);
 }
Esempio n. 8
0
 public void Accept(ITreeNodeVisitor visitor)
 {
     visitor.Visit(this);
 }
Esempio n. 9
0
 public override void Accept(ITreeNodeVisitor visitor)
 {
     visitor.Visit(this);
 }