public override bool Equals(object obj) { if (this == obj) return true; if (obj == null) return false; if (GetType() != obj.GetType()) return false; Edge<T> other = obj as Edge<T>; if (Vertex1 == null) { if (other?.Vertex1 != null) return false; } else if (!Vertex1.Equals(other?.Vertex1)) return false; if (Vertex2 == null) { if (other?.Vertex2 != null) return false; } else if (!Vertex2.Equals(other?.Vertex2)) return false; return true; }
private bool Equals(MyTriangle p) { bool flag = false; if (Vertex1.Equals(p.Vertex1)) { if (Vertex2.Equals(p.Vertex2)) { if (Vertex3.Equals(p.Vertex3)) { flag = true; } } if (Vertex2.Equals(p.Vertex3)) { if (Vertex3.Equals(p.Vertex2)) { flag = true; } } } if (Vertex1.Equals(p.Vertex2)) { if (Vertex2.Equals(p.Vertex1)) { if (Vertex3.Equals(p.Vertex3)) { flag = true; } } if (Vertex2.Equals(p.Vertex3)) { if (Vertex3.Equals(p.Vertex1)) { flag = true; } } } if (Vertex1.Equals(p.Vertex3)) { if (Vertex2.Equals(p.Vertex1)) { if (Vertex3.Equals(p.Vertex2)) { flag = true; } } if (Vertex2.Equals(p.Vertex2)) { if (Vertex3.Equals(p.Vertex1)) { flag = true; } } } return(flag); }
/// <inheritdoc /> public bool Equals(Triangle other) { if (ReferenceEquals(other, null)) { return(false); } if (ReferenceEquals(other, this)) { return(true); } return((Vertex1?.Equals(other.Vertex1) ?? false) && (Vertex2?.Equals(other.Vertex2) ?? false) && (Vertex3?.Equals(other.Vertex3) ?? false)); }
public Vertex getOtherVertex(Vertex currentVertex) { Vertex nextVertex = null; if (Vertex1.Equals(currentVertex)) { nextVertex = Vertex2; } else if (Vertex2.Equals(currentVertex)) { nextVertex = Vertex1; } return(nextVertex); }
/// <summary> /// Indicates whether the current <see cref="UndirectedWeightedEdge{TVertex}"/> /// is equal to another <see cref="UndirectedWeightedEdge{TVertex}"/>. /// </summary> /// <param name="other"> /// The <see cref="UndirectedWeightedEdge{TVertex}"/> to compare with this /// object. /// </param> /// <returns> /// <see langword="true"/> if the other /// <see cref="UndirectedWeightedEdge{TVertex}"/> is equal to this /// <see cref="UndirectedWeightedEdge{TVertex}"/>; otherwise, /// <see langword="false"/>. /// </returns> /// <seealso cref="IEquatable{T}.Equals(T)"/> public bool Equals(UndirectedWeightedEdge <TVertex> other) { if (other == null) { return(false); } bool sameVerticesSameOrder = Vertex1.Equals(other.Vertex1) && Vertex2.Equals(other.Vertex2); bool sameVerticesDifferentOrder = Vertex1.Equals(other.Vertex2) && Vertex2.Equals(other.Vertex1); return((sameVerticesSameOrder || sameVerticesDifferentOrder) && Weight.Equals(other.Weight)); }
public bool Contains(Vertex vertex) { return(Vertex1.Equals(vertex) || Vertex2.Equals(vertex)); }
public bool Equals(Edge <T> other) { return(Vertex1.Equals(other.Vertex1) && Vertex2.Equals(other.Vertex2)); }
public bool Equals(Edge <TVertex> otherEdge) { return((Vertex1.Equals(otherEdge.Vertex1) && Vertex2.Equals(otherEdge.Vertex2)) || (Vertex1.Equals(otherEdge.Vertex2) && Vertex2.Equals(otherEdge.Vertex1))); }