/// <summary> /// Checks the equality of objects. /// </summary> /// <param name="obj">Object to be checked.</param> /// <returns>True if the objects are equal, false otherwise.</returns> public override bool Equals(object obj) { Minus other = obj as Minus; if (other == null) { return(false); } return(LeftChild.Equals(other.LeftChild) && RightChild.Equals(other.RightChild)); }
/// <summary> /// Checks the equality of objects. /// </summary> /// <param name="obj">Object to be checked.</param> /// <returns>True if the objects are equal, false otherwise.</returns> public override bool Equals(object obj) { ImplyExpression other = obj as ImplyExpression; if (other == null) { return(false); } return(LeftChild.Equals(other.LeftChild) && RightChild.Equals(other.RightChild)); }
public override bool Equals(object obj) { if (obj.GetType() != GetType()) { return(false); } var other = obj as BinaryTreeNode <T>; if (!Value.Equals(other.Value)) { return(false); } if (!((Parent == null && other.Parent == null) || (Parent.Value.Equals(other.Parent.Value)))) { return(false); } if (!((LeftSibling == null && other.LeftSibling == null) || (LeftSibling.Value.Equals(other.LeftSibling.Value)))) { return(false); } if (!((RightSibling == null && other.RightSibling == null) || (RightSibling.Value.Equals(other.RightSibling.Value)))) { return(false); } if ((LeftChild == null && other.LeftChild != null) || (LeftChild != null && other.LeftChild == null)) { return(false); } if ((RightChild == null && other.RightChild != null) || (RightChild != null && other.RightChild == null)) { return(false); } var result = true; if (LeftChild != null && other.LeftChild != null) { result &= LeftChild.Equals(other.LeftChild); } if (RightChild != null && other.RightChild != null) { result &= RightChild.Equals(other.RightChild); } return(result); }