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); } }
public void AddBefore(BehaviorNode newNode) { if (PreviousNodes.Contains(newNode)) { return; } if (Previous != null) { newNode.Remove(); Previous.Next = newNode; } newNode.Next = this; }
/// <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; }
/// <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; }
/// <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); }