From: handa Date: Fri, 17 Apr 2009 15:17:24 +0000 (+0000) Subject: *** empty log message *** X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ecf0789d1b08366cef60a9e52ac056ac1337c38c;p=m17n%2Fm17n-lib-cs.git *** empty log message *** --- 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)