AddNode() публичный абстрактный Метод

Adds new node as a child.
public abstract AddNode ( ANode node ) : bool
node ANode Node to be added as child.
Результат bool
Пример #1
0
 /// <summary>
 /// Creates connection between one node to another. The connection is one one-way and tries to prevent circular to prevent infinity loops.
 /// </summary>
 /// <param name="from">A node that is higher in hierarchy.</param>
 /// <param name="to">A node that is lower in hierarchy.</param>
 /// <returns>True if connection succeed. Otherwise false.</returns>
 public bool ConnectNodes(AFlowNode from, ANode to)
 {
     if (_nodes.Contains(from) && _nodes.Contains(to) && to != Root)
     {
         var n = to as AFlowNode;
         if (n != null)
         {
             //check nodes recursive to prevent circular trees
             if (IsConnected(from, n))
             {
                 return(false);
             }
         }
         return(from.AddNode(to));
     }
     return(false);
 }
Пример #2
0
 /// <summary>
 /// Creates connection between one node to another. The connection is one one-way and tries to prevent circular to prevent infinity loops.
 /// </summary>
 /// <param name="from">A node that is higher in hierarchy.</param>
 /// <param name="to">A node that is lower in hierarchy.</param>
 /// <returns>True if connection succeed. Otherwise false.</returns>
 public bool ConnectNodes(AFlowNode from, ANode to)
 {
     if (_nodes.Contains(from) && _nodes.Contains(to) && to != Root) {
         var n = to as AFlowNode;
         if (n != null) {
             //check nodes recursive to prevent circular trees
             if (IsConnected(from, n)) {
                 return false;
             }
         }
         return from.AddNode(to);
     }
     return false;
 }