Permalink
Browse files

Remove operator == from AstNodeCollection.

  • Loading branch information...
1 parent c15615d commit 877ebf8bdbd0c77d1a6aca4896f0d1139e903b75 @dgrunwald dgrunwald committed Jul 23, 2011
@@ -133,28 +133,17 @@ IEnumerator IEnumerable.GetEnumerator()
}
#region Equals and GetHashCode implementation
- public override bool Equals(object obj)
- {
- if (obj is AstNodeCollection<T>) {
- return ((AstNodeCollection<T>)obj) == this;
- } else {
- return false;
- }
- }
-
public override int GetHashCode()
{
return node.GetHashCode() ^ role.GetHashCode();
}
- public static bool operator ==(AstNodeCollection<T> left, AstNodeCollection<T> right)
- {
- return left.role == right.role && left.node == right.node;
- }
-
- public static bool operator !=(AstNodeCollection<T> left, AstNodeCollection<T> right)
+ public override bool Equals(object obj)
{
- return !(left.role == right.role && left.node == right.node);
+ AstNodeCollection<T> other = obj as AstNodeCollection<T>;
+ if (other == null)
+ return false;
+ return this.node == other.node && this.role == other.role;
}
#endregion
@@ -132,28 +132,17 @@ IEnumerator IEnumerable.GetEnumerator()
}
#region Equals and GetHashCode implementation
- public override bool Equals(object obj)
- {
- if (obj is AstNodeCollection<T>) {
- return ((AstNodeCollection<T>)obj) == this;
- } else {
- return false;
- }
- }
-
public override int GetHashCode()
{
return node.GetHashCode() ^ role.GetHashCode();
}
- public static bool operator ==(AstNodeCollection<T> left, AstNodeCollection<T> right)
- {
- return left.role == right.role && left.node == right.node;
- }
-
- public static bool operator !=(AstNodeCollection<T> left, AstNodeCollection<T> right)
+ public override bool Equals(object obj)
{
- return !(left.role == right.role && left.node == right.node);
+ AstNodeCollection<T> other = obj as AstNodeCollection<T>;
+ if (other == null)
+ return false;
+ return this.node == other.node && this.role == other.role;
}
#endregion

0 comments on commit 877ebf8

Please sign in to comment.