Example #1
0
		///<summary>
		///Adds a child node.
		///</summary>
		public void AddChild( ICustomNode node ) {
			if (node != null) {
				if (!childrenNames.Contains(node.Name))
				{	
					children.Add(node);
					childrenNames.Add(node.Name);
					node.Parent = this;
				} else {
					LoggingService.Warn("Node is already there: " + node.Name);
				}
			}
		}
Example #2
0
        /// <summary>
        /// Visists the given visitor with the specified custom node.
        /// </summary>
        public static bool Accept(ICustomNode node, ISolutionVisitor visitor)
        {
            if (visitor.VisitEnter(node))
            {
                foreach (var child in node.Nodes)
                {
                    if (!child.Accept(visitor))
                    {
                        break;
                    }
                }
            }

            return(visitor.VisitLeave(node));
        }
        /// <summary>
        /// Visists the given visitor with the specified custom node.
        /// </summary>
        public static bool Accept(ICustomNode node, ISolutionVisitor visitor)
        {
            if (visitor.VisitEnter(node))
            {
                foreach (var child in node.Nodes)
                {
                    if (!child.Accept(visitor))
                        break;
                }
            }

            return visitor.VisitLeave(node);
        }
Example #4
0
 /// <summary>
 /// Ends visiting a custom node.
 /// </summary>
 /// <param name="node">The custom node being visited.</param>
 /// <returns><see langword="true" /> if the node siblings should be visited; <see langword="false" /> otherwise.</returns>
 public bool VisitLeave(ICustomNode node)
 {
     return(true);
 }
Example #5
0
 /// <summary>
 /// Begins visiting a custom node.
 /// </summary>
 /// <param name="node">The custom node being visited.</param>
 /// <returns><see langword="true" /> if the node children should be visited; <see langword="false" /> otherwise.</returns>
 public bool VisitEnter(ICustomNode node)
 {
     return(true);
 }
 /// <summary>
 /// Ends visiting a custom node.
 /// </summary>
 /// <param name="node">The custom node being visited.</param>
 /// <returns><see langword="true" /> if the node siblings should be visited; <see langword="false" /> otherwise.</returns>
 public bool VisitLeave(ICustomNode node)
 {
     return true;
 }
 /// <summary>
 /// Begins visiting a custom node.
 /// </summary>
 /// <param name="node">The custom node being visited.</param>
 /// <returns><see langword="true" /> if the node children should be visited; <see langword="false" /> otherwise.</returns>
 public bool VisitEnter(ICustomNode node)
 {
     return true;
 }
 public bool VisitLeave(ICustomNode node)
 {
     throw new NotImplementedException();
 }
Example #9
0
		///<summary>
		///Registers a node and all its child nodes.
		///</summary>
		/// <param name="iterator">Iterator</param>
		public static void RegisterWithChildren( ICustomNode iterator ) {
			//TODO : makes non recursive later*/
			if (iterator != null) {
				//Debug.ConsoleOut("iterator is " + iterator.Name);
				iterator.Register();
				if (iterator.Children.Count == 0) {
					return;
				} else {
					foreach(CustomNode node in iterator.Children) {
						CustomNode.RegisterWithChildren(node);
					}
				}
			}
		}
Example #10
0
		///<summary>
		///Gets a node.
		///</summary>
		/// <param name="iterator">Iterator</param>
		/// <param name="name">Name</param>
		/// <returns>
		///Node.
		///</returns>
		public static ICustomNode GetChild( ICustomNode iterator, string name ) {
			//TODO : makes non recursive later*/
			
			ICustomNode result = null;
			if (iterator != null) {

				if (iterator.Name == name) {
					result = iterator;
				}
				else {
					if (iterator.Children.Count != 0) {
						foreach(CustomNode node in iterator.Children) {
							result = GetChild(node, name);
							if (result != null) {
								break;
							}
						}
					}
				}
			}
			return result;
		}
 public bool VisitLeave(ICustomNode node)
 {
     throw new NotImplementedException();
 }