Beispiel #1
0
 public bool Equals(Node <T> other)
 {
     try
     {
         return(Data.Equals(other.Data) &&
                PreviousNodes.Select(t => t.Data).SequenceEqual(other.PreviousNodes.Select(t => t.Data)) &&
                NextNodes.Select(t => t.Data).SequenceEqual(other.NextNodes.Select(t => t.Data)));
     }
     catch (Exception)
     {
         return(false);
     }
 }
Beispiel #2
0
        public void AddBefore(BehaviorNode newNode)
        {
            if (PreviousNodes.Contains(newNode))
            {
                return;
            }

            if (Previous != null)
            {
                newNode.Remove();
                Previous.Next = newNode;
            }
            newNode.Next = this;
        }
Beispiel #3
0
        /// <summary>
        ///   Inserts the BehaviorNode "newNode" directly ahead of this BehaviorNode
        ///   in the BehaviorChain.  All other ordering is preserved
        /// </summary>
        /// <param name = "newNode"></param>
        public void AddBefore(BehaviorNode newNode)
        {
            if (PreviousNodes.Contains(newNode))
            {
                return;
            }

            newNode.Remove();

            if (Previous != null)
            {
                Previous.Next = newNode;
            }

            if (Previous == null && Chain != null)
            {
                Chain.Prepend(newNode);
            }

            newNode.Next = this;
        }
Beispiel #4
0
        /// <summary>
        /// Inserts the BehaviorNode "newNode" directly ahead of this BehaviorNode
        /// in the BehaviorChain.  All other ordering is preserved
        /// </summary>
        /// <param name="newNode"></param>
        public void AddBefore(BehaviorNode newNode)
        {
            Debug.WriteLine("Adding {0} before {1}".ToFormat(newNode.ToString(), this.ToString()));

            if (PreviousNodes.Contains(newNode))
            {
                return;
            }

            newNode.Remove();

            if (Previous != null)
            {
                Previous.Next = newNode;
            }

            if (Previous == null && Chain != null)
            {
                Chain.Prepend(newNode);
            }

            newNode.Next = this;
        }
Beispiel #5
0
 /// <summary>
 /// Adds the node to the collection of predecessor nodes.
 /// </summary>
 /// <param name="previousNode">The previous node.</param>
 public void AddPreviousNode(IRunnableNode previousNode)
 {
     PreviousNodes.Add(previousNode);
 }