From ecf0789d1b08366cef60a9e52ac056ac1337c38c Mon Sep 17 00:00:00 2001 From: handa Date: Fri, 17 Apr 2009 15:17:24 +0000 Subject: [PATCH] *** empty log message *** --- MSymbol.cs | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/MSymbol.cs b/MSymbol.cs index b92bcbf..96ff477 100644 --- a/MSymbol.cs +++ b/MSymbol.cs @@ -53,26 +53,30 @@ namespace M17N.Core return str; } - public override bool Equals (object sym) + public static bool operator== (MSymbol sym1, MSymbol sym2) { - if (sym == null) - return false; - return (this.data == ((MSymbol) sym).data); + if (System.Object.ReferenceEquals(sym1, sym2)) + return true; + if (((object) sym1 == null) || ((object) sym2 == null)) + return false; + return sym1.data == sym2.data; } - public override int GetHashCode () + public static bool operator!= (MSymbol sym1, MSymbol sym2) { - return (data.name.GetHashCode ()); + return ! (sym1 == sym2); } - public static bool operator== (MSymbol sym1, MSymbol sym2) + public override bool Equals (object sym) { - return (sym1.data == sym2.data); + if (sym == null) + return false; + return (this.data == ((MSymbol) sym).data); } - public static bool operator!= (MSymbol sym1, MSymbol sym2) + public override int GetHashCode () { - return (sym1.data != sym2.data); + return (data.name.GetHashCode ()); } public MPlist Find (MSymbol key) -- 1.7.10.4